You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6747 lines
157KB

  1. /* Gimple IR definitions.
  2. Copyright (C) 2007-2020 Free Software Foundation, Inc.
  3. Contributed by Aldy Hernandez <aldyh@redhat.com>
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify it under
  6. the terms of the GNU General Public License as published by the Free
  7. Software Foundation; either version 3, or (at your option) any later
  8. version.
  9. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GCC; see the file COPYING3. If not see
  15. <http://www.gnu.org/licenses/>. */
  16. #ifndef GCC_GIMPLE_H
  17. #define GCC_GIMPLE_H
  18. #include "tree-ssa-alias.h"
  19. #include "gimple-expr.h"
  20. typedef gimple *gimple_seq_node;
  21. enum gimple_code {
  22. #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
  23. #include "gimple.def"
  24. #undef DEFGSCODE
  25. LAST_AND_UNUSED_GIMPLE_CODE
  26. };
  27. extern const char *const gimple_code_name[];
  28. extern const unsigned char gimple_rhs_class_table[];
  29. /* Strip the outermost pointer, from tr1/type_traits. */
  30. template<typename T> struct remove_pointer { typedef T type; };
  31. template<typename T> struct remove_pointer<T *> { typedef T type; };
  32. /* Error out if a gimple tuple is addressed incorrectly. */
  33. #if defined ENABLE_GIMPLE_CHECKING
  34. #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
  35. extern void gimple_check_failed (const gimple *, const char *, int, \
  36. const char *, enum gimple_code, \
  37. enum tree_code) ATTRIBUTE_NORETURN \
  38. ATTRIBUTE_COLD;
  39. #define GIMPLE_CHECK(GS, CODE) \
  40. do { \
  41. const gimple *__gs = (GS); \
  42. if (gimple_code (__gs) != (CODE)) \
  43. gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
  44. (CODE), ERROR_MARK); \
  45. } while (0)
  46. template <typename T>
  47. static inline T
  48. GIMPLE_CHECK2(const gimple *gs,
  49. #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
  50. const char *file = __builtin_FILE (),
  51. int line = __builtin_LINE (),
  52. const char *fun = __builtin_FUNCTION ())
  53. #else
  54. const char *file = __FILE__,
  55. int line = __LINE__,
  56. const char *fun = NULL)
  57. #endif
  58. {
  59. T ret = dyn_cast <T> (gs);
  60. if (!ret)
  61. gimple_check_failed (gs, file, line, fun,
  62. remove_pointer<T>::type::code_, ERROR_MARK);
  63. return ret;
  64. }
  65. template <typename T>
  66. static inline T
  67. GIMPLE_CHECK2(gimple *gs,
  68. #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
  69. const char *file = __builtin_FILE (),
  70. int line = __builtin_LINE (),
  71. const char *fun = __builtin_FUNCTION ())
  72. #else
  73. const char *file = __FILE__,
  74. int line = __LINE__,
  75. const char *fun = NULL)
  76. #endif
  77. {
  78. T ret = dyn_cast <T> (gs);
  79. if (!ret)
  80. gimple_check_failed (gs, file, line, fun,
  81. remove_pointer<T>::type::code_, ERROR_MARK);
  82. return ret;
  83. }
  84. #else /* not ENABLE_GIMPLE_CHECKING */
  85. #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
  86. #define GIMPLE_CHECK(GS, CODE) (void)0
  87. template <typename T>
  88. static inline T
  89. GIMPLE_CHECK2(gimple *gs)
  90. {
  91. return as_a <T> (gs);
  92. }
  93. template <typename T>
  94. static inline T
  95. GIMPLE_CHECK2(const gimple *gs)
  96. {
  97. return as_a <T> (gs);
  98. }
  99. #endif
  100. /* Class of GIMPLE expressions suitable for the RHS of assignments. See
  101. get_gimple_rhs_class. */
  102. enum gimple_rhs_class
  103. {
  104. GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
  105. GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
  106. GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
  107. GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
  108. GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
  109. name, a _DECL, a _REF, etc. */
  110. };
  111. /* Specific flags for individual GIMPLE statements. These flags are
  112. always stored in gimple.subcode and they may only be
  113. defined for statement codes that do not use subcodes.
  114. Values for the masks can overlap as long as the overlapping values
  115. are never used in the same statement class.
  116. The maximum mask value that can be defined is 1 << 15 (i.e., each
  117. statement code can hold up to 16 bitflags).
  118. Keep this list sorted. */
  119. enum gf_mask {
  120. GF_ASM_INPUT = 1 << 0,
  121. GF_ASM_VOLATILE = 1 << 1,
  122. GF_ASM_INLINE = 1 << 2,
  123. GF_CALL_FROM_THUNK = 1 << 0,
  124. GF_CALL_RETURN_SLOT_OPT = 1 << 1,
  125. GF_CALL_TAILCALL = 1 << 2,
  126. GF_CALL_VA_ARG_PACK = 1 << 3,
  127. GF_CALL_NOTHROW = 1 << 4,
  128. GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
  129. GF_CALL_INTERNAL = 1 << 6,
  130. GF_CALL_CTRL_ALTERING = 1 << 7,
  131. GF_CALL_MUST_TAIL_CALL = 1 << 9,
  132. GF_CALL_BY_DESCRIPTOR = 1 << 10,
  133. GF_CALL_NOCF_CHECK = 1 << 11,
  134. GF_OMP_PARALLEL_COMBINED = 1 << 0,
  135. GF_OMP_PARALLEL_GRID_PHONY = 1 << 1,
  136. GF_OMP_TASK_TASKLOOP = 1 << 0,
  137. GF_OMP_TASK_TASKWAIT = 1 << 1,
  138. GF_OMP_FOR_KIND_MASK = (1 << 3) - 1,
  139. GF_OMP_FOR_KIND_FOR = 0,
  140. GF_OMP_FOR_KIND_DISTRIBUTE = 1,
  141. GF_OMP_FOR_KIND_TASKLOOP = 2,
  142. GF_OMP_FOR_KIND_OACC_LOOP = 4,
  143. GF_OMP_FOR_KIND_GRID_LOOP = 5,
  144. GF_OMP_FOR_KIND_SIMD = 6,
  145. GF_OMP_FOR_COMBINED = 1 << 3,
  146. GF_OMP_FOR_COMBINED_INTO = 1 << 4,
  147. /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop
  148. statements. */
  149. GF_OMP_FOR_GRID_PHONY = 1 << 5,
  150. /* The following two flags should only be set on GF_OMP_FOR_KIND_GRID_LOOP
  151. loop statements. */
  152. GF_OMP_FOR_GRID_INTRA_GROUP = 1 << 5,
  153. GF_OMP_FOR_GRID_GROUP_ITER = 1 << 6,
  154. GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1,
  155. GF_OMP_TARGET_KIND_REGION = 0,
  156. GF_OMP_TARGET_KIND_DATA = 1,
  157. GF_OMP_TARGET_KIND_UPDATE = 2,
  158. GF_OMP_TARGET_KIND_ENTER_DATA = 3,
  159. GF_OMP_TARGET_KIND_EXIT_DATA = 4,
  160. GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
  161. GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
  162. GF_OMP_TARGET_KIND_OACC_SERIAL = 7,
  163. GF_OMP_TARGET_KIND_OACC_DATA = 8,
  164. GF_OMP_TARGET_KIND_OACC_UPDATE = 9,
  165. GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 10,
  166. GF_OMP_TARGET_KIND_OACC_DECLARE = 11,
  167. GF_OMP_TARGET_KIND_OACC_HOST_DATA = 12,
  168. GF_OMP_TEAMS_GRID_PHONY = 1 << 0,
  169. GF_OMP_TEAMS_HOST = 1 << 1,
  170. /* True on an GIMPLE_OMP_RETURN statement if the return does not require
  171. a thread synchronization via some sort of barrier. The exact barrier
  172. that would otherwise be emitted is dependent on the OMP statement with
  173. which this return is associated. */
  174. GF_OMP_RETURN_NOWAIT = 1 << 0,
  175. GF_OMP_SECTION_LAST = 1 << 0,
  176. GF_OMP_ATOMIC_MEMORY_ORDER = (1 << 3) - 1,
  177. GF_OMP_ATOMIC_NEED_VALUE = 1 << 3,
  178. GF_PREDICT_TAKEN = 1 << 15
  179. };
  180. /* This subcode tells apart different kinds of stmts that are not used
  181. for codegen, but rather to retain debug information. */
  182. enum gimple_debug_subcode {
  183. GIMPLE_DEBUG_BIND = 0,
  184. GIMPLE_DEBUG_SOURCE_BIND = 1,
  185. GIMPLE_DEBUG_BEGIN_STMT = 2,
  186. GIMPLE_DEBUG_INLINE_ENTRY = 3
  187. };
  188. /* Masks for selecting a pass local flag (PLF) to work on. These
  189. masks are used by gimple_set_plf and gimple_plf. */
  190. enum plf_mask {
  191. GF_PLF_1 = 1 << 0,
  192. GF_PLF_2 = 1 << 1
  193. };
  194. /* Data structure definitions for GIMPLE tuples. NOTE: word markers
  195. are for 64 bit hosts. */
  196. struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
  197. chain_next ("%h.next"), variable_size))
  198. gimple
  199. {
  200. /* [ WORD 1 ]
  201. Main identifying code for a tuple. */
  202. ENUM_BITFIELD(gimple_code) code : 8;
  203. /* Nonzero if a warning should not be emitted on this tuple. */
  204. unsigned int no_warning : 1;
  205. /* Nonzero if this tuple has been visited. Passes are responsible
  206. for clearing this bit before using it. */
  207. unsigned int visited : 1;
  208. /* Nonzero if this tuple represents a non-temporal move. */
  209. unsigned int nontemporal_move : 1;
  210. /* Pass local flags. These flags are free for any pass to use as
  211. they see fit. Passes should not assume that these flags contain
  212. any useful value when the pass starts. Any initial state that
  213. the pass requires should be set on entry to the pass. See
  214. gimple_set_plf and gimple_plf for usage. */
  215. unsigned int plf : 2;
  216. /* Nonzero if this statement has been modified and needs to have its
  217. operands rescanned. */
  218. unsigned modified : 1;
  219. /* Nonzero if this statement contains volatile operands. */
  220. unsigned has_volatile_ops : 1;
  221. /* Padding to get subcode to 16 bit alignment. */
  222. unsigned pad : 1;
  223. /* The SUBCODE field can be used for tuple-specific flags for tuples
  224. that do not require subcodes. Note that SUBCODE should be at
  225. least as wide as tree codes, as several tuples store tree codes
  226. in there. */
  227. unsigned int subcode : 16;
  228. /* UID of this statement. This is used by passes that want to
  229. assign IDs to statements. It must be assigned and used by each
  230. pass. By default it should be assumed to contain garbage. */
  231. unsigned uid;
  232. /* [ WORD 2 ]
  233. Locus information for debug info. */
  234. location_t location;
  235. /* Number of operands in this tuple. */
  236. unsigned num_ops;
  237. /* [ WORD 3 ]
  238. Basic block holding this statement. */
  239. basic_block bb;
  240. /* [ WORD 4-5 ]
  241. Linked lists of gimple statements. The next pointers form
  242. a NULL terminated list, the prev pointers are a cyclic list.
  243. A gimple statement is hence also a double-ended list of
  244. statements, with the pointer itself being the first element,
  245. and the prev pointer being the last. */
  246. gimple *next;
  247. gimple *GTY((skip)) prev;
  248. };
  249. /* Base structure for tuples with operands. */
  250. /* This gimple subclass has no tag value. */
  251. struct GTY(())
  252. gimple_statement_with_ops_base : public gimple
  253. {
  254. /* [ WORD 1-6 ] : base class */
  255. /* [ WORD 7 ]
  256. SSA operand vectors. NOTE: It should be possible to
  257. amalgamate these vectors with the operand vector OP. However,
  258. the SSA operand vectors are organized differently and contain
  259. more information (like immediate use chaining). */
  260. struct use_optype_d GTY((skip (""))) *use_ops;
  261. };
  262. /* Statements that take register operands. */
  263. struct GTY((tag("GSS_WITH_OPS")))
  264. gimple_statement_with_ops : public gimple_statement_with_ops_base
  265. {
  266. /* [ WORD 1-7 ] : base class */
  267. /* [ WORD 8 ]
  268. Operand vector. NOTE! This must always be the last field
  269. of this structure. In particular, this means that this
  270. structure cannot be embedded inside another one. */
  271. tree GTY((length ("%h.num_ops"))) op[1];
  272. };
  273. /* Base for statements that take both memory and register operands. */
  274. struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
  275. gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
  276. {
  277. /* [ WORD 1-7 ] : base class */
  278. /* [ WORD 8-9 ]
  279. Virtual operands for this statement. The GC will pick them
  280. up via the ssa_names array. */
  281. tree GTY((skip (""))) vdef;
  282. tree GTY((skip (""))) vuse;
  283. };
  284. /* Statements that take both memory and register operands. */
  285. struct GTY((tag("GSS_WITH_MEM_OPS")))
  286. gimple_statement_with_memory_ops :
  287. public gimple_statement_with_memory_ops_base
  288. {
  289. /* [ WORD 1-9 ] : base class */
  290. /* [ WORD 10 ]
  291. Operand vector. NOTE! This must always be the last field
  292. of this structure. In particular, this means that this
  293. structure cannot be embedded inside another one. */
  294. tree GTY((length ("%h.num_ops"))) op[1];
  295. };
  296. /* Call statements that take both memory and register operands. */
  297. struct GTY((tag("GSS_CALL")))
  298. gcall : public gimple_statement_with_memory_ops_base
  299. {
  300. /* [ WORD 1-9 ] : base class */
  301. /* [ WORD 10-13 ] */
  302. struct pt_solution call_used;
  303. struct pt_solution call_clobbered;
  304. /* [ WORD 14 ] */
  305. union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
  306. tree GTY ((tag ("0"))) fntype;
  307. enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
  308. } u;
  309. /* [ WORD 15 ]
  310. Operand vector. NOTE! This must always be the last field
  311. of this structure. In particular, this means that this
  312. structure cannot be embedded inside another one. */
  313. tree GTY((length ("%h.num_ops"))) op[1];
  314. static const enum gimple_code code_ = GIMPLE_CALL;
  315. };
  316. /* OMP statements. */
  317. struct GTY((tag("GSS_OMP")))
  318. gimple_statement_omp : public gimple
  319. {
  320. /* [ WORD 1-6 ] : base class */
  321. /* [ WORD 7 ] */
  322. gimple_seq body;
  323. };
  324. /* GIMPLE_BIND */
  325. struct GTY((tag("GSS_BIND")))
  326. gbind : public gimple
  327. {
  328. /* [ WORD 1-6 ] : base class */
  329. /* [ WORD 7 ]
  330. Variables declared in this scope. */
  331. tree vars;
  332. /* [ WORD 8 ]
  333. This is different than the BLOCK field in gimple,
  334. which is analogous to TREE_BLOCK (i.e., the lexical block holding
  335. this statement). This field is the equivalent of BIND_EXPR_BLOCK
  336. in tree land (i.e., the lexical scope defined by this bind). See
  337. gimple-low.c. */
  338. tree block;
  339. /* [ WORD 9 ] */
  340. gimple_seq body;
  341. };
  342. /* GIMPLE_CATCH */
  343. struct GTY((tag("GSS_CATCH")))
  344. gcatch : public gimple
  345. {
  346. /* [ WORD 1-6 ] : base class */
  347. /* [ WORD 7 ] */
  348. tree types;
  349. /* [ WORD 8 ] */
  350. gimple_seq handler;
  351. };
  352. /* GIMPLE_EH_FILTER */
  353. struct GTY((tag("GSS_EH_FILTER")))
  354. geh_filter : public gimple
  355. {
  356. /* [ WORD 1-6 ] : base class */
  357. /* [ WORD 7 ]
  358. Filter types. */
  359. tree types;
  360. /* [ WORD 8 ]
  361. Failure actions. */
  362. gimple_seq failure;
  363. };
  364. /* GIMPLE_EH_ELSE */
  365. struct GTY((tag("GSS_EH_ELSE")))
  366. geh_else : public gimple
  367. {
  368. /* [ WORD 1-6 ] : base class */
  369. /* [ WORD 7,8 ] */
  370. gimple_seq n_body, e_body;
  371. };
  372. /* GIMPLE_EH_MUST_NOT_THROW */
  373. struct GTY((tag("GSS_EH_MNT")))
  374. geh_mnt : public gimple
  375. {
  376. /* [ WORD 1-6 ] : base class */
  377. /* [ WORD 7 ] Abort function decl. */
  378. tree fndecl;
  379. };
  380. /* GIMPLE_PHI */
  381. struct GTY((tag("GSS_PHI")))
  382. gphi : public gimple
  383. {
  384. /* [ WORD 1-6 ] : base class */
  385. /* [ WORD 7 ] */
  386. unsigned capacity;
  387. unsigned nargs;
  388. /* [ WORD 8 ] */
  389. tree result;
  390. /* [ WORD 9 ] */
  391. struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
  392. };
  393. /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
  394. struct GTY((tag("GSS_EH_CTRL")))
  395. gimple_statement_eh_ctrl : public gimple
  396. {
  397. /* [ WORD 1-6 ] : base class */
  398. /* [ WORD 7 ]
  399. Exception region number. */
  400. int region;
  401. };
  402. struct GTY((tag("GSS_EH_CTRL")))
  403. gresx : public gimple_statement_eh_ctrl
  404. {
  405. /* No extra fields; adds invariant:
  406. stmt->code == GIMPLE_RESX. */
  407. };
  408. struct GTY((tag("GSS_EH_CTRL")))
  409. geh_dispatch : public gimple_statement_eh_ctrl
  410. {
  411. /* No extra fields; adds invariant:
  412. stmt->code == GIMPLE_EH_DISPATH. */
  413. };
  414. /* GIMPLE_TRY */
  415. struct GTY((tag("GSS_TRY")))
  416. gtry : public gimple
  417. {
  418. /* [ WORD 1-6 ] : base class */
  419. /* [ WORD 7 ]
  420. Expression to evaluate. */
  421. gimple_seq eval;
  422. /* [ WORD 8 ]
  423. Cleanup expression. */
  424. gimple_seq cleanup;
  425. };
  426. /* Kind of GIMPLE_TRY statements. */
  427. enum gimple_try_flags
  428. {
  429. /* A try/catch. */
  430. GIMPLE_TRY_CATCH = 1 << 0,
  431. /* A try/finally. */
  432. GIMPLE_TRY_FINALLY = 1 << 1,
  433. GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
  434. /* Analogous to TRY_CATCH_IS_CLEANUP. */
  435. GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
  436. };
  437. /* GIMPLE_WITH_CLEANUP_EXPR */
  438. struct GTY((tag("GSS_WCE")))
  439. gimple_statement_wce : public gimple
  440. {
  441. /* [ WORD 1-6 ] : base class */
  442. /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
  443. executed if an exception is thrown, not on normal exit of its
  444. scope. This flag is analogous to the CLEANUP_EH_ONLY flag
  445. in TARGET_EXPRs. */
  446. /* [ WORD 7 ]
  447. Cleanup expression. */
  448. gimple_seq cleanup;
  449. };
  450. /* GIMPLE_ASM */
  451. struct GTY((tag("GSS_ASM")))
  452. gasm : public gimple_statement_with_memory_ops_base
  453. {
  454. /* [ WORD 1-9 ] : base class */
  455. /* [ WORD 10 ]
  456. __asm__ statement. */
  457. const char *string;
  458. /* [ WORD 11 ]
  459. Number of inputs, outputs, clobbers, labels. */
  460. unsigned char ni;
  461. unsigned char no;
  462. unsigned char nc;
  463. unsigned char nl;
  464. /* [ WORD 12 ]
  465. Operand vector. NOTE! This must always be the last field
  466. of this structure. In particular, this means that this
  467. structure cannot be embedded inside another one. */
  468. tree GTY((length ("%h.num_ops"))) op[1];
  469. };
  470. /* GIMPLE_OMP_CRITICAL */
  471. struct GTY((tag("GSS_OMP_CRITICAL")))
  472. gomp_critical : public gimple_statement_omp
  473. {
  474. /* [ WORD 1-7 ] : base class */
  475. /* [ WORD 8 ] */
  476. tree clauses;
  477. /* [ WORD 9 ]
  478. Critical section name. */
  479. tree name;
  480. };
  481. struct GTY(()) gimple_omp_for_iter {
  482. /* Condition code. */
  483. enum tree_code cond;
  484. /* Index variable. */
  485. tree index;
  486. /* Initial value. */
  487. tree initial;
  488. /* Final value. */
  489. tree final;
  490. /* Increment. */
  491. tree incr;
  492. };
  493. /* GIMPLE_OMP_FOR */
  494. struct GTY((tag("GSS_OMP_FOR")))
  495. gomp_for : public gimple_statement_omp
  496. {
  497. /* [ WORD 1-7 ] : base class */
  498. /* [ WORD 8 ] */
  499. tree clauses;
  500. /* [ WORD 9 ]
  501. Number of elements in iter array. */
  502. size_t collapse;
  503. /* [ WORD 10 ] */
  504. struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
  505. /* [ WORD 11 ]
  506. Pre-body evaluated before the loop body begins. */
  507. gimple_seq pre_body;
  508. };
  509. /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */
  510. struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
  511. gimple_statement_omp_parallel_layout : public gimple_statement_omp
  512. {
  513. /* [ WORD 1-7 ] : base class */
  514. /* [ WORD 8 ]
  515. Clauses. */
  516. tree clauses;
  517. /* [ WORD 9 ]
  518. Child function holding the body of the parallel region. */
  519. tree child_fn;
  520. /* [ WORD 10 ]
  521. Shared data argument. */
  522. tree data_arg;
  523. };
  524. /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
  525. struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
  526. gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
  527. {
  528. /* No extra fields; adds invariant:
  529. stmt->code == GIMPLE_OMP_PARALLEL
  530. || stmt->code == GIMPLE_OMP_TASK
  531. || stmt->code == GIMPLE_OMP_TEAMS. */
  532. };
  533. /* GIMPLE_OMP_PARALLEL */
  534. struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
  535. gomp_parallel : public gimple_statement_omp_taskreg
  536. {
  537. /* No extra fields; adds invariant:
  538. stmt->code == GIMPLE_OMP_PARALLEL. */
  539. };
  540. /* GIMPLE_OMP_TARGET */
  541. struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
  542. gomp_target : public gimple_statement_omp_parallel_layout
  543. {
  544. /* No extra fields; adds invariant:
  545. stmt->code == GIMPLE_OMP_TARGET. */
  546. };
  547. /* GIMPLE_OMP_TASK */
  548. struct GTY((tag("GSS_OMP_TASK")))
  549. gomp_task : public gimple_statement_omp_taskreg
  550. {
  551. /* [ WORD 1-10 ] : base class */
  552. /* [ WORD 11 ]
  553. Child function holding firstprivate initialization if needed. */
  554. tree copy_fn;
  555. /* [ WORD 12-13 ]
  556. Size and alignment in bytes of the argument data block. */
  557. tree arg_size;
  558. tree arg_align;
  559. };
  560. /* GIMPLE_OMP_SECTION */
  561. /* Uses struct gimple_statement_omp. */
  562. /* GIMPLE_OMP_SECTIONS */
  563. struct GTY((tag("GSS_OMP_SECTIONS")))
  564. gomp_sections : public gimple_statement_omp
  565. {
  566. /* [ WORD 1-7 ] : base class */
  567. /* [ WORD 8 ] */
  568. tree clauses;
  569. /* [ WORD 9 ]
  570. The control variable used for deciding which of the sections to
  571. execute. */
  572. tree control;
  573. };
  574. /* GIMPLE_OMP_CONTINUE.
  575. Note: This does not inherit from gimple_statement_omp, because we
  576. do not need the body field. */
  577. struct GTY((tag("GSS_OMP_CONTINUE")))
  578. gomp_continue : public gimple
  579. {
  580. /* [ WORD 1-6 ] : base class */
  581. /* [ WORD 7 ] */
  582. tree control_def;
  583. /* [ WORD 8 ] */
  584. tree control_use;
  585. };
  586. /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP,
  587. GIMPLE_OMP_SCAN. */
  588. struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
  589. gimple_statement_omp_single_layout : public gimple_statement_omp
  590. {
  591. /* [ WORD 1-7 ] : base class */
  592. /* [ WORD 8 ] */
  593. tree clauses;
  594. };
  595. struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
  596. gomp_single : public gimple_statement_omp_single_layout
  597. {
  598. /* No extra fields; adds invariant:
  599. stmt->code == GIMPLE_OMP_SINGLE. */
  600. };
  601. struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
  602. gomp_teams : public gimple_statement_omp_taskreg
  603. {
  604. /* No extra fields; adds invariant:
  605. stmt->code == GIMPLE_OMP_TEAMS. */
  606. };
  607. struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
  608. gomp_ordered : public gimple_statement_omp_single_layout
  609. {
  610. /* No extra fields; adds invariant:
  611. stmt->code == GIMPLE_OMP_ORDERED. */
  612. };
  613. struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
  614. gomp_scan : public gimple_statement_omp_single_layout
  615. {
  616. /* No extra fields; adds invariant:
  617. stmt->code == GIMPLE_OMP_SCAN. */
  618. };
  619. /* GIMPLE_OMP_ATOMIC_LOAD.
  620. Note: This is based on gimple, not g_s_omp, because g_s_omp
  621. contains a sequence, which we don't need here. */
  622. struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
  623. gomp_atomic_load : public gimple
  624. {
  625. /* [ WORD 1-6 ] : base class */
  626. /* [ WORD 7-8 ] */
  627. tree rhs, lhs;
  628. };
  629. /* GIMPLE_OMP_ATOMIC_STORE.
  630. See note on GIMPLE_OMP_ATOMIC_LOAD. */
  631. struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
  632. gimple_statement_omp_atomic_store_layout : public gimple
  633. {
  634. /* [ WORD 1-6 ] : base class */
  635. /* [ WORD 7 ] */
  636. tree val;
  637. };
  638. struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
  639. gomp_atomic_store :
  640. public gimple_statement_omp_atomic_store_layout
  641. {
  642. /* No extra fields; adds invariant:
  643. stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
  644. };
  645. struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
  646. gimple_statement_omp_return :
  647. public gimple_statement_omp_atomic_store_layout
  648. {
  649. /* No extra fields; adds invariant:
  650. stmt->code == GIMPLE_OMP_RETURN. */
  651. };
  652. /* GIMPLE_TRANSACTION. */
  653. /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
  654. /* The __transaction_atomic was declared [[outer]] or it is
  655. __transaction_relaxed. */
  656. #define GTMA_IS_OUTER (1u << 0)
  657. #define GTMA_IS_RELAXED (1u << 1)
  658. #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
  659. /* The transaction is seen to not have an abort. */
  660. #define GTMA_HAVE_ABORT (1u << 2)
  661. /* The transaction is seen to have loads or stores. */
  662. #define GTMA_HAVE_LOAD (1u << 3)
  663. #define GTMA_HAVE_STORE (1u << 4)
  664. /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
  665. #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
  666. /* The transaction WILL enter serial irrevocable mode.
  667. An irrevocable block post-dominates the entire transaction, such
  668. that all invocations of the transaction will go serial-irrevocable.
  669. In such case, we don't bother instrumenting the transaction, and
  670. tell the runtime that it should begin the transaction in
  671. serial-irrevocable mode. */
  672. #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
  673. /* The transaction contains no instrumentation code whatsover, most
  674. likely because it is guaranteed to go irrevocable upon entry. */
  675. #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
  676. struct GTY((tag("GSS_TRANSACTION")))
  677. gtransaction : public gimple_statement_with_memory_ops_base
  678. {
  679. /* [ WORD 1-9 ] : base class */
  680. /* [ WORD 10 ] */
  681. gimple_seq body;
  682. /* [ WORD 11-13 ] */
  683. tree label_norm;
  684. tree label_uninst;
  685. tree label_over;
  686. };
  687. #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
  688. enum gimple_statement_structure_enum {
  689. #include "gsstruct.def"
  690. LAST_GSS_ENUM
  691. };
  692. #undef DEFGSSTRUCT
  693. /* A statement with the invariant that
  694. stmt->code == GIMPLE_COND
  695. i.e. a conditional jump statement. */
  696. struct GTY((tag("GSS_WITH_OPS")))
  697. gcond : public gimple_statement_with_ops
  698. {
  699. /* no additional fields; this uses the layout for GSS_WITH_OPS. */
  700. static const enum gimple_code code_ = GIMPLE_COND;
  701. };
  702. /* A statement with the invariant that
  703. stmt->code == GIMPLE_DEBUG
  704. i.e. a debug statement. */
  705. struct GTY((tag("GSS_WITH_OPS")))
  706. gdebug : public gimple_statement_with_ops
  707. {
  708. /* no additional fields; this uses the layout for GSS_WITH_OPS. */
  709. };
  710. /* A statement with the invariant that
  711. stmt->code == GIMPLE_GOTO
  712. i.e. a goto statement. */
  713. struct GTY((tag("GSS_WITH_OPS")))
  714. ggoto : public gimple_statement_with_ops
  715. {
  716. /* no additional fields; this uses the layout for GSS_WITH_OPS. */
  717. };
  718. /* A statement with the invariant that
  719. stmt->code == GIMPLE_LABEL
  720. i.e. a label statement. */
  721. struct GTY((tag("GSS_WITH_OPS")))
  722. glabel : public gimple_statement_with_ops
  723. {
  724. /* no additional fields; this uses the layout for GSS_WITH_OPS. */
  725. };
  726. /* A statement with the invariant that
  727. stmt->code == GIMPLE_SWITCH
  728. i.e. a switch statement. */
  729. struct GTY((tag("GSS_WITH_OPS")))
  730. gswitch : public gimple_statement_with_ops
  731. {
  732. /* no additional fields; this uses the layout for GSS_WITH_OPS. */
  733. };
  734. /* A statement with the invariant that
  735. stmt->code == GIMPLE_ASSIGN
  736. i.e. an assignment statement. */
  737. struct GTY((tag("GSS_WITH_MEM_OPS")))
  738. gassign : public gimple_statement_with_memory_ops
  739. {
  740. static const enum gimple_code code_ = GIMPLE_ASSIGN;
  741. /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
  742. };
  743. /* A statement with the invariant that
  744. stmt->code == GIMPLE_RETURN
  745. i.e. a return statement. */
  746. struct GTY((tag("GSS_WITH_MEM_OPS")))
  747. greturn : public gimple_statement_with_memory_ops
  748. {
  749. /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
  750. };
  751. template <>
  752. template <>
  753. inline bool
  754. is_a_helper <gasm *>::test (gimple *gs)
  755. {
  756. return gs->code == GIMPLE_ASM;
  757. }
  758. template <>
  759. template <>
  760. inline bool
  761. is_a_helper <gassign *>::test (gimple *gs)
  762. {
  763. return gs->code == GIMPLE_ASSIGN;
  764. }
  765. template <>
  766. template <>
  767. inline bool
  768. is_a_helper <const gassign *>::test (const gimple *gs)
  769. {
  770. return gs->code == GIMPLE_ASSIGN;
  771. }
  772. template <>
  773. template <>
  774. inline bool
  775. is_a_helper <gbind *>::test (gimple *gs)
  776. {
  777. return gs->code == GIMPLE_BIND;
  778. }
  779. template <>
  780. template <>
  781. inline bool
  782. is_a_helper <gcall *>::test (gimple *gs)
  783. {
  784. return gs->code == GIMPLE_CALL;
  785. }
  786. template <>
  787. template <>
  788. inline bool
  789. is_a_helper <gcatch *>::test (gimple *gs)
  790. {
  791. return gs->code == GIMPLE_CATCH;
  792. }
  793. template <>
  794. template <>
  795. inline bool
  796. is_a_helper <gcond *>::test (gimple *gs)
  797. {
  798. return gs->code == GIMPLE_COND;
  799. }
  800. template <>
  801. template <>
  802. inline bool
  803. is_a_helper <const gcond *>::test (const gimple *gs)
  804. {
  805. return gs->code == GIMPLE_COND;
  806. }
  807. template <>
  808. template <>
  809. inline bool
  810. is_a_helper <gdebug *>::test (gimple *gs)
  811. {
  812. return gs->code == GIMPLE_DEBUG;
  813. }
  814. template <>
  815. template <>
  816. inline bool
  817. is_a_helper <const gdebug *>::test (const gimple *gs)
  818. {
  819. return gs->code == GIMPLE_DEBUG;
  820. }
  821. template <>
  822. template <>
  823. inline bool
  824. is_a_helper <ggoto *>::test (gimple *gs)
  825. {
  826. return gs->code == GIMPLE_GOTO;
  827. }
  828. template <>
  829. template <>
  830. inline bool
  831. is_a_helper <const ggoto *>::test (const gimple *gs)
  832. {
  833. return gs->code == GIMPLE_GOTO;
  834. }
  835. template <>
  836. template <>
  837. inline bool
  838. is_a_helper <glabel *>::test (gimple *gs)
  839. {
  840. return gs->code == GIMPLE_LABEL;
  841. }
  842. template <>
  843. template <>
  844. inline bool
  845. is_a_helper <const glabel *>::test (const gimple *gs)
  846. {
  847. return gs->code == GIMPLE_LABEL;
  848. }
  849. template <>
  850. template <>
  851. inline bool
  852. is_a_helper <gresx *>::test (gimple *gs)
  853. {
  854. return gs->code == GIMPLE_RESX;
  855. }
  856. template <>
  857. template <>
  858. inline bool
  859. is_a_helper <geh_dispatch *>::test (gimple *gs)
  860. {
  861. return gs->code == GIMPLE_EH_DISPATCH;
  862. }
  863. template <>
  864. template <>
  865. inline bool
  866. is_a_helper <geh_else *>::test (gimple *gs)
  867. {
  868. return gs->code == GIMPLE_EH_ELSE;
  869. }
  870. template <>
  871. template <>
  872. inline bool
  873. is_a_helper <const geh_else *>::test (const gimple *gs)
  874. {
  875. return gs->code == GIMPLE_EH_ELSE;
  876. }
  877. template <>
  878. template <>
  879. inline bool
  880. is_a_helper <geh_filter *>::test (gimple *gs)
  881. {
  882. return gs->code == GIMPLE_EH_FILTER;
  883. }
  884. template <>
  885. template <>
  886. inline bool
  887. is_a_helper <geh_mnt *>::test (gimple *gs)
  888. {
  889. return gs->code == GIMPLE_EH_MUST_NOT_THROW;
  890. }
  891. template <>
  892. template <>
  893. inline bool
  894. is_a_helper <const geh_mnt *>::test (const gimple *gs)
  895. {
  896. return gs->code == GIMPLE_EH_MUST_NOT_THROW;
  897. }
  898. template <>
  899. template <>
  900. inline bool
  901. is_a_helper <gomp_atomic_load *>::test (gimple *gs)
  902. {
  903. return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
  904. }
  905. template <>
  906. template <>
  907. inline bool
  908. is_a_helper <gomp_atomic_store *>::test (gimple *gs)
  909. {
  910. return gs->code == GIMPLE_OMP_ATOMIC_STORE;
  911. }
  912. template <>
  913. template <>
  914. inline bool
  915. is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
  916. {
  917. return gs->code == GIMPLE_OMP_RETURN;
  918. }
  919. template <>
  920. template <>
  921. inline bool
  922. is_a_helper <gomp_continue *>::test (gimple *gs)
  923. {
  924. return gs->code == GIMPLE_OMP_CONTINUE;
  925. }
  926. template <>
  927. template <>
  928. inline bool
  929. is_a_helper <gomp_critical *>::test (gimple *gs)
  930. {
  931. return gs->code == GIMPLE_OMP_CRITICAL;
  932. }
  933. template <>
  934. template <>
  935. inline bool
  936. is_a_helper <gomp_ordered *>::test (gimple *gs)
  937. {
  938. return gs->code == GIMPLE_OMP_ORDERED;
  939. }
  940. template <>
  941. template <>
  942. inline bool
  943. is_a_helper <gomp_scan *>::test (gimple *gs)
  944. {
  945. return gs->code == GIMPLE_OMP_SCAN;
  946. }
  947. template <>
  948. template <>
  949. inline bool
  950. is_a_helper <gomp_for *>::test (gimple *gs)
  951. {
  952. return gs->code == GIMPLE_OMP_FOR;
  953. }
  954. template <>
  955. template <>
  956. inline bool
  957. is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
  958. {
  959. return (gs->code == GIMPLE_OMP_PARALLEL
  960. || gs->code == GIMPLE_OMP_TASK
  961. || gs->code == GIMPLE_OMP_TEAMS);
  962. }
  963. template <>
  964. template <>
  965. inline bool
  966. is_a_helper <gomp_parallel *>::test (gimple *gs)
  967. {
  968. return gs->code == GIMPLE_OMP_PARALLEL;
  969. }
  970. template <>
  971. template <>
  972. inline bool
  973. is_a_helper <gomp_target *>::test (gimple *gs)
  974. {
  975. return gs->code == GIMPLE_OMP_TARGET;
  976. }
  977. template <>
  978. template <>
  979. inline bool
  980. is_a_helper <gomp_sections *>::test (gimple *gs)
  981. {
  982. return gs->code == GIMPLE_OMP_SECTIONS;
  983. }
  984. template <>
  985. template <>
  986. inline bool
  987. is_a_helper <gomp_single *>::test (gimple *gs)
  988. {
  989. return gs->code == GIMPLE_OMP_SINGLE;
  990. }
  991. template <>
  992. template <>
  993. inline bool
  994. is_a_helper <gomp_teams *>::test (gimple *gs)
  995. {
  996. return gs->code == GIMPLE_OMP_TEAMS;
  997. }
  998. template <>
  999. template <>
  1000. inline bool
  1001. is_a_helper <gomp_task *>::test (gimple *gs)
  1002. {
  1003. return gs->code == GIMPLE_OMP_TASK;
  1004. }
  1005. template <>
  1006. template <>
  1007. inline bool
  1008. is_a_helper <gphi *>::test (gimple *gs)
  1009. {
  1010. return gs->code == GIMPLE_PHI;
  1011. }
  1012. template <>
  1013. template <>
  1014. inline bool
  1015. is_a_helper <greturn *>::test (gimple *gs)
  1016. {
  1017. return gs->code == GIMPLE_RETURN;
  1018. }
  1019. template <>
  1020. template <>
  1021. inline bool
  1022. is_a_helper <gswitch *>::test (gimple *gs)
  1023. {
  1024. return gs->code == GIMPLE_SWITCH;
  1025. }
  1026. template <>
  1027. template <>
  1028. inline bool
  1029. is_a_helper <const gswitch *>::test (const gimple *gs)
  1030. {
  1031. return gs->code == GIMPLE_SWITCH;
  1032. }
  1033. template <>
  1034. template <>
  1035. inline bool
  1036. is_a_helper <gtransaction *>::test (gimple *gs)
  1037. {
  1038. return gs->code == GIMPLE_TRANSACTION;
  1039. }
  1040. template <>
  1041. template <>
  1042. inline bool
  1043. is_a_helper <gtry *>::test (gimple *gs)
  1044. {
  1045. return gs->code == GIMPLE_TRY;
  1046. }
  1047. template <>
  1048. template <>
  1049. inline bool
  1050. is_a_helper <const gtry *>::test (const gimple *gs)
  1051. {
  1052. return gs->code == GIMPLE_TRY;
  1053. }
  1054. template <>
  1055. template <>
  1056. inline bool
  1057. is_a_helper <gimple_statement_wce *>::test (gimple *gs)
  1058. {
  1059. return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
  1060. }
  1061. template <>
  1062. template <>
  1063. inline bool
  1064. is_a_helper <const gasm *>::test (const gimple *gs)
  1065. {
  1066. return gs->code == GIMPLE_ASM;
  1067. }
  1068. template <>
  1069. template <>
  1070. inline bool
  1071. is_a_helper <const gbind *>::test (const gimple *gs)
  1072. {
  1073. return gs->code == GIMPLE_BIND;
  1074. }
  1075. template <>
  1076. template <>
  1077. inline bool
  1078. is_a_helper <const gcall *>::test (const gimple *gs)
  1079. {
  1080. return gs->code == GIMPLE_CALL;
  1081. }
  1082. template <>
  1083. template <>
  1084. inline bool
  1085. is_a_helper <const gcatch *>::test (const gimple *gs)
  1086. {
  1087. return gs->code == GIMPLE_CATCH;
  1088. }
  1089. template <>
  1090. template <>
  1091. inline bool
  1092. is_a_helper <const gresx *>::test (const gimple *gs)
  1093. {
  1094. return gs->code == GIMPLE_RESX;
  1095. }
  1096. template <>
  1097. template <>
  1098. inline bool
  1099. is_a_helper <const geh_dispatch *>::test (const gimple *gs)
  1100. {
  1101. return gs->code == GIMPLE_EH_DISPATCH;
  1102. }
  1103. template <>
  1104. template <>
  1105. inline bool
  1106. is_a_helper <const geh_filter *>::test (const gimple *gs)
  1107. {
  1108. return gs->code == GIMPLE_EH_FILTER;
  1109. }
  1110. template <>
  1111. template <>
  1112. inline bool
  1113. is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
  1114. {
  1115. return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
  1116. }
  1117. template <>
  1118. template <>
  1119. inline bool
  1120. is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
  1121. {
  1122. return gs->code == GIMPLE_OMP_ATOMIC_STORE;
  1123. }
  1124. template <>
  1125. template <>
  1126. inline bool
  1127. is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
  1128. {
  1129. return gs->code == GIMPLE_OMP_RETURN;
  1130. }
  1131. template <>
  1132. template <>
  1133. inline bool
  1134. is_a_helper <const gomp_continue *>::test (const gimple *gs)
  1135. {
  1136. return gs->code == GIMPLE_OMP_CONTINUE;
  1137. }
  1138. template <>
  1139. template <>
  1140. inline bool
  1141. is_a_helper <const gomp_critical *>::test (const gimple *gs)
  1142. {
  1143. return gs->code == GIMPLE_OMP_CRITICAL;
  1144. }
  1145. template <>
  1146. template <>
  1147. inline bool
  1148. is_a_helper <const gomp_ordered *>::test (const gimple *gs)
  1149. {
  1150. return gs->code == GIMPLE_OMP_ORDERED;
  1151. }
  1152. template <>
  1153. template <>
  1154. inline bool
  1155. is_a_helper <const gomp_scan *>::test (const gimple *gs)
  1156. {
  1157. return gs->code == GIMPLE_OMP_SCAN;
  1158. }
  1159. template <>
  1160. template <>
  1161. inline bool
  1162. is_a_helper <const gomp_for *>::test (const gimple *gs)
  1163. {
  1164. return gs->code == GIMPLE_OMP_FOR;
  1165. }
  1166. template <>
  1167. template <>
  1168. inline bool
  1169. is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
  1170. {
  1171. return (gs->code == GIMPLE_OMP_PARALLEL
  1172. || gs->code == GIMPLE_OMP_TASK
  1173. || gs->code == GIMPLE_OMP_TEAMS);
  1174. }
  1175. template <>
  1176. template <>
  1177. inline bool
  1178. is_a_helper <const gomp_parallel *>::test (const gimple *gs)
  1179. {
  1180. return gs->code == GIMPLE_OMP_PARALLEL;
  1181. }
  1182. template <>
  1183. template <>
  1184. inline bool
  1185. is_a_helper <const gomp_target *>::test (const gimple *gs)
  1186. {
  1187. return gs->code == GIMPLE_OMP_TARGET;
  1188. }
  1189. template <>
  1190. template <>
  1191. inline bool
  1192. is_a_helper <const gomp_sections *>::test (const gimple *gs)
  1193. {
  1194. return gs->code == GIMPLE_OMP_SECTIONS;
  1195. }
  1196. template <>
  1197. template <>
  1198. inline bool
  1199. is_a_helper <const gomp_single *>::test (const gimple *gs)
  1200. {
  1201. return gs->code == GIMPLE_OMP_SINGLE;
  1202. }
  1203. template <>
  1204. template <>
  1205. inline bool
  1206. is_a_helper <const gomp_teams *>::test (const gimple *gs)
  1207. {
  1208. return gs->code == GIMPLE_OMP_TEAMS;
  1209. }
  1210. template <>
  1211. template <>
  1212. inline bool
  1213. is_a_helper <const gomp_task *>::test (const gimple *gs)
  1214. {
  1215. return gs->code == GIMPLE_OMP_TASK;
  1216. }
  1217. template <>
  1218. template <>
  1219. inline bool
  1220. is_a_helper <const gphi *>::test (const gimple *gs)
  1221. {
  1222. return gs->code == GIMPLE_PHI;
  1223. }
  1224. template <>
  1225. template <>
  1226. inline bool
  1227. is_a_helper <const greturn *>::test (const gimple *gs)
  1228. {
  1229. return gs->code == GIMPLE_RETURN;
  1230. }
  1231. template <>
  1232. template <>
  1233. inline bool
  1234. is_a_helper <const gtransaction *>::test (const gimple *gs)
  1235. {
  1236. return gs->code == GIMPLE_TRANSACTION;
  1237. }
  1238. /* Offset in bytes to the location of the operand vector.
  1239. Zero if there is no operand vector for this tuple structure. */
  1240. extern size_t const gimple_ops_offset_[];
  1241. /* Map GIMPLE codes to GSS codes. */
  1242. extern enum gimple_statement_structure_enum const gss_for_code_[];
  1243. /* This variable holds the currently expanded gimple statement for purposes
  1244. of comminucating the profile info to the builtin expanders. */
  1245. extern gimple *currently_expanding_gimple_stmt;
  1246. size_t gimple_size (enum gimple_code code, unsigned num_ops = 0);
  1247. void gimple_init (gimple *g, enum gimple_code code, unsigned num_ops);
  1248. gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
  1249. greturn *gimple_build_return (tree);
  1250. void gimple_call_reset_alias_info (gcall *);
  1251. gcall *gimple_build_call_vec (tree, vec<tree> );
  1252. gcall *gimple_build_call (tree, unsigned, ...);
  1253. gcall *gimple_build_call_valist (tree, unsigned, va_list);
  1254. gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
  1255. gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
  1256. gcall *gimple_build_call_from_tree (tree, tree);
  1257. gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
  1258. gassign *gimple_build_assign (tree, enum tree_code,
  1259. tree, tree, tree CXX_MEM_STAT_INFO);
  1260. gassign *gimple_build_assign (tree, enum tree_code,
  1261. tree, tree CXX_MEM_STAT_INFO);
  1262. gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
  1263. gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
  1264. gcond *gimple_build_cond_from_tree (tree, tree, tree);
  1265. void gimple_cond_set_condition_from_tree (gcond *, tree);
  1266. glabel *gimple_build_label (tree label);
  1267. ggoto *gimple_build_goto (tree dest);
  1268. gimple *gimple_build_nop (void);
  1269. gbind *gimple_build_bind (tree, gimple_seq, tree);
  1270. gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
  1271. vec<tree, va_gc> *, vec<tree, va_gc> *,
  1272. vec<tree, va_gc> *);
  1273. gcatch *gimple_build_catch (tree, gimple_seq);
  1274. geh_filter *gimple_build_eh_filter (tree, gimple_seq);
  1275. geh_mnt *gimple_build_eh_must_not_throw (tree);
  1276. geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
  1277. gtry *gimple_build_try (gimple_seq, gimple_seq,
  1278. enum gimple_try_flags);
  1279. gimple *gimple_build_wce (gimple_seq);
  1280. gresx *gimple_build_resx (int);
  1281. gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
  1282. gswitch *gimple_build_switch (tree, tree, vec<tree> );
  1283. geh_dispatch *gimple_build_eh_dispatch (int);
  1284. gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
  1285. gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
  1286. gdebug *gimple_build_debug_begin_stmt (tree, location_t CXX_MEM_STAT_INFO);
  1287. gdebug *gimple_build_debug_inline_entry (tree, location_t CXX_MEM_STAT_INFO);
  1288. gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
  1289. gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
  1290. gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
  1291. gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
  1292. tree, tree);
  1293. gimple *gimple_build_omp_section (gimple_seq);
  1294. gimple *gimple_build_omp_master (gimple_seq);
  1295. gimple *gimple_build_omp_grid_body (gimple_seq);
  1296. gimple *gimple_build_omp_taskgroup (gimple_seq, tree);
  1297. gomp_continue *gimple_build_omp_continue (tree, tree);
  1298. gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
  1299. gimple *gimple_build_omp_return (bool);
  1300. gomp_scan *gimple_build_omp_scan (gimple_seq, tree);
  1301. gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
  1302. gimple *gimple_build_omp_sections_switch (void);
  1303. gomp_single *gimple_build_omp_single (gimple_seq, tree);
  1304. gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
  1305. gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
  1306. gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree,
  1307. enum omp_memory_order);
  1308. gomp_atomic_store *gimple_build_omp_atomic_store (tree, enum omp_memory_order);
  1309. gtransaction *gimple_build_transaction (gimple_seq);
  1310. extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
  1311. extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
  1312. void gimple_seq_add_seq (gimple_seq *, gimple_seq);
  1313. void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
  1314. extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
  1315. location_t);
  1316. extern void annotate_all_with_location (gimple_seq, location_t);
  1317. bool empty_body_p (gimple_seq);
  1318. gimple_seq gimple_seq_copy (gimple_seq);
  1319. bool gimple_call_same_target_p (const gimple *, const gimple *);
  1320. int gimple_call_flags (const gimple *);
  1321. int gimple_call_arg_flags (const gcall *, unsigned);
  1322. int gimple_call_return_flags (const gcall *);
  1323. bool gimple_call_nonnull_result_p (gcall *);
  1324. tree gimple_call_nonnull_arg (gcall *);
  1325. bool gimple_assign_copy_p (gimple *);
  1326. bool gimple_assign_ssa_name_copy_p (gimple *);
  1327. bool gimple_assign_unary_nop_p (gimple *);
  1328. void gimple_set_bb (gimple *, basic_block);
  1329. void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
  1330. void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
  1331. tree, tree, tree);
  1332. tree gimple_get_lhs (const gimple *);
  1333. void gimple_set_lhs (gimple *, tree);
  1334. gimple *gimple_copy (gimple *);
  1335. void gimple_move_vops (gimple *, gimple *);
  1336. bool gimple_has_side_effects (const gimple *);
  1337. bool gimple_could_trap_p_1 (gimple *, bool, bool);
  1338. bool gimple_could_trap_p (gimple *);
  1339. bool gimple_assign_rhs_could_trap_p (gimple *);
  1340. extern void dump_gimple_statistics (void);
  1341. unsigned get_gimple_rhs_num_ops (enum tree_code);
  1342. extern tree canonicalize_cond_expr_cond (tree);
  1343. gcall *gimple_call_copy_skip_args (gcall *, bitmap);
  1344. extern bool gimple_compare_field_offset (tree, tree);
  1345. extern tree gimple_unsigned_type (tree);
  1346. extern tree gimple_signed_type (tree);
  1347. extern alias_set_type gimple_get_alias_set (tree);
  1348. extern bool gimple_ior_addresses_taken (bitmap, gimple *);
  1349. extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
  1350. extern combined_fn gimple_call_combined_fn (const gimple *);
  1351. extern bool gimple_call_replaceable_operator_delete_p (const gcall *);
  1352. extern bool gimple_call_builtin_p (const gimple *);
  1353. extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
  1354. extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
  1355. extern bool gimple_asm_clobbers_memory_p (const gasm *);
  1356. extern void dump_decl_set (FILE *, bitmap);
  1357. extern bool nonfreeing_call_p (gimple *);
  1358. extern bool nonbarrier_call_p (gimple *);
  1359. extern bool infer_nonnull_range (gimple *, tree);
  1360. extern bool infer_nonnull_range_by_dereference (gimple *, tree);
  1361. extern bool infer_nonnull_range_by_attribute (gimple *, tree);
  1362. extern void sort_case_labels (vec<tree>);
  1363. extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
  1364. extern void gimple_seq_set_location (gimple_seq, location_t);
  1365. extern void gimple_seq_discard (gimple_seq);
  1366. extern void maybe_remove_unused_call_args (struct function *, gimple *);
  1367. extern bool gimple_inexpensive_call_p (gcall *);
  1368. extern bool stmt_can_terminate_bb_p (gimple *);
  1369. extern location_t gimple_or_expr_nonartificial_location (gimple *, tree);
  1370. /* Formal (expression) temporary table handling: multiple occurrences of
  1371. the same scalar expression are evaluated into the same temporary. */
  1372. typedef struct gimple_temp_hash_elt
  1373. {
  1374. tree val; /* Key */
  1375. tree temp; /* Value */
  1376. } elt_t;
  1377. /* Get the number of the next statement uid to be allocated. */
  1378. static inline unsigned int
  1379. gimple_stmt_max_uid (struct function *fn)
  1380. {
  1381. return fn->last_stmt_uid;
  1382. }
  1383. /* Set the number of the next statement uid to be allocated. */
  1384. static inline void
  1385. set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
  1386. {
  1387. fn->last_stmt_uid = maxid;
  1388. }
  1389. /* Set the number of the next statement uid to be allocated. */
  1390. static inline unsigned int
  1391. inc_gimple_stmt_max_uid (struct function *fn)
  1392. {
  1393. return fn->last_stmt_uid++;
  1394. }
  1395. /* Return the first node in GIMPLE sequence S. */
  1396. static inline gimple_seq_node
  1397. gimple_seq_first (gimple_seq s)
  1398. {
  1399. return s;
  1400. }
  1401. /* Return the first statement in GIMPLE sequence S. */
  1402. static inline gimple *
  1403. gimple_seq_first_stmt (gimple_seq s)
  1404. {
  1405. gimple_seq_node n = gimple_seq_first (s);
  1406. return n;
  1407. }
  1408. /* Return the first statement in GIMPLE sequence S as a gbind *,
  1409. verifying that it has code GIMPLE_BIND in a checked build. */
  1410. static inline gbind *
  1411. gimple_seq_first_stmt_as_a_bind (gimple_seq s)
  1412. {
  1413. gimple_seq_node n = gimple_seq_first (s);
  1414. return as_a <gbind *> (n);
  1415. }
  1416. /* Return the last node in GIMPLE sequence S. */
  1417. static inline gimple_seq_node
  1418. gimple_seq_last (gimple_seq s)
  1419. {
  1420. return s ? s->prev : NULL;
  1421. }
  1422. /* Return the last statement in GIMPLE sequence S. */
  1423. static inline gimple *
  1424. gimple_seq_last_stmt (gimple_seq s)
  1425. {
  1426. gimple_seq_node n = gimple_seq_last (s);
  1427. return n;
  1428. }
  1429. /* Set the last node in GIMPLE sequence *PS to LAST. */
  1430. static inline void
  1431. gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
  1432. {
  1433. (*ps)->prev = last;
  1434. }
  1435. /* Set the first node in GIMPLE sequence *PS to FIRST. */
  1436. static inline void
  1437. gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
  1438. {
  1439. *ps = first;
  1440. }
  1441. /* Return true if GIMPLE sequence S is empty. */
  1442. static inline bool
  1443. gimple_seq_empty_p (gimple_seq s)
  1444. {
  1445. return s == NULL;
  1446. }
  1447. /* Allocate a new sequence and initialize its first element with STMT. */
  1448. static inline gimple_seq
  1449. gimple_seq_alloc_with_stmt (gimple *stmt)
  1450. {
  1451. gimple_seq seq = NULL;
  1452. gimple_seq_add_stmt (&seq, stmt);
  1453. return seq;
  1454. }
  1455. /* Returns the sequence of statements in BB. */
  1456. static inline gimple_seq
  1457. bb_seq (const_basic_block bb)
  1458. {
  1459. return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
  1460. }
  1461. static inline gimple_seq *
  1462. bb_seq_addr (basic_block bb)
  1463. {
  1464. return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
  1465. }
  1466. /* Sets the sequence of statements in BB to SEQ. */
  1467. static inline void
  1468. set_bb_seq (basic_block bb, gimple_seq seq)
  1469. {
  1470. gcc_checking_assert (!(bb->flags & BB_RTL));
  1471. bb->il.gimple.seq = seq;
  1472. }
  1473. /* Return the code for GIMPLE statement G. */
  1474. static inline enum gimple_code
  1475. gimple_code (const gimple *g)
  1476. {
  1477. return g->code;
  1478. }
  1479. /* Return the GSS code used by a GIMPLE code. */
  1480. static inline enum gimple_statement_structure_enum
  1481. gss_for_code (enum gimple_code code)
  1482. {
  1483. gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
  1484. return gss_for_code_[code];
  1485. }
  1486. /* Return which GSS code is used by GS. */
  1487. static inline enum gimple_statement_structure_enum
  1488. gimple_statement_structure (gimple *gs)
  1489. {
  1490. return gss_for_code (gimple_code (gs));
  1491. }
  1492. /* Return true if statement G has sub-statements. This is only true for
  1493. High GIMPLE statements. */
  1494. static inline bool
  1495. gimple_has_substatements (gimple *g)
  1496. {
  1497. switch (gimple_code (g))
  1498. {
  1499. case GIMPLE_BIND:
  1500. case GIMPLE_CATCH:
  1501. case GIMPLE_EH_FILTER:
  1502. case GIMPLE_EH_ELSE:
  1503. case GIMPLE_TRY:
  1504. case GIMPLE_OMP_FOR:
  1505. case GIMPLE_OMP_MASTER:
  1506. case GIMPLE_OMP_TASKGROUP:
  1507. case GIMPLE_OMP_ORDERED:
  1508. case GIMPLE_OMP_SECTION:
  1509. case GIMPLE_OMP_PARALLEL:
  1510. case GIMPLE_OMP_TASK:
  1511. case GIMPLE_OMP_SECTIONS:
  1512. case GIMPLE_OMP_SINGLE:
  1513. case GIMPLE_OMP_TARGET:
  1514. case GIMPLE_OMP_TEAMS:
  1515. case GIMPLE_OMP_CRITICAL:
  1516. case GIMPLE_WITH_CLEANUP_EXPR:
  1517. case GIMPLE_TRANSACTION:
  1518. case GIMPLE_OMP_GRID_BODY:
  1519. return true;
  1520. default:
  1521. return false;
  1522. }
  1523. }
  1524. /* Return the basic block holding statement G. */
  1525. static inline basic_block
  1526. gimple_bb (const gimple *g)
  1527. {
  1528. return g->bb;
  1529. }
  1530. /* Return the lexical scope block holding statement G. */
  1531. static inline tree
  1532. gimple_block (const gimple *g)
  1533. {
  1534. return LOCATION_BLOCK (g->location);
  1535. }
  1536. /* Set BLOCK to be the lexical scope block holding statement G. */
  1537. static inline void
  1538. gimple_set_block (gimple *g, tree block)
  1539. {
  1540. g->location = set_block (g->location, block);
  1541. }
  1542. /* Return location information for statement G. */
  1543. static inline location_t
  1544. gimple_location (const gimple *g)
  1545. {
  1546. return g->location;
  1547. }
  1548. /* Return location information for statement G if g is not NULL.
  1549. Otherwise, UNKNOWN_LOCATION is returned. */
  1550. static inline location_t
  1551. gimple_location_safe (const gimple *g)
  1552. {
  1553. return g ? gimple_location (g) : UNKNOWN_LOCATION;
  1554. }
  1555. /* Set location information for statement G. */
  1556. static inline void
  1557. gimple_set_location (gimple *g, location_t location)
  1558. {
  1559. g->location = location;
  1560. }
  1561. /* Return address of the location information for statement G. */
  1562. static inline location_t *
  1563. gimple_location_ptr (gimple *g)
  1564. {
  1565. return &g->location;
  1566. }
  1567. /* Return true if G contains location information. */
  1568. static inline bool
  1569. gimple_has_location (const gimple *g)
  1570. {
  1571. return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
  1572. }
  1573. /* Return non-artificial location information for statement G. */
  1574. static inline location_t
  1575. gimple_nonartificial_location (const gimple *g)
  1576. {
  1577. location_t *ploc = NULL;
  1578. if (tree block = gimple_block (g))
  1579. ploc = block_nonartificial_location (block);
  1580. return ploc ? *ploc : gimple_location (g);
  1581. }
  1582. /* Return the file name of the location of STMT. */
  1583. static inline const char *
  1584. gimple_filename (const gimple *stmt)
  1585. {
  1586. return LOCATION_FILE (gimple_location (stmt));
  1587. }
  1588. /* Return the line number of the location of STMT. */
  1589. static inline int
  1590. gimple_lineno (const gimple *stmt)
  1591. {
  1592. return LOCATION_LINE (gimple_location (stmt));
  1593. }
  1594. /* Determine whether SEQ is a singleton. */
  1595. static inline bool
  1596. gimple_seq_singleton_p (gimple_seq seq)
  1597. {
  1598. return ((gimple_seq_first (seq) != NULL)
  1599. && (gimple_seq_first (seq) == gimple_seq_last (seq)));
  1600. }
  1601. /* Return true if no warnings should be emitted for statement STMT. */
  1602. static inline bool
  1603. gimple_no_warning_p (const gimple *stmt)
  1604. {
  1605. return stmt->no_warning;
  1606. }
  1607. /* Set the no_warning flag of STMT to NO_WARNING. */
  1608. static inline void
  1609. gimple_set_no_warning (gimple *stmt, bool no_warning)
  1610. {
  1611. stmt->no_warning = (unsigned) no_warning;
  1612. }
  1613. /* Set the visited status on statement STMT to VISITED_P.
  1614. Please note that this 'visited' property of the gimple statement is
  1615. supposed to be undefined at pass boundaries. This means that a
  1616. given pass should not assume it contains any useful value when the
  1617. pass starts and thus can set it to any value it sees fit.
  1618. You can learn more about the visited property of the gimple
  1619. statement by reading the comments of the 'visited' data member of
  1620. struct gimple.
  1621. */
  1622. static inline void
  1623. gimple_set_visited (gimple *stmt, bool visited_p)
  1624. {
  1625. stmt->visited = (unsigned) visited_p;
  1626. }
  1627. /* Return the visited status for statement STMT.
  1628. Please note that this 'visited' property of the gimple statement is
  1629. supposed to be undefined at pass boundaries. This means that a
  1630. given pass should not assume it contains any useful value when the
  1631. pass starts and thus can set it to any value it sees fit.
  1632. You can learn more about the visited property of the gimple
  1633. statement by reading the comments of the 'visited' data member of
  1634. struct gimple. */
  1635. static inline bool
  1636. gimple_visited_p (gimple *stmt)
  1637. {
  1638. return stmt->visited;
  1639. }
  1640. /* Set pass local flag PLF on statement STMT to VAL_P.
  1641. Please note that this PLF property of the gimple statement is
  1642. supposed to be undefined at pass boundaries. This means that a
  1643. given pass should not assume it contains any useful value when the
  1644. pass starts and thus can set it to any value it sees fit.
  1645. You can learn more about the PLF property by reading the comment of
  1646. the 'plf' data member of struct gimple_statement_structure. */
  1647. static inline void
  1648. gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
  1649. {
  1650. if (val_p)
  1651. stmt->plf |= (unsigned int) plf;
  1652. else
  1653. stmt->plf &= ~((unsigned int) plf);
  1654. }
  1655. /* Return the value of pass local flag PLF on statement STMT.
  1656. Please note that this 'plf' property of the gimple statement is
  1657. supposed to be undefined at pass boundaries. This means that a
  1658. given pass should not assume it contains any useful value when the
  1659. pass starts and thus can set it to any value it sees fit.
  1660. You can learn more about the plf property by reading the comment of
  1661. the 'plf' data member of struct gimple_statement_structure. */
  1662. static inline unsigned int
  1663. gimple_plf (gimple *stmt, enum plf_mask plf)
  1664. {
  1665. return stmt->plf & ((unsigned int) plf);
  1666. }
  1667. /* Set the UID of statement.
  1668. Please note that this UID property is supposed to be undefined at
  1669. pass boundaries. This means that a given pass should not assume it
  1670. contains any useful value when the pass starts and thus can set it
  1671. to any value it sees fit. */
  1672. static inline void
  1673. gimple_set_uid (gimple *g, unsigned uid)
  1674. {
  1675. g->uid = uid;
  1676. }
  1677. /* Return the UID of statement.
  1678. Please note that this UID property is supposed to be undefined at
  1679. pass boundaries. This means that a given pass should not assume it
  1680. contains any useful value when the pass starts and thus can set it
  1681. to any value it sees fit. */
  1682. static inline unsigned
  1683. gimple_uid (const gimple *g)
  1684. {
  1685. return g->uid;
  1686. }
  1687. /* Make statement G a singleton sequence. */
  1688. static inline void
  1689. gimple_init_singleton (gimple *g)
  1690. {
  1691. g->next = NULL;
  1692. g->prev = g;
  1693. }
  1694. /* Return true if GIMPLE statement G has register or memory operands. */
  1695. static inline bool
  1696. gimple_has_ops (const gimple *g)
  1697. {
  1698. return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
  1699. }
  1700. template <>
  1701. template <>
  1702. inline bool
  1703. is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
  1704. {
  1705. return gimple_has_ops (gs);
  1706. }
  1707. template <>
  1708. template <>
  1709. inline bool
  1710. is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
  1711. {
  1712. return gimple_has_ops (gs);
  1713. }
  1714. /* Return true if GIMPLE statement G has memory operands. */
  1715. static inline bool
  1716. gimple_has_mem_ops (const gimple *g)
  1717. {
  1718. return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
  1719. }
  1720. template <>
  1721. template <>
  1722. inline bool
  1723. is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
  1724. {
  1725. return gimple_has_mem_ops (gs);
  1726. }
  1727. template <>
  1728. template <>
  1729. inline bool
  1730. is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
  1731. {
  1732. return gimple_has_mem_ops (gs);
  1733. }
  1734. /* Return the set of USE operands for statement G. */
  1735. static inline struct use_optype_d *
  1736. gimple_use_ops (const gimple *g)
  1737. {
  1738. const gimple_statement_with_ops *ops_stmt =
  1739. dyn_cast <const gimple_statement_with_ops *> (g);
  1740. if (!ops_stmt)
  1741. return NULL;
  1742. return ops_stmt->use_ops;
  1743. }
  1744. /* Set USE to be the set of USE operands for statement G. */
  1745. static inline void
  1746. gimple_set_use_ops (gimple *g, struct use_optype_d *use)
  1747. {
  1748. gimple_statement_with_ops *ops_stmt =
  1749. as_a <gimple_statement_with_ops *> (g);
  1750. ops_stmt->use_ops = use;
  1751. }
  1752. /* Return the single VUSE operand of the statement G. */
  1753. static inline tree
  1754. gimple_vuse (const gimple *g)
  1755. {
  1756. const gimple_statement_with_memory_ops *mem_ops_stmt =
  1757. dyn_cast <const gimple_statement_with_memory_ops *> (g);
  1758. if (!mem_ops_stmt)
  1759. return NULL_TREE;
  1760. return mem_ops_stmt->vuse;
  1761. }
  1762. /* Return the single VDEF operand of the statement G. */
  1763. static inline tree
  1764. gimple_vdef (const gimple *g)
  1765. {
  1766. const gimple_statement_with_memory_ops *mem_ops_stmt =
  1767. dyn_cast <const gimple_statement_with_memory_ops *> (g);
  1768. if (!mem_ops_stmt)
  1769. return NULL_TREE;
  1770. return mem_ops_stmt->vdef;
  1771. }
  1772. /* Return the single VUSE operand of the statement G. */
  1773. static inline tree *
  1774. gimple_vuse_ptr (gimple *g)
  1775. {
  1776. gimple_statement_with_memory_ops *mem_ops_stmt =
  1777. dyn_cast <gimple_statement_with_memory_ops *> (g);
  1778. if (!mem_ops_stmt)
  1779. return NULL;
  1780. return &mem_ops_stmt->vuse;
  1781. }
  1782. /* Return the single VDEF operand of the statement G. */
  1783. static inline tree *
  1784. gimple_vdef_ptr (gimple *g)
  1785. {
  1786. gimple_statement_with_memory_ops *mem_ops_stmt =
  1787. dyn_cast <gimple_statement_with_memory_ops *> (g);
  1788. if (!mem_ops_stmt)
  1789. return NULL;
  1790. return &mem_ops_stmt->vdef;
  1791. }
  1792. /* Set the single VUSE operand of the statement G. */
  1793. static inline void
  1794. gimple_set_vuse (gimple *g, tree vuse)
  1795. {
  1796. gimple_statement_with_memory_ops *mem_ops_stmt =
  1797. as_a <gimple_statement_with_memory_ops *> (g);
  1798. mem_ops_stmt->vuse = vuse;
  1799. }
  1800. /* Set the single VDEF operand of the statement G. */
  1801. static inline void
  1802. gimple_set_vdef (gimple *g, tree vdef)
  1803. {
  1804. gimple_statement_with_memory_ops *mem_ops_stmt =
  1805. as_a <gimple_statement_with_memory_ops *> (g);
  1806. mem_ops_stmt->vdef = vdef;
  1807. }
  1808. /* Return true if statement G has operands and the modified field has
  1809. been set. */
  1810. static inline bool
  1811. gimple_modified_p (const gimple *g)
  1812. {
  1813. return (gimple_has_ops (g)) ? (bool) g->modified : false;
  1814. }
  1815. /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
  1816. a MODIFIED field. */
  1817. static inline void
  1818. gimple_set_modified (gimple *s, bool modifiedp)
  1819. {
  1820. if (gimple_has_ops (s))
  1821. s->modified = (unsigned) modifiedp;
  1822. }
  1823. /* Return the tree code for the expression computed by STMT. This is
  1824. only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
  1825. GIMPLE_CALL, return CALL_EXPR as the expression code for
  1826. consistency. This is useful when the caller needs to deal with the
  1827. three kinds of computation that GIMPLE supports. */
  1828. static inline enum tree_code
  1829. gimple_expr_code (const gimple *stmt)
  1830. {
  1831. enum gimple_code code = gimple_code (stmt);
  1832. if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
  1833. return (enum tree_code) stmt->subcode;
  1834. else
  1835. {
  1836. gcc_gimple_checking_assert (code == GIMPLE_CALL);
  1837. return CALL_EXPR;
  1838. }
  1839. }
  1840. /* Return true if statement STMT contains volatile operands. */
  1841. static inline bool
  1842. gimple_has_volatile_ops (const gimple *stmt)
  1843. {
  1844. if (gimple_has_mem_ops (stmt))
  1845. return stmt->has_volatile_ops;
  1846. else
  1847. return false;
  1848. }
  1849. /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
  1850. static inline void
  1851. gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
  1852. {
  1853. if (gimple_has_mem_ops (stmt))
  1854. stmt->has_volatile_ops = (unsigned) volatilep;
  1855. }
  1856. /* Return true if STMT is in a transaction. */
  1857. static inline bool
  1858. gimple_in_transaction (const gimple *stmt)
  1859. {
  1860. return bb_in_transaction (gimple_bb (stmt));
  1861. }
  1862. /* Return true if statement STMT may access memory. */
  1863. static inline bool
  1864. gimple_references_memory_p (gimple *stmt)
  1865. {
  1866. return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
  1867. }
  1868. /* Return the subcode for OMP statement S. */
  1869. static inline unsigned
  1870. gimple_omp_subcode (const gimple *s)
  1871. {
  1872. gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
  1873. && gimple_code (s) <= GIMPLE_OMP_TEAMS);
  1874. return s->subcode;
  1875. }
  1876. /* Set the subcode for OMP statement S to SUBCODE. */
  1877. static inline void
  1878. gimple_omp_set_subcode (gimple *s, unsigned int subcode)
  1879. {
  1880. /* We only have 16 bits for the subcode. Assert that we are not
  1881. overflowing it. */
  1882. gcc_gimple_checking_assert (subcode < (1 << 16));
  1883. s->subcode = subcode;
  1884. }
  1885. /* Set the nowait flag on OMP_RETURN statement S. */
  1886. static inline void
  1887. gimple_omp_return_set_nowait (gimple *s)
  1888. {
  1889. GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
  1890. s->subcode |= GF_OMP_RETURN_NOWAIT;
  1891. }
  1892. /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
  1893. flag set. */
  1894. static inline bool
  1895. gimple_omp_return_nowait_p (const gimple *g)
  1896. {
  1897. GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
  1898. return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
  1899. }
  1900. /* Set the LHS of OMP return. */
  1901. static inline void
  1902. gimple_omp_return_set_lhs (gimple *g, tree lhs)
  1903. {
  1904. gimple_statement_omp_return *omp_return_stmt =
  1905. as_a <gimple_statement_omp_return *> (g);
  1906. omp_return_stmt->val = lhs;
  1907. }
  1908. /* Get the LHS of OMP return. */
  1909. static inline tree
  1910. gimple_omp_return_lhs (const gimple *g)
  1911. {
  1912. const gimple_statement_omp_return *omp_return_stmt =
  1913. as_a <const gimple_statement_omp_return *> (g);
  1914. return omp_return_stmt->val;
  1915. }
  1916. /* Return a pointer to the LHS of OMP return. */
  1917. static inline tree *
  1918. gimple_omp_return_lhs_ptr (gimple *g)
  1919. {
  1920. gimple_statement_omp_return *omp_return_stmt =
  1921. as_a <gimple_statement_omp_return *> (g);
  1922. return &omp_return_stmt->val;
  1923. }
  1924. /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
  1925. flag set. */
  1926. static inline bool
  1927. gimple_omp_section_last_p (const gimple *g)
  1928. {
  1929. GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
  1930. return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
  1931. }
  1932. /* Set the GF_OMP_SECTION_LAST flag on G. */
  1933. static inline void
  1934. gimple_omp_section_set_last (gimple *g)
  1935. {
  1936. GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
  1937. g->subcode |= GF_OMP_SECTION_LAST;
  1938. }
  1939. /* Return true if OMP parallel statement G has the
  1940. GF_OMP_PARALLEL_COMBINED flag set. */
  1941. static inline bool
  1942. gimple_omp_parallel_combined_p (const gimple *g)
  1943. {
  1944. GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
  1945. return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
  1946. }
  1947. /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
  1948. value of COMBINED_P. */
  1949. static inline void
  1950. gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
  1951. {
  1952. GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
  1953. if (combined_p)
  1954. g->subcode |= GF_OMP_PARALLEL_COMBINED;
  1955. else
  1956. g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
  1957. }
  1958. /* Return true if OMP atomic load/store statement G has the
  1959. GF_OMP_ATOMIC_NEED_VALUE flag set. */
  1960. static inline bool
  1961. gimple_omp_atomic_need_value_p (const gimple *g)
  1962. {
  1963. if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
  1964. GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
  1965. return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
  1966. }
  1967. /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
  1968. static inline void
  1969. gimple_omp_atomic_set_need_value (gimple *g)
  1970. {
  1971. if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
  1972. GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
  1973. g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
  1974. }
  1975. /* Return the memory order of the OMP atomic load/store statement G. */
  1976. static inline enum omp_memory_order
  1977. gimple_omp_atomic_memory_order (const gimple *g)
  1978. {
  1979. if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
  1980. GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
  1981. return (enum omp_memory_order)
  1982. (gimple_omp_subcode (g) & GF_OMP_ATOMIC_MEMORY_ORDER);
  1983. }
  1984. /* Set the memory order on G. */
  1985. static inline void
  1986. gimple_omp_atomic_set_memory_order (gimple *g, enum omp_memory_order mo)
  1987. {
  1988. if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
  1989. GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
  1990. g->subcode = ((g->subcode & ~GF_OMP_ATOMIC_MEMORY_ORDER)
  1991. | (mo & GF_OMP_ATOMIC_MEMORY_ORDER));
  1992. }
  1993. /* Return the number of operands for statement GS. */
  1994. static inline unsigned
  1995. gimple_num_ops (const gimple *gs)
  1996. {
  1997. return gs->num_ops;
  1998. }
  1999. /* Set the number of operands for statement GS. */
  2000. static inline void
  2001. gimple_set_num_ops (gimple *gs, unsigned num_ops)
  2002. {
  2003. gs->num_ops = num_ops;
  2004. }
  2005. /* Return the array of operands for statement GS. */
  2006. static inline tree *
  2007. gimple_ops (gimple *gs)
  2008. {
  2009. size_t off;
  2010. /* All the tuples have their operand vector at the very bottom
  2011. of the structure. Note that those structures that do not
  2012. have an operand vector have a zero offset. */
  2013. off = gimple_ops_offset_[gimple_statement_structure (gs)];
  2014. gcc_gimple_checking_assert (off != 0);
  2015. return (tree *) ((char *) gs + off);
  2016. }
  2017. /* Return operand I for statement GS. */
  2018. static inline tree
  2019. gimple_op (const gimple *gs, unsigned i)
  2020. {
  2021. if (gimple_has_ops (gs))
  2022. {
  2023. gcc_gimple_checking_assert (i < gimple_num_ops (gs));
  2024. return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
  2025. }
  2026. else
  2027. return NULL_TREE;
  2028. }
  2029. /* Return a pointer to operand I for statement GS. */
  2030. static inline tree *
  2031. gimple_op_ptr (gimple *gs, unsigned i)
  2032. {
  2033. if (gimple_has_ops (gs))
  2034. {
  2035. gcc_gimple_checking_assert (i < gimple_num_ops (gs));
  2036. return gimple_ops (gs) + i;
  2037. }
  2038. else
  2039. return NULL;
  2040. }
  2041. /* Set operand I of statement GS to OP. */
  2042. static inline void
  2043. gimple_set_op (gimple *gs, unsigned i, tree op)
  2044. {
  2045. gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
  2046. /* Note. It may be tempting to assert that OP matches
  2047. is_gimple_operand, but that would be wrong. Different tuples
  2048. accept slightly different sets of tree operands. Each caller
  2049. should perform its own validation. */
  2050. gimple_ops (gs)[i] = op;
  2051. }
  2052. /* Return true if GS is a GIMPLE_ASSIGN. */
  2053. static inline bool
  2054. is_gimple_assign (const gimple *gs)
  2055. {
  2056. return gimple_code (gs) == GIMPLE_ASSIGN;
  2057. }
  2058. /* Determine if expression CODE is one of the valid expressions that can
  2059. be used on the RHS of GIMPLE assignments. */
  2060. static inline enum gimple_rhs_class
  2061. get_gimple_rhs_class (enum tree_code code)
  2062. {
  2063. return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
  2064. }
  2065. /* Return the LHS of assignment statement GS. */
  2066. static inline tree
  2067. gimple_assign_lhs (const gassign *gs)
  2068. {
  2069. return gs->op[0];
  2070. }
  2071. static inline tree
  2072. gimple_assign_lhs (const gimple *gs)
  2073. {
  2074. const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
  2075. return gimple_assign_lhs (ass);
  2076. }
  2077. /* Return a pointer to the LHS of assignment statement GS. */
  2078. static inline tree *
  2079. gimple_assign_lhs_ptr (gassign *gs)
  2080. {
  2081. return &gs->op[0];
  2082. }
  2083. static inline tree *
  2084. gimple_assign_lhs_ptr (gimple *gs)
  2085. {
  2086. gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
  2087. return gimple_assign_lhs_ptr (ass);
  2088. }
  2089. /* Set LHS to be the LHS operand of assignment statement GS. */
  2090. static inline void
  2091. gimple_assign_set_lhs (gassign *gs, tree lhs)
  2092. {
  2093. gs->op[0] = lhs;
  2094. if (lhs && TREE_CODE (lhs) == SSA_NAME)
  2095. SSA_NAME_DEF_STMT (lhs) = gs;
  2096. }
  2097. static inline void
  2098. gimple_assign_set_lhs (gimple *gs, tree lhs)
  2099. {
  2100. gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
  2101. gimple_assign_set_lhs (ass, lhs);
  2102. }
  2103. /* Return the first operand on the RHS of assignment statement GS. */
  2104. static inline tree
  2105. gimple_assign_rhs1 (const gassign *gs)
  2106. {
  2107. return gs->op[1];
  2108. }
  2109. static inline tree
  2110. gimple_assign_rhs1 (const gimple *gs)
  2111. {
  2112. const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
  2113. return gimple_assign_rhs1 (ass);
  2114. }
  2115. /* Return a pointer to the first operand on the RHS of assignment
  2116. statement GS. */
  2117. static inline tree *
  2118. gimple_assign_rhs1_ptr (gassign *gs)
  2119. {
  2120. return &gs->op[1];
  2121. }
  2122. static inline tree *
  2123. gimple_assign_rhs1_ptr (gimple *gs)
  2124. {
  2125. gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
  2126. return gimple_assign_rhs1_ptr (ass);
  2127. }
  2128. /* Set RHS to be the first operand on the RHS of assignment statement GS. */
  2129. static inline void
  2130. gimple_assign_set_rhs1 (gassign *gs, tree rhs)
  2131. {
  2132. gs->op[1] = rhs;
  2133. }
  2134. static inline void
  2135. gimple_assign_set_rhs1 (gimple *gs, tree rhs)
  2136. {
  2137. gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
  2138. gimple_assign_set_rhs1 (ass, rhs);
  2139. }
  2140. /* Return the second operand on the RHS of assignment statement GS.
  2141. If GS does not have two operands, NULL is returned instead. */
  2142. static inline tree
  2143. gimple_assign_rhs2 (const gassign *gs)
  2144. {
  2145. if (gimple_num_ops (gs) >= 3)
  2146. return gs->op[2];
  2147. else
  2148. return NULL_TREE;
  2149. }
  2150. static inline tree
  2151. gimple_assign_rhs2 (const gimple *gs)
  2152. {
  2153. const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
  2154. return gimple_assign_rhs2 (ass);
  2155. }
  2156. /* Return a pointer to the second operand on the RHS of assignment
  2157. statement GS. */
  2158. static inline tree *
  2159. gimple_assign_rhs2_ptr (gassign *gs)
  2160. {
  2161. gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
  2162. return &gs->op[2];
  2163. }
  2164. static inline tree *
  2165. gimple_assign_rhs2_ptr (gimple *gs)
  2166. {
  2167. gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
  2168. return gimple_assign_rhs2_ptr (ass);
  2169. }
  2170. /* Set RHS to be the second operand on the RHS of assignment statement GS. */
  2171. static inline void
  2172. gimple_assign_set_rhs2 (gassign *gs, tree rhs)
  2173. {
  2174. gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
  2175. gs->op[2] = rhs;
  2176. }
  2177. static inline void
  2178. gimple_assign_set_rhs2 (gimple *gs, tree rhs)
  2179. {
  2180. gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
  2181. return gimple_assign_set_rhs2 (ass, rhs);
  2182. }
  2183. /* Return the third operand on the RHS of assignment statement GS.
  2184. If GS does not have two operands, NULL is returned instead. */
  2185. static inline tree
  2186. gimple_assign_rhs3 (const gassign *gs)
  2187. {
  2188. if (gimple_num_ops (gs) >= 4)
  2189. return gs->op[3];
  2190. else
  2191. return NULL_TREE;
  2192. }
  2193. static inline tree
  2194. gimple_assign_rhs3 (const gimple *gs)
  2195. {
  2196. const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
  2197. return gimple_assign_rhs3 (ass);
  2198. }
  2199. /* Return a pointer to the third operand on the RHS of assignment
  2200. statement GS. */
  2201. static inline tree *
  2202. gimple_assign_rhs3_ptr (gimple *gs)
  2203. {
  2204. gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
  2205. gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
  2206. return &ass->op[3];
  2207. }
  2208. /* Set RHS to be the third operand on the RHS of assignment statement GS. */
  2209. static inline void
  2210. gimple_assign_set_rhs3 (gassign *gs, tree rhs)
  2211. {
  2212. gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
  2213. gs->op[3] = rhs;
  2214. }
  2215. static inline void
  2216. gimple_assign_set_rhs3 (gimple *gs, tree rhs)
  2217. {
  2218. gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
  2219. gimple_assign_set_rhs3 (ass, rhs);
  2220. }
  2221. /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
  2222. which expect to see only two operands. */
  2223. static inline void
  2224. gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
  2225. tree op1, tree op2)
  2226. {
  2227. gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
  2228. }
  2229. /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
  2230. which expect to see only one operands. */
  2231. static inline void
  2232. gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
  2233. tree op1)
  2234. {
  2235. gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
  2236. }
  2237. /* Returns true if GS is a nontemporal move. */
  2238. static inline bool
  2239. gimple_assign_nontemporal_move_p (const gassign *gs)
  2240. {
  2241. return gs->nontemporal_move;
  2242. }
  2243. /* Sets nontemporal move flag of GS to NONTEMPORAL. */
  2244. static inline void
  2245. gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
  2246. {
  2247. GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
  2248. gs->nontemporal_move = nontemporal;
  2249. }
  2250. /* Return the code of the expression computed on the rhs of assignment
  2251. statement GS. In case that the RHS is a single object, returns the
  2252. tree code of the object. */
  2253. static inline enum tree_code
  2254. gimple_assign_rhs_code (const gassign *gs)
  2255. {
  2256. enum tree_code code = (enum tree_code) gs->subcode;
  2257. /* While we initially set subcode to the TREE_CODE of the rhs for
  2258. GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
  2259. in sync when we rewrite stmts into SSA form or do SSA propagations. */
  2260. if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
  2261. code = TREE_CODE (gs->op[1]);
  2262. return code;
  2263. }
  2264. static inline enum tree_code
  2265. gimple_assign_rhs_code (const gimple *gs)
  2266. {
  2267. const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
  2268. return gimple_assign_rhs_code (ass);
  2269. }
  2270. /* Set CODE to be the code for the expression computed on the RHS of
  2271. assignment S. */
  2272. static inline void
  2273. gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
  2274. {
  2275. GIMPLE_CHECK (s, GIMPLE_ASSIGN);
  2276. s->subcode = code;
  2277. }
  2278. /* Return the gimple rhs class of the code of the expression computed on
  2279. the rhs of assignment statement GS.
  2280. This will never return GIMPLE_INVALID_RHS. */
  2281. static inline enum gimple_rhs_class
  2282. gimple_assign_rhs_class (const gimple *gs)
  2283. {
  2284. return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
  2285. }
  2286. /* Return true if GS is an assignment with a singleton RHS, i.e.,
  2287. there is no operator associated with the assignment itself.
  2288. Unlike gimple_assign_copy_p, this predicate returns true for
  2289. any RHS operand, including those that perform an operation
  2290. and do not have the semantics of a copy, such as COND_EXPR. */
  2291. static inline bool
  2292. gimple_assign_single_p (const gimple *gs)
  2293. {
  2294. return (is_gimple_assign (gs)
  2295. && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
  2296. }
  2297. /* Return true if GS performs a store to its lhs. */
  2298. static inline bool
  2299. gimple_store_p (const gimple *gs)
  2300. {
  2301. tree lhs = gimple_get_lhs (gs);
  2302. return lhs && !is_gimple_reg (lhs);
  2303. }
  2304. /* Return true if GS is an assignment that loads from its rhs1. */
  2305. static inline bool
  2306. gimple_assign_load_p (const gimple *gs)
  2307. {
  2308. tree rhs;
  2309. if (!gimple_assign_single_p (gs))
  2310. return false;
  2311. rhs = gimple_assign_rhs1 (gs);
  2312. if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
  2313. return true;
  2314. rhs = get_base_address (rhs);
  2315. return (DECL_P (rhs)
  2316. || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
  2317. }
  2318. /* Return true if S is a type-cast assignment. */
  2319. static inline bool
  2320. gimple_assign_cast_p (const gimple *s)
  2321. {
  2322. if (is_gimple_assign (s))
  2323. {
  2324. enum tree_code sc = gimple_assign_rhs_code (s);
  2325. return CONVERT_EXPR_CODE_P (sc)
  2326. || sc == VIEW_CONVERT_EXPR
  2327. || sc == FIX_TRUNC_EXPR;
  2328. }
  2329. return false;
  2330. }
  2331. /* Return true if S is a clobber statement. */
  2332. static inline bool
  2333. gimple_clobber_p (const gimple *s)
  2334. {
  2335. return gimple_assign_single_p (s)
  2336. && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
  2337. }
  2338. /* Return true if GS is a GIMPLE_CALL. */
  2339. static inline bool
  2340. is_gimple_call (const gimple *gs)
  2341. {
  2342. return gimple_code (gs) == GIMPLE_CALL;
  2343. }
  2344. /* Return the LHS of call statement GS. */
  2345. static inline tree
  2346. gimple_call_lhs (const gcall *gs)
  2347. {
  2348. return gs->op[0];
  2349. }
  2350. static inline tree
  2351. gimple_call_lhs (const gimple *gs)
  2352. {
  2353. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2354. return gimple_call_lhs (gc);
  2355. }
  2356. /* Return a pointer to the LHS of call statement GS. */
  2357. static inline tree *
  2358. gimple_call_lhs_ptr (gcall *gs)
  2359. {
  2360. return &gs->op[0];
  2361. }
  2362. static inline tree *
  2363. gimple_call_lhs_ptr (gimple *gs)
  2364. {
  2365. gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
  2366. return gimple_call_lhs_ptr (gc);
  2367. }
  2368. /* Set LHS to be the LHS operand of call statement GS. */
  2369. static inline void
  2370. gimple_call_set_lhs (gcall *gs, tree lhs)
  2371. {
  2372. gs->op[0] = lhs;
  2373. if (lhs && TREE_CODE (lhs) == SSA_NAME)
  2374. SSA_NAME_DEF_STMT (lhs) = gs;
  2375. }
  2376. static inline void
  2377. gimple_call_set_lhs (gimple *gs, tree lhs)
  2378. {
  2379. gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
  2380. gimple_call_set_lhs (gc, lhs);
  2381. }
  2382. /* Return true if call GS calls an internal-only function, as enumerated
  2383. by internal_fn. */
  2384. static inline bool
  2385. gimple_call_internal_p (const gcall *gs)
  2386. {
  2387. return (gs->subcode & GF_CALL_INTERNAL) != 0;
  2388. }
  2389. static inline bool
  2390. gimple_call_internal_p (const gimple *gs)
  2391. {
  2392. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2393. return gimple_call_internal_p (gc);
  2394. }
  2395. /* Return true if call GS is marked as nocf_check. */
  2396. static inline bool
  2397. gimple_call_nocf_check_p (const gcall *gs)
  2398. {
  2399. return (gs->subcode & GF_CALL_NOCF_CHECK) != 0;
  2400. }
  2401. /* Mark statement GS as nocf_check call. */
  2402. static inline void
  2403. gimple_call_set_nocf_check (gcall *gs, bool nocf_check)
  2404. {
  2405. if (nocf_check)
  2406. gs->subcode |= GF_CALL_NOCF_CHECK;
  2407. else
  2408. gs->subcode &= ~GF_CALL_NOCF_CHECK;
  2409. }
  2410. /* Return the target of internal call GS. */
  2411. static inline enum internal_fn
  2412. gimple_call_internal_fn (const gcall *gs)
  2413. {
  2414. gcc_gimple_checking_assert (gimple_call_internal_p (gs));
  2415. return gs->u.internal_fn;
  2416. }
  2417. static inline enum internal_fn
  2418. gimple_call_internal_fn (const gimple *gs)
  2419. {
  2420. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2421. return gimple_call_internal_fn (gc);
  2422. }
  2423. /* Return true, if this internal gimple call is unique. */
  2424. static inline bool
  2425. gimple_call_internal_unique_p (const gcall *gs)
  2426. {
  2427. return gimple_call_internal_fn (gs) == IFN_UNIQUE;
  2428. }
  2429. static inline bool
  2430. gimple_call_internal_unique_p (const gimple *gs)
  2431. {
  2432. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2433. return gimple_call_internal_unique_p (gc);
  2434. }
  2435. /* Return true if GS is an internal function FN. */
  2436. static inline bool
  2437. gimple_call_internal_p (const gimple *gs, internal_fn fn)
  2438. {
  2439. return (is_gimple_call (gs)
  2440. && gimple_call_internal_p (gs)
  2441. && gimple_call_internal_fn (gs) == fn);
  2442. }
  2443. /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
  2444. that could alter control flow. */
  2445. static inline void
  2446. gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
  2447. {
  2448. if (ctrl_altering_p)
  2449. s->subcode |= GF_CALL_CTRL_ALTERING;
  2450. else
  2451. s->subcode &= ~GF_CALL_CTRL_ALTERING;
  2452. }
  2453. static inline void
  2454. gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
  2455. {
  2456. gcall *gc = GIMPLE_CHECK2<gcall *> (s);
  2457. gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
  2458. }
  2459. /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
  2460. flag is set. Such call could not be a stmt in the middle of a bb. */
  2461. static inline bool
  2462. gimple_call_ctrl_altering_p (const gcall *gs)
  2463. {
  2464. return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
  2465. }
  2466. static inline bool
  2467. gimple_call_ctrl_altering_p (const gimple *gs)
  2468. {
  2469. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2470. return gimple_call_ctrl_altering_p (gc);
  2471. }
  2472. /* Return the function type of the function called by GS. */
  2473. static inline tree
  2474. gimple_call_fntype (const gcall *gs)
  2475. {
  2476. if (gimple_call_internal_p (gs))
  2477. return NULL_TREE;
  2478. return gs->u.fntype;
  2479. }
  2480. static inline tree
  2481. gimple_call_fntype (const gimple *gs)
  2482. {
  2483. const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
  2484. return gimple_call_fntype (call_stmt);
  2485. }
  2486. /* Set the type of the function called by CALL_STMT to FNTYPE. */
  2487. static inline void
  2488. gimple_call_set_fntype (gcall *call_stmt, tree fntype)
  2489. {
  2490. gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
  2491. call_stmt->u.fntype = fntype;
  2492. }
  2493. /* Return the tree node representing the function called by call
  2494. statement GS. */
  2495. static inline tree
  2496. gimple_call_fn (const gcall *gs)
  2497. {
  2498. return gs->op[1];
  2499. }
  2500. static inline tree
  2501. gimple_call_fn (const gimple *gs)
  2502. {
  2503. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2504. return gimple_call_fn (gc);
  2505. }
  2506. /* Return a pointer to the tree node representing the function called by call
  2507. statement GS. */
  2508. static inline tree *
  2509. gimple_call_fn_ptr (gcall *gs)
  2510. {
  2511. return &gs->op[1];
  2512. }
  2513. static inline tree *
  2514. gimple_call_fn_ptr (gimple *gs)
  2515. {
  2516. gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
  2517. return gimple_call_fn_ptr (gc);
  2518. }
  2519. /* Set FN to be the function called by call statement GS. */
  2520. static inline void
  2521. gimple_call_set_fn (gcall *gs, tree fn)
  2522. {
  2523. gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
  2524. gs->op[1] = fn;
  2525. }
  2526. /* Set FNDECL to be the function called by call statement GS. */
  2527. static inline void
  2528. gimple_call_set_fndecl (gcall *gs, tree decl)
  2529. {
  2530. gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
  2531. gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
  2532. build_pointer_type (TREE_TYPE (decl)), decl);
  2533. }
  2534. static inline void
  2535. gimple_call_set_fndecl (gimple *gs, tree decl)
  2536. {
  2537. gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
  2538. gimple_call_set_fndecl (gc, decl);
  2539. }
  2540. /* Set internal function FN to be the function called by call statement CALL_STMT. */
  2541. static inline void
  2542. gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
  2543. {
  2544. gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
  2545. call_stmt->u.internal_fn = fn;
  2546. }
  2547. /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
  2548. Otherwise return NULL. This function is analogous to
  2549. get_callee_fndecl in tree land. */
  2550. static inline tree
  2551. gimple_call_fndecl (const gcall *gs)
  2552. {
  2553. return gimple_call_addr_fndecl (gimple_call_fn (gs));
  2554. }
  2555. static inline tree
  2556. gimple_call_fndecl (const gimple *gs)
  2557. {
  2558. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2559. return gimple_call_fndecl (gc);
  2560. }
  2561. /* Return the type returned by call statement GS. */
  2562. static inline tree
  2563. gimple_call_return_type (const gcall *gs)
  2564. {
  2565. tree type = gimple_call_fntype (gs);
  2566. if (type == NULL_TREE)
  2567. return TREE_TYPE (gimple_call_lhs (gs));
  2568. /* The type returned by a function is the type of its
  2569. function type. */
  2570. return TREE_TYPE (type);
  2571. }
  2572. /* Return the static chain for call statement GS. */
  2573. static inline tree
  2574. gimple_call_chain (const gcall *gs)
  2575. {
  2576. return gs->op[2];
  2577. }
  2578. static inline tree
  2579. gimple_call_chain (const gimple *gs)
  2580. {
  2581. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2582. return gimple_call_chain (gc);
  2583. }
  2584. /* Return a pointer to the static chain for call statement CALL_STMT. */
  2585. static inline tree *
  2586. gimple_call_chain_ptr (gcall *call_stmt)
  2587. {
  2588. return &call_stmt->op[2];
  2589. }
  2590. /* Set CHAIN to be the static chain for call statement CALL_STMT. */
  2591. static inline void
  2592. gimple_call_set_chain (gcall *call_stmt, tree chain)
  2593. {
  2594. call_stmt->op[2] = chain;
  2595. }
  2596. /* Return the number of arguments used by call statement GS. */
  2597. static inline unsigned
  2598. gimple_call_num_args (const gcall *gs)
  2599. {
  2600. return gimple_num_ops (gs) - 3;
  2601. }
  2602. static inline unsigned
  2603. gimple_call_num_args (const gimple *gs)
  2604. {
  2605. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2606. return gimple_call_num_args (gc);
  2607. }
  2608. /* Return the argument at position INDEX for call statement GS. */
  2609. static inline tree
  2610. gimple_call_arg (const gcall *gs, unsigned index)
  2611. {
  2612. gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
  2613. return gs->op[index + 3];
  2614. }
  2615. static inline tree
  2616. gimple_call_arg (const gimple *gs, unsigned index)
  2617. {
  2618. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2619. return gimple_call_arg (gc, index);
  2620. }
  2621. /* Return a pointer to the argument at position INDEX for call
  2622. statement GS. */
  2623. static inline tree *
  2624. gimple_call_arg_ptr (gcall *gs, unsigned index)
  2625. {
  2626. gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
  2627. return &gs->op[index + 3];
  2628. }
  2629. static inline tree *
  2630. gimple_call_arg_ptr (gimple *gs, unsigned index)
  2631. {
  2632. gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
  2633. return gimple_call_arg_ptr (gc, index);
  2634. }
  2635. /* Set ARG to be the argument at position INDEX for call statement GS. */
  2636. static inline void
  2637. gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
  2638. {
  2639. gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
  2640. gs->op[index + 3] = arg;
  2641. }
  2642. static inline void
  2643. gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
  2644. {
  2645. gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
  2646. gimple_call_set_arg (gc, index, arg);
  2647. }
  2648. /* If TAIL_P is true, mark call statement S as being a tail call
  2649. (i.e., a call just before the exit of a function). These calls are
  2650. candidate for tail call optimization. */
  2651. static inline void
  2652. gimple_call_set_tail (gcall *s, bool tail_p)
  2653. {
  2654. if (tail_p)
  2655. s->subcode |= GF_CALL_TAILCALL;
  2656. else
  2657. s->subcode &= ~GF_CALL_TAILCALL;
  2658. }
  2659. /* Return true if GIMPLE_CALL S is marked as a tail call. */
  2660. static inline bool
  2661. gimple_call_tail_p (const gcall *s)
  2662. {
  2663. return (s->subcode & GF_CALL_TAILCALL) != 0;
  2664. }
  2665. /* Mark (or clear) call statement S as requiring tail call optimization. */
  2666. static inline void
  2667. gimple_call_set_must_tail (gcall *s, bool must_tail_p)
  2668. {
  2669. if (must_tail_p)
  2670. s->subcode |= GF_CALL_MUST_TAIL_CALL;
  2671. else
  2672. s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
  2673. }
  2674. /* Return true if call statement has been marked as requiring
  2675. tail call optimization. */
  2676. static inline bool
  2677. gimple_call_must_tail_p (const gcall *s)
  2678. {
  2679. return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
  2680. }
  2681. /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
  2682. slot optimization. This transformation uses the target of the call
  2683. expansion as the return slot for calls that return in memory. */
  2684. static inline void
  2685. gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
  2686. {
  2687. if (return_slot_opt_p)
  2688. s->subcode |= GF_CALL_RETURN_SLOT_OPT;
  2689. else
  2690. s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
  2691. }
  2692. /* Return true if S is marked for return slot optimization. */
  2693. static inline bool
  2694. gimple_call_return_slot_opt_p (const gcall *s)
  2695. {
  2696. return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
  2697. }
  2698. /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
  2699. thunk to the thunked-to function. */
  2700. static inline void
  2701. gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
  2702. {
  2703. if (from_thunk_p)
  2704. s->subcode |= GF_CALL_FROM_THUNK;
  2705. else
  2706. s->subcode &= ~GF_CALL_FROM_THUNK;
  2707. }
  2708. /* Return true if GIMPLE_CALL S is a jump from a thunk. */
  2709. static inline bool
  2710. gimple_call_from_thunk_p (gcall *s)
  2711. {
  2712. return (s->subcode & GF_CALL_FROM_THUNK) != 0;
  2713. }
  2714. /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
  2715. argument pack in its argument list. */
  2716. static inline void
  2717. gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
  2718. {
  2719. if (pass_arg_pack_p)
  2720. s->subcode |= GF_CALL_VA_ARG_PACK;
  2721. else
  2722. s->subcode &= ~GF_CALL_VA_ARG_PACK;
  2723. }
  2724. /* Return true if GIMPLE_CALL S is a stdarg call that needs the
  2725. argument pack in its argument list. */
  2726. static inline bool
  2727. gimple_call_va_arg_pack_p (const gcall *s)
  2728. {
  2729. return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
  2730. }
  2731. /* Return true if S is a noreturn call. */
  2732. static inline bool
  2733. gimple_call_noreturn_p (const gcall *s)
  2734. {
  2735. return (gimple_call_flags (s) & ECF_NORETURN) != 0;
  2736. }
  2737. static inline bool
  2738. gimple_call_noreturn_p (const gimple *s)
  2739. {
  2740. const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
  2741. return gimple_call_noreturn_p (gc);
  2742. }
  2743. /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
  2744. even if the called function can throw in other cases. */
  2745. static inline void
  2746. gimple_call_set_nothrow (gcall *s, bool nothrow_p)
  2747. {
  2748. if (nothrow_p)
  2749. s->subcode |= GF_CALL_NOTHROW;
  2750. else
  2751. s->subcode &= ~GF_CALL_NOTHROW;
  2752. }
  2753. /* Return true if S is a nothrow call. */
  2754. static inline bool
  2755. gimple_call_nothrow_p (gcall *s)
  2756. {
  2757. return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
  2758. }
  2759. /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
  2760. is known to be emitted for VLA objects. Those are wrapped by
  2761. stack_save/stack_restore calls and hence can't lead to unbounded
  2762. stack growth even when they occur in loops. */
  2763. static inline void
  2764. gimple_call_set_alloca_for_var (gcall *s, bool for_var)
  2765. {
  2766. if (for_var)
  2767. s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
  2768. else
  2769. s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
  2770. }
  2771. /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
  2772. static inline bool
  2773. gimple_call_alloca_for_var_p (gcall *s)
  2774. {
  2775. return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
  2776. }
  2777. /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
  2778. pointers to nested function are descriptors instead of trampolines. */
  2779. static inline void
  2780. gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
  2781. {
  2782. if (by_descriptor_p)
  2783. s->subcode |= GF_CALL_BY_DESCRIPTOR;
  2784. else
  2785. s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
  2786. }
  2787. /* Return true if S is a by-descriptor call. */
  2788. static inline bool
  2789. gimple_call_by_descriptor_p (gcall *s)
  2790. {
  2791. return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
  2792. }
  2793. /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
  2794. static inline void
  2795. gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
  2796. {
  2797. dest_call->subcode = orig_call->subcode;
  2798. }
  2799. /* Return a pointer to the points-to solution for the set of call-used
  2800. variables of the call CALL_STMT. */
  2801. static inline struct pt_solution *
  2802. gimple_call_use_set (gcall *call_stmt)
  2803. {
  2804. return &call_stmt->call_used;
  2805. }
  2806. /* As above, but const. */
  2807. static inline const pt_solution *
  2808. gimple_call_use_set (const gcall *call_stmt)
  2809. {
  2810. return &call_stmt->call_used;
  2811. }
  2812. /* Return a pointer to the points-to solution for the set of call-used
  2813. variables of the call CALL_STMT. */
  2814. static inline struct pt_solution *
  2815. gimple_call_clobber_set (gcall *call_stmt)
  2816. {
  2817. return &call_stmt->call_clobbered;
  2818. }
  2819. /* As above, but const. */
  2820. static inline const pt_solution *
  2821. gimple_call_clobber_set (const gcall *call_stmt)
  2822. {
  2823. return &call_stmt->call_clobbered;
  2824. }
  2825. /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
  2826. non-NULL lhs. */
  2827. static inline bool
  2828. gimple_has_lhs (const gimple *stmt)
  2829. {
  2830. if (is_gimple_assign (stmt))
  2831. return true;
  2832. if (const gcall *call = dyn_cast <const gcall *> (stmt))
  2833. return gimple_call_lhs (call) != NULL_TREE;
  2834. return false;
  2835. }
  2836. /* Return the code of the predicate computed by conditional statement GS. */
  2837. static inline enum tree_code
  2838. gimple_cond_code (const gcond *gs)
  2839. {
  2840. return (enum tree_code) gs->subcode;
  2841. }
  2842. static inline enum tree_code
  2843. gimple_cond_code (const gimple *gs)
  2844. {
  2845. const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
  2846. return gimple_cond_code (gc);
  2847. }
  2848. /* Set CODE to be the predicate code for the conditional statement GS. */
  2849. static inline void
  2850. gimple_cond_set_code (gcond *gs, enum tree_code code)
  2851. {
  2852. gs->subcode = code;
  2853. }
  2854. /* Return the LHS of the predicate computed by conditional statement GS. */
  2855. static inline tree
  2856. gimple_cond_lhs (const gcond *gs)
  2857. {
  2858. return gs->op[0];
  2859. }
  2860. static inline tree
  2861. gimple_cond_lhs (const gimple *gs)
  2862. {
  2863. const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
  2864. return gimple_cond_lhs (gc);
  2865. }
  2866. /* Return the pointer to the LHS of the predicate computed by conditional
  2867. statement GS. */
  2868. static inline tree *
  2869. gimple_cond_lhs_ptr (gcond *gs)
  2870. {
  2871. return &gs->op[0];
  2872. }
  2873. /* Set LHS to be the LHS operand of the predicate computed by
  2874. conditional statement GS. */
  2875. static inline void
  2876. gimple_cond_set_lhs (gcond *gs, tree lhs)
  2877. {
  2878. gs->op[0] = lhs;
  2879. }
  2880. /* Return the RHS operand of the predicate computed by conditional GS. */
  2881. static inline tree
  2882. gimple_cond_rhs (const gcond *gs)
  2883. {
  2884. return gs->op[1];
  2885. }
  2886. static inline tree
  2887. gimple_cond_rhs (const gimple *gs)
  2888. {
  2889. const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
  2890. return gimple_cond_rhs (gc);
  2891. }
  2892. /* Return the pointer to the RHS operand of the predicate computed by
  2893. conditional GS. */
  2894. static inline tree *
  2895. gimple_cond_rhs_ptr (gcond *gs)
  2896. {
  2897. return &gs->op[1];
  2898. }
  2899. /* Set RHS to be the RHS operand of the predicate computed by
  2900. conditional statement GS. */
  2901. static inline void
  2902. gimple_cond_set_rhs (gcond *gs, tree rhs)
  2903. {
  2904. gs->op[1] = rhs;
  2905. }
  2906. /* Return the label used by conditional statement GS when its
  2907. predicate evaluates to true. */
  2908. static inline tree
  2909. gimple_cond_true_label (const gcond *gs)
  2910. {
  2911. return gs->op[2];
  2912. }
  2913. /* Set LABEL to be the label used by conditional statement GS when its
  2914. predicate evaluates to true. */
  2915. static inline void
  2916. gimple_cond_set_true_label (gcond *gs, tree label)
  2917. {
  2918. gs->op[2] = label;
  2919. }
  2920. /* Set LABEL to be the label used by conditional statement GS when its
  2921. predicate evaluates to false. */
  2922. static inline void
  2923. gimple_cond_set_false_label (gcond *gs, tree label)
  2924. {
  2925. gs->op[3] = label;
  2926. }
  2927. /* Return the label used by conditional statement GS when its
  2928. predicate evaluates to false. */
  2929. static inline tree
  2930. gimple_cond_false_label (const gcond *gs)
  2931. {
  2932. return gs->op[3];
  2933. }
  2934. /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
  2935. static inline void
  2936. gimple_cond_make_false (gcond *gs)
  2937. {
  2938. gimple_cond_set_lhs (gs, boolean_false_node);
  2939. gimple_cond_set_rhs (gs, boolean_false_node);
  2940. gs->subcode = NE_EXPR;
  2941. }
  2942. /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
  2943. static inline void
  2944. gimple_cond_make_true (gcond *gs)
  2945. {
  2946. gimple_cond_set_lhs (gs, boolean_true_node);
  2947. gimple_cond_set_rhs (gs, boolean_false_node);
  2948. gs->subcode = NE_EXPR;
  2949. }
  2950. /* Check if conditional statemente GS is of the form 'if (1 == 1)',
  2951. 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
  2952. static inline bool
  2953. gimple_cond_true_p (const gcond *gs)
  2954. {
  2955. tree lhs = gimple_cond_lhs (gs);
  2956. tree rhs = gimple_cond_rhs (gs);
  2957. enum tree_code code = gimple_cond_code (gs);
  2958. if (lhs != boolean_true_node && lhs != boolean_false_node)
  2959. return false;
  2960. if (rhs != boolean_true_node && rhs != boolean_false_node)
  2961. return false;
  2962. if (code == NE_EXPR && lhs != rhs)
  2963. return true;
  2964. if (code == EQ_EXPR && lhs == rhs)
  2965. return true;
  2966. return false;
  2967. }
  2968. /* Check if conditional statement GS is of the form 'if (1 != 1)',
  2969. 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
  2970. static inline bool
  2971. gimple_cond_false_p (const gcond *gs)
  2972. {
  2973. tree lhs = gimple_cond_lhs (gs);
  2974. tree rhs = gimple_cond_rhs (gs);
  2975. enum tree_code code = gimple_cond_code (gs);
  2976. if (lhs != boolean_true_node && lhs != boolean_false_node)
  2977. return false;
  2978. if (rhs != boolean_true_node && rhs != boolean_false_node)
  2979. return false;
  2980. if (code == NE_EXPR && lhs == rhs)
  2981. return true;
  2982. if (code == EQ_EXPR && lhs != rhs)
  2983. return true;
  2984. return false;
  2985. }
  2986. /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
  2987. static inline void
  2988. gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
  2989. tree rhs)
  2990. {
  2991. gimple_cond_set_code (stmt, code);
  2992. gimple_cond_set_lhs (stmt, lhs);
  2993. gimple_cond_set_rhs (stmt, rhs);
  2994. }
  2995. /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
  2996. static inline tree
  2997. gimple_label_label (const glabel *gs)
  2998. {
  2999. return gs->op[0];
  3000. }
  3001. /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
  3002. GS. */
  3003. static inline void
  3004. gimple_label_set_label (glabel *gs, tree label)
  3005. {
  3006. gs->op[0] = label;
  3007. }
  3008. /* Return the destination of the unconditional jump GS. */
  3009. static inline tree
  3010. gimple_goto_dest (const gimple *gs)
  3011. {
  3012. GIMPLE_CHECK (gs, GIMPLE_GOTO);
  3013. return gimple_op (gs, 0);
  3014. }
  3015. /* Set DEST to be the destination of the unconditonal jump GS. */
  3016. static inline void
  3017. gimple_goto_set_dest (ggoto *gs, tree dest)
  3018. {
  3019. gs->op[0] = dest;
  3020. }
  3021. /* Return the variables declared in the GIMPLE_BIND statement GS. */
  3022. static inline tree
  3023. gimple_bind_vars (const gbind *bind_stmt)
  3024. {
  3025. return bind_stmt->vars;
  3026. }
  3027. /* Set VARS to be the set of variables declared in the GIMPLE_BIND
  3028. statement GS. */
  3029. static inline void
  3030. gimple_bind_set_vars (gbind *bind_stmt, tree vars)
  3031. {
  3032. bind_stmt->vars = vars;
  3033. }
  3034. /* Append VARS to the set of variables declared in the GIMPLE_BIND
  3035. statement GS. */
  3036. static inline void
  3037. gimple_bind_append_vars (gbind *bind_stmt, tree vars)
  3038. {
  3039. bind_stmt->vars = chainon (bind_stmt->vars, vars);
  3040. }
  3041. static inline gimple_seq *
  3042. gimple_bind_body_ptr (gbind *bind_stmt)
  3043. {
  3044. return &bind_stmt->body;
  3045. }
  3046. /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
  3047. static inline gimple_seq
  3048. gimple_bind_body (const gbind *gs)
  3049. {
  3050. return *gimple_bind_body_ptr (const_cast <gbind *> (gs));
  3051. }
  3052. /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
  3053. statement GS. */
  3054. static inline void
  3055. gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
  3056. {
  3057. bind_stmt->body = seq;
  3058. }
  3059. /* Append a statement to the end of a GIMPLE_BIND's body. */
  3060. static inline void
  3061. gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
  3062. {
  3063. gimple_seq_add_stmt (&bind_stmt->body, stmt);
  3064. }
  3065. /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
  3066. static inline void
  3067. gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
  3068. {
  3069. gimple_seq_add_seq (&bind_stmt->body, seq);
  3070. }
  3071. /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
  3072. GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
  3073. static inline tree
  3074. gimple_bind_block (const gbind *bind_stmt)
  3075. {
  3076. return bind_stmt->block;
  3077. }
  3078. /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
  3079. statement GS. */
  3080. static inline void
  3081. gimple_bind_set_block (gbind *bind_stmt, tree block)
  3082. {
  3083. gcc_gimple_checking_assert (block == NULL_TREE
  3084. || TREE_CODE (block) == BLOCK);
  3085. bind_stmt->block = block;
  3086. }
  3087. /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
  3088. static inline unsigned
  3089. gimple_asm_ninputs (const gasm *asm_stmt)
  3090. {
  3091. return asm_stmt->ni;
  3092. }
  3093. /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
  3094. static inline unsigned
  3095. gimple_asm_noutputs (const gasm *asm_stmt)
  3096. {
  3097. return asm_stmt->no;
  3098. }
  3099. /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
  3100. static inline unsigned
  3101. gimple_asm_nclobbers (const gasm *asm_stmt)
  3102. {
  3103. return asm_stmt->nc;
  3104. }
  3105. /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
  3106. static inline unsigned
  3107. gimple_asm_nlabels (const gasm *asm_stmt)
  3108. {
  3109. return asm_stmt->nl;
  3110. }
  3111. /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
  3112. static inline tree
  3113. gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
  3114. {
  3115. gcc_gimple_checking_assert (index < asm_stmt->ni);
  3116. return asm_stmt->op[index + asm_stmt->no];
  3117. }
  3118. /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
  3119. static inline void
  3120. gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
  3121. {
  3122. gcc_gimple_checking_assert (index < asm_stmt->ni
  3123. && TREE_CODE (in_op) == TREE_LIST);
  3124. asm_stmt->op[index + asm_stmt->no] = in_op;
  3125. }
  3126. /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
  3127. static inline tree
  3128. gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
  3129. {
  3130. gcc_gimple_checking_assert (index < asm_stmt->no);
  3131. return asm_stmt->op[index];
  3132. }
  3133. /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
  3134. static inline void
  3135. gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
  3136. {
  3137. gcc_gimple_checking_assert (index < asm_stmt->no
  3138. && TREE_CODE (out_op) == TREE_LIST);
  3139. asm_stmt->op[index] = out_op;
  3140. }
  3141. /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
  3142. static inline tree
  3143. gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
  3144. {
  3145. gcc_gimple_checking_assert (index < asm_stmt->nc);
  3146. return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
  3147. }
  3148. /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
  3149. static inline void
  3150. gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
  3151. {
  3152. gcc_gimple_checking_assert (index < asm_stmt->nc
  3153. && TREE_CODE (clobber_op) == TREE_LIST);
  3154. asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
  3155. }
  3156. /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
  3157. static inline tree
  3158. gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
  3159. {
  3160. gcc_gimple_checking_assert (index < asm_stmt->nl);
  3161. return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
  3162. }
  3163. /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
  3164. static inline void
  3165. gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
  3166. {
  3167. gcc_gimple_checking_assert (index < asm_stmt->nl
  3168. && TREE_CODE (label_op) == TREE_LIST);
  3169. asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
  3170. }
  3171. /* Return the string representing the assembly instruction in
  3172. GIMPLE_ASM ASM_STMT. */
  3173. static inline const char *
  3174. gimple_asm_string (const gasm *asm_stmt)
  3175. {
  3176. return asm_stmt->string;
  3177. }
  3178. /* Return true if ASM_STMT is marked volatile. */
  3179. static inline bool
  3180. gimple_asm_volatile_p (const gasm *asm_stmt)
  3181. {
  3182. return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
  3183. }
  3184. /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
  3185. static inline void
  3186. gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
  3187. {
  3188. if (volatile_p)
  3189. asm_stmt->subcode |= GF_ASM_VOLATILE;
  3190. else
  3191. asm_stmt->subcode &= ~GF_ASM_VOLATILE;
  3192. }
  3193. /* Return true if ASM_STMT is marked inline. */
  3194. static inline bool
  3195. gimple_asm_inline_p (const gasm *asm_stmt)
  3196. {
  3197. return (asm_stmt->subcode & GF_ASM_INLINE) != 0;
  3198. }
  3199. /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
  3200. static inline void
  3201. gimple_asm_set_inline (gasm *asm_stmt, bool inline_p)
  3202. {
  3203. if (inline_p)
  3204. asm_stmt->subcode |= GF_ASM_INLINE;
  3205. else
  3206. asm_stmt->subcode &= ~GF_ASM_INLINE;
  3207. }
  3208. /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
  3209. static inline void
  3210. gimple_asm_set_input (gasm *asm_stmt, bool input_p)
  3211. {
  3212. if (input_p)
  3213. asm_stmt->subcode |= GF_ASM_INPUT;
  3214. else
  3215. asm_stmt->subcode &= ~GF_ASM_INPUT;
  3216. }
  3217. /* Return true if asm ASM_STMT is an ASM_INPUT. */
  3218. static inline bool
  3219. gimple_asm_input_p (const gasm *asm_stmt)
  3220. {
  3221. return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
  3222. }
  3223. /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
  3224. static inline tree
  3225. gimple_catch_types (const gcatch *catch_stmt)
  3226. {
  3227. return catch_stmt->types;
  3228. }
  3229. /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
  3230. static inline tree *
  3231. gimple_catch_types_ptr (gcatch *catch_stmt)
  3232. {
  3233. return &catch_stmt->types;
  3234. }
  3235. /* Return a pointer to the GIMPLE sequence representing the body of
  3236. the handler of GIMPLE_CATCH statement CATCH_STMT. */
  3237. static inline gimple_seq *
  3238. gimple_catch_handler_ptr (gcatch *catch_stmt)
  3239. {
  3240. return &catch_stmt->handler;
  3241. }
  3242. /* Return the GIMPLE sequence representing the body of the handler of
  3243. GIMPLE_CATCH statement CATCH_STMT. */
  3244. static inline gimple_seq
  3245. gimple_catch_handler (const gcatch *catch_stmt)
  3246. {
  3247. return *gimple_catch_handler_ptr (const_cast <gcatch *> (catch_stmt));
  3248. }
  3249. /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
  3250. static inline void
  3251. gimple_catch_set_types (gcatch *catch_stmt, tree t)
  3252. {
  3253. catch_stmt->types = t;
  3254. }
  3255. /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
  3256. static inline void
  3257. gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
  3258. {
  3259. catch_stmt->handler = handler;
  3260. }
  3261. /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
  3262. static inline tree
  3263. gimple_eh_filter_types (const gimple *gs)
  3264. {
  3265. const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
  3266. return eh_filter_stmt->types;
  3267. }
  3268. /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
  3269. GS. */
  3270. static inline tree *
  3271. gimple_eh_filter_types_ptr (gimple *gs)
  3272. {
  3273. geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
  3274. return &eh_filter_stmt->types;
  3275. }
  3276. /* Return a pointer to the sequence of statement to execute when
  3277. GIMPLE_EH_FILTER statement fails. */
  3278. static inline gimple_seq *
  3279. gimple_eh_filter_failure_ptr (gimple *gs)
  3280. {
  3281. geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
  3282. return &eh_filter_stmt->failure;
  3283. }
  3284. /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
  3285. statement fails. */
  3286. static inline gimple_seq
  3287. gimple_eh_filter_failure (const gimple *gs)
  3288. {
  3289. return *gimple_eh_filter_failure_ptr (const_cast <gimple *> (gs));
  3290. }
  3291. /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
  3292. EH_FILTER_STMT. */
  3293. static inline void
  3294. gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
  3295. {
  3296. eh_filter_stmt->types = types;
  3297. }
  3298. /* Set FAILURE to be the sequence of statements to execute on failure
  3299. for GIMPLE_EH_FILTER EH_FILTER_STMT. */
  3300. static inline void
  3301. gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
  3302. gimple_seq failure)
  3303. {
  3304. eh_filter_stmt->failure = failure;
  3305. }
  3306. /* Get the function decl to be called by the MUST_NOT_THROW region. */
  3307. static inline tree
  3308. gimple_eh_must_not_throw_fndecl (const geh_mnt *eh_mnt_stmt)
  3309. {
  3310. return eh_mnt_stmt->fndecl;
  3311. }
  3312. /* Set the function decl to be called by GS to DECL. */
  3313. static inline void
  3314. gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
  3315. tree decl)
  3316. {
  3317. eh_mnt_stmt->fndecl = decl;
  3318. }
  3319. /* GIMPLE_EH_ELSE accessors. */
  3320. static inline gimple_seq *
  3321. gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
  3322. {
  3323. return &eh_else_stmt->n_body;
  3324. }
  3325. static inline gimple_seq
  3326. gimple_eh_else_n_body (const geh_else *eh_else_stmt)
  3327. {
  3328. return *gimple_eh_else_n_body_ptr (const_cast <geh_else *> (eh_else_stmt));
  3329. }
  3330. static inline gimple_seq *
  3331. gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
  3332. {
  3333. return &eh_else_stmt->e_body;
  3334. }
  3335. static inline gimple_seq
  3336. gimple_eh_else_e_body (const geh_else *eh_else_stmt)
  3337. {
  3338. return *gimple_eh_else_e_body_ptr (const_cast <geh_else *> (eh_else_stmt));
  3339. }
  3340. static inline void
  3341. gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
  3342. {
  3343. eh_else_stmt->n_body = seq;
  3344. }
  3345. static inline void
  3346. gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
  3347. {
  3348. eh_else_stmt->e_body = seq;
  3349. }
  3350. /* GIMPLE_TRY accessors. */
  3351. /* Return the kind of try block represented by GIMPLE_TRY GS. This is
  3352. either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
  3353. static inline enum gimple_try_flags
  3354. gimple_try_kind (const gimple *gs)
  3355. {
  3356. GIMPLE_CHECK (gs, GIMPLE_TRY);
  3357. return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
  3358. }
  3359. /* Set the kind of try block represented by GIMPLE_TRY GS. */
  3360. static inline void
  3361. gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
  3362. {
  3363. gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
  3364. || kind == GIMPLE_TRY_FINALLY);
  3365. if (gimple_try_kind (gs) != kind)
  3366. gs->subcode = (unsigned int) kind;
  3367. }
  3368. /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
  3369. static inline bool
  3370. gimple_try_catch_is_cleanup (const gimple *gs)
  3371. {
  3372. gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
  3373. return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
  3374. }
  3375. /* Return a pointer to the sequence of statements used as the
  3376. body for GIMPLE_TRY GS. */
  3377. static inline gimple_seq *
  3378. gimple_try_eval_ptr (gimple *gs)
  3379. {
  3380. gtry *try_stmt = as_a <gtry *> (gs);
  3381. return &try_stmt->eval;
  3382. }
  3383. /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
  3384. static inline gimple_seq
  3385. gimple_try_eval (const gimple *gs)
  3386. {
  3387. return *gimple_try_eval_ptr (const_cast <gimple *> (gs));
  3388. }
  3389. /* Return a pointer to the sequence of statements used as the cleanup body for
  3390. GIMPLE_TRY GS. */
  3391. static inline gimple_seq *
  3392. gimple_try_cleanup_ptr (gimple *gs)
  3393. {
  3394. gtry *try_stmt = as_a <gtry *> (gs);
  3395. return &try_stmt->cleanup;
  3396. }
  3397. /* Return the sequence of statements used as the cleanup body for
  3398. GIMPLE_TRY GS. */
  3399. static inline gimple_seq
  3400. gimple_try_cleanup (const gimple *gs)
  3401. {
  3402. return *gimple_try_cleanup_ptr (const_cast <gimple *> (gs));
  3403. }
  3404. /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
  3405. static inline void
  3406. gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
  3407. {
  3408. gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
  3409. if (catch_is_cleanup)
  3410. g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
  3411. else
  3412. g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
  3413. }
  3414. /* Set EVAL to be the sequence of statements to use as the body for
  3415. GIMPLE_TRY TRY_STMT. */
  3416. static inline void
  3417. gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
  3418. {
  3419. try_stmt->eval = eval;
  3420. }
  3421. /* Set CLEANUP to be the sequence of statements to use as the cleanup
  3422. body for GIMPLE_TRY TRY_STMT. */
  3423. static inline void
  3424. gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
  3425. {
  3426. try_stmt->cleanup = cleanup;
  3427. }
  3428. /* Return a pointer to the cleanup sequence for cleanup statement GS. */
  3429. static inline gimple_seq *
  3430. gimple_wce_cleanup_ptr (gimple *gs)
  3431. {
  3432. gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
  3433. return &wce_stmt->cleanup;
  3434. }
  3435. /* Return the cleanup sequence for cleanup statement GS. */
  3436. static inline gimple_seq
  3437. gimple_wce_cleanup (gimple *gs)
  3438. {
  3439. return *gimple_wce_cleanup_ptr (gs);
  3440. }
  3441. /* Set CLEANUP to be the cleanup sequence for GS. */
  3442. static inline void
  3443. gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
  3444. {
  3445. gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
  3446. wce_stmt->cleanup = cleanup;
  3447. }
  3448. /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
  3449. static inline bool
  3450. gimple_wce_cleanup_eh_only (const gimple *gs)
  3451. {
  3452. GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
  3453. return gs->subcode != 0;
  3454. }
  3455. /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
  3456. static inline void
  3457. gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
  3458. {
  3459. GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
  3460. gs->subcode = (unsigned int) eh_only_p;
  3461. }
  3462. /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
  3463. static inline unsigned
  3464. gimple_phi_capacity (const gimple *gs)
  3465. {
  3466. const gphi *phi_stmt = as_a <const gphi *> (gs);
  3467. return phi_stmt->capacity;
  3468. }
  3469. /* Return the number of arguments in GIMPLE_PHI GS. This must always
  3470. be exactly the number of incoming edges for the basic block holding
  3471. GS. */
  3472. static inline unsigned
  3473. gimple_phi_num_args (const gimple *gs)
  3474. {
  3475. const gphi *phi_stmt = as_a <const gphi *> (gs);
  3476. return phi_stmt->nargs;
  3477. }
  3478. /* Return the SSA name created by GIMPLE_PHI GS. */
  3479. static inline tree
  3480. gimple_phi_result (const gphi *gs)
  3481. {
  3482. return gs->result;
  3483. }
  3484. static inline tree
  3485. gimple_phi_result (const gimple *gs)
  3486. {
  3487. const gphi *phi_stmt = as_a <const gphi *> (gs);
  3488. return gimple_phi_result (phi_stmt);
  3489. }
  3490. /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
  3491. static inline tree *
  3492. gimple_phi_result_ptr (gphi *gs)
  3493. {
  3494. return &gs->result;
  3495. }
  3496. static inline tree *
  3497. gimple_phi_result_ptr (gimple *gs)
  3498. {
  3499. gphi *phi_stmt = as_a <gphi *> (gs);
  3500. return gimple_phi_result_ptr (phi_stmt);
  3501. }
  3502. /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
  3503. static inline void
  3504. gimple_phi_set_result (gphi *phi, tree result)
  3505. {
  3506. phi->result = result;
  3507. if (result && TREE_CODE (result) == SSA_NAME)
  3508. SSA_NAME_DEF_STMT (result) = phi;
  3509. }
  3510. /* Return the PHI argument corresponding to incoming edge INDEX for
  3511. GIMPLE_PHI GS. */
  3512. static inline struct phi_arg_d *
  3513. gimple_phi_arg (gphi *gs, unsigned index)
  3514. {
  3515. gcc_gimple_checking_assert (index < gs->nargs);
  3516. return &(gs->args[index]);
  3517. }
  3518. static inline const phi_arg_d *
  3519. gimple_phi_arg (const gphi *gs, unsigned index)
  3520. {
  3521. gcc_gimple_checking_assert (index < gs->nargs);
  3522. return &(gs->args[index]);
  3523. }
  3524. static inline struct phi_arg_d *
  3525. gimple_phi_arg (gimple *gs, unsigned index)
  3526. {
  3527. gphi *phi_stmt = as_a <gphi *> (gs);
  3528. return gimple_phi_arg (phi_stmt, index);
  3529. }
  3530. /* Set PHIARG to be the argument corresponding to incoming edge INDEX
  3531. for GIMPLE_PHI PHI. */
  3532. static inline void
  3533. gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
  3534. {
  3535. gcc_gimple_checking_assert (index < phi->nargs);
  3536. phi->args[index] = *phiarg;
  3537. }
  3538. /* Return the PHI nodes for basic block BB, or NULL if there are no
  3539. PHI nodes. */
  3540. static inline gimple_seq
  3541. phi_nodes (const_basic_block bb)
  3542. {
  3543. gcc_checking_assert (!(bb->flags & BB_RTL));
  3544. return bb->il.gimple.phi_nodes;
  3545. }
  3546. /* Return a pointer to the PHI nodes for basic block BB. */
  3547. static inline gimple_seq *
  3548. phi_nodes_ptr (basic_block bb)
  3549. {
  3550. gcc_checking_assert (!(bb->flags & BB_RTL));
  3551. return &bb->il.gimple.phi_nodes;
  3552. }
  3553. /* Return the tree operand for argument I of PHI node GS. */
  3554. static inline tree
  3555. gimple_phi_arg_def (const gphi *gs, size_t index)
  3556. {
  3557. return gimple_phi_arg (gs, index)->def;
  3558. }
  3559. static inline tree
  3560. gimple_phi_arg_def (gimple *gs, size_t index)
  3561. {
  3562. return gimple_phi_arg (gs, index)->def;
  3563. }
  3564. /* Return a pointer to the tree operand for argument I of phi node PHI. */
  3565. static inline tree *
  3566. gimple_phi_arg_def_ptr (gphi *phi, size_t index)
  3567. {
  3568. return &gimple_phi_arg (phi, index)->def;
  3569. }
  3570. /* Return the edge associated with argument I of phi node PHI. */
  3571. static inline edge
  3572. gimple_phi_arg_edge (const gphi *phi, size_t i)
  3573. {
  3574. return EDGE_PRED (gimple_bb (phi), i);
  3575. }
  3576. /* Return the source location of gimple argument I of phi node PHI. */
  3577. static inline location_t
  3578. gimple_phi_arg_location (const gphi *phi, size_t i)
  3579. {
  3580. return gimple_phi_arg (phi, i)->locus;
  3581. }
  3582. /* Return the source location of the argument on edge E of phi node PHI. */
  3583. static inline location_t
  3584. gimple_phi_arg_location_from_edge (gphi *phi, edge e)
  3585. {
  3586. return gimple_phi_arg (phi, e->dest_idx)->locus;
  3587. }
  3588. /* Set the source location of gimple argument I of phi node PHI to LOC. */
  3589. static inline void
  3590. gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc)
  3591. {
  3592. gimple_phi_arg (phi, i)->locus = loc;
  3593. }
  3594. /* Return address of source location of gimple argument I of phi node PHI. */
  3595. static inline location_t *
  3596. gimple_phi_arg_location_ptr (gphi *phi, size_t i)
  3597. {
  3598. return &gimple_phi_arg (phi, i)->locus;
  3599. }
  3600. /* Return TRUE if argument I of phi node PHI has a location record. */
  3601. static inline bool
  3602. gimple_phi_arg_has_location (const gphi *phi, size_t i)
  3603. {
  3604. return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
  3605. }
  3606. /* Return the region number for GIMPLE_RESX RESX_STMT. */
  3607. static inline int
  3608. gimple_resx_region (const gresx *resx_stmt)
  3609. {
  3610. return resx_stmt->region;
  3611. }
  3612. /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
  3613. static inline void
  3614. gimple_resx_set_region (gresx *resx_stmt, int region)
  3615. {
  3616. resx_stmt->region = region;
  3617. }
  3618. /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
  3619. static inline int
  3620. gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
  3621. {
  3622. return eh_dispatch_stmt->region;
  3623. }
  3624. /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
  3625. EH_DISPATCH_STMT. */
  3626. static inline void
  3627. gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
  3628. {
  3629. eh_dispatch_stmt->region = region;
  3630. }
  3631. /* Return the number of labels associated with the switch statement GS. */
  3632. static inline unsigned
  3633. gimple_switch_num_labels (const gswitch *gs)
  3634. {
  3635. unsigned num_ops;
  3636. GIMPLE_CHECK (gs, GIMPLE_SWITCH);
  3637. num_ops = gimple_num_ops (gs);
  3638. gcc_gimple_checking_assert (num_ops > 1);
  3639. return num_ops - 1;
  3640. }
  3641. /* Set NLABELS to be the number of labels for the switch statement GS. */
  3642. static inline void
  3643. gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
  3644. {
  3645. GIMPLE_CHECK (g, GIMPLE_SWITCH);
  3646. gimple_set_num_ops (g, nlabels + 1);
  3647. }
  3648. /* Return the index variable used by the switch statement GS. */
  3649. static inline tree
  3650. gimple_switch_index (const gswitch *gs)
  3651. {
  3652. return gs->op[0];
  3653. }
  3654. /* Return a pointer to the index variable for the switch statement GS. */
  3655. static inline tree *
  3656. gimple_switch_index_ptr (gswitch *gs)
  3657. {
  3658. return &gs->op[0];
  3659. }
  3660. /* Set INDEX to be the index variable for switch statement GS. */
  3661. static inline void
  3662. gimple_switch_set_index (gswitch *gs, tree index)
  3663. {
  3664. gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
  3665. gs->op[0] = index;
  3666. }
  3667. /* Return the label numbered INDEX. The default label is 0, followed by any
  3668. labels in a switch statement. */
  3669. static inline tree
  3670. gimple_switch_label (const gswitch *gs, unsigned index)
  3671. {
  3672. gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
  3673. return gs->op[index + 1];
  3674. }
  3675. /* Set the label number INDEX to LABEL. 0 is always the default label. */
  3676. static inline void
  3677. gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
  3678. {
  3679. gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
  3680. && (label == NULL_TREE
  3681. || TREE_CODE (label) == CASE_LABEL_EXPR));
  3682. gs->op[index + 1] = label;
  3683. }
  3684. /* Return the default label for a switch statement. */
  3685. static inline tree
  3686. gimple_switch_default_label (const gswitch *gs)
  3687. {
  3688. tree label = gimple_switch_label (gs, 0);
  3689. gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
  3690. return label;
  3691. }
  3692. /* Set the default label for a switch statement. */
  3693. static inline void
  3694. gimple_switch_set_default_label (gswitch *gs, tree label)
  3695. {
  3696. gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
  3697. gimple_switch_set_label (gs, 0, label);
  3698. }
  3699. /* Return true if GS is a GIMPLE_DEBUG statement. */
  3700. static inline bool
  3701. is_gimple_debug (const gimple *gs)
  3702. {
  3703. return gimple_code (gs) == GIMPLE_DEBUG;
  3704. }
  3705. /* Return the first nondebug statement in GIMPLE sequence S. */
  3706. static inline gimple *
  3707. gimple_seq_first_nondebug_stmt (gimple_seq s)
  3708. {
  3709. gimple_seq_node n = gimple_seq_first (s);
  3710. while (n && is_gimple_debug (n))
  3711. n = n->next;
  3712. return n;
  3713. }
  3714. /* Return the last nondebug statement in GIMPLE sequence S. */
  3715. static inline gimple *
  3716. gimple_seq_last_nondebug_stmt (gimple_seq s)
  3717. {
  3718. gimple_seq_node n;
  3719. for (n = gimple_seq_last (s);
  3720. n && is_gimple_debug (n);
  3721. n = n->prev)
  3722. if (n == s)
  3723. return NULL;
  3724. return n;
  3725. }
  3726. /* Return true if S is a GIMPLE_DEBUG BIND statement. */
  3727. static inline bool
  3728. gimple_debug_bind_p (const gimple *s)
  3729. {
  3730. if (is_gimple_debug (s))
  3731. return s->subcode == GIMPLE_DEBUG_BIND;
  3732. return false;
  3733. }
  3734. /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
  3735. static inline tree
  3736. gimple_debug_bind_get_var (const gimple *dbg)
  3737. {
  3738. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3739. gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
  3740. return gimple_op (dbg, 0);
  3741. }
  3742. /* Return the value bound to the variable in a GIMPLE_DEBUG bind
  3743. statement. */
  3744. static inline tree
  3745. gimple_debug_bind_get_value (const gimple *dbg)
  3746. {
  3747. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3748. gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
  3749. return gimple_op (dbg, 1);
  3750. }
  3751. /* Return a pointer to the value bound to the variable in a
  3752. GIMPLE_DEBUG bind statement. */
  3753. static inline tree *
  3754. gimple_debug_bind_get_value_ptr (gimple *dbg)
  3755. {
  3756. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3757. gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
  3758. return gimple_op_ptr (dbg, 1);
  3759. }
  3760. /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
  3761. static inline void
  3762. gimple_debug_bind_set_var (gimple *dbg, tree var)
  3763. {
  3764. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3765. gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
  3766. gimple_set_op (dbg, 0, var);
  3767. }
  3768. /* Set the value bound to the variable in a GIMPLE_DEBUG bind
  3769. statement. */
  3770. static inline void
  3771. gimple_debug_bind_set_value (gimple *dbg, tree value)
  3772. {
  3773. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3774. gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
  3775. gimple_set_op (dbg, 1, value);
  3776. }
  3777. /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
  3778. optimized away. */
  3779. #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
  3780. /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
  3781. statement. */
  3782. static inline void
  3783. gimple_debug_bind_reset_value (gimple *dbg)
  3784. {
  3785. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3786. gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
  3787. gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
  3788. }
  3789. /* Return true if the GIMPLE_DEBUG bind statement is bound to a
  3790. value. */
  3791. static inline bool
  3792. gimple_debug_bind_has_value_p (gimple *dbg)
  3793. {
  3794. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3795. gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
  3796. return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
  3797. }
  3798. #undef GIMPLE_DEBUG_BIND_NOVALUE
  3799. /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
  3800. static inline bool
  3801. gimple_debug_source_bind_p (const gimple *s)
  3802. {
  3803. if (is_gimple_debug (s))
  3804. return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
  3805. return false;
  3806. }
  3807. /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
  3808. static inline tree
  3809. gimple_debug_source_bind_get_var (const gimple *dbg)
  3810. {
  3811. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3812. gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
  3813. return gimple_op (dbg, 0);
  3814. }
  3815. /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
  3816. statement. */
  3817. static inline tree
  3818. gimple_debug_source_bind_get_value (const gimple *dbg)
  3819. {
  3820. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3821. gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
  3822. return gimple_op (dbg, 1);
  3823. }
  3824. /* Return a pointer to the value bound to the variable in a
  3825. GIMPLE_DEBUG source bind statement. */
  3826. static inline tree *
  3827. gimple_debug_source_bind_get_value_ptr (gimple *dbg)
  3828. {
  3829. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3830. gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
  3831. return gimple_op_ptr (dbg, 1);
  3832. }
  3833. /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
  3834. static inline void
  3835. gimple_debug_source_bind_set_var (gimple *dbg, tree var)
  3836. {
  3837. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3838. gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
  3839. gimple_set_op (dbg, 0, var);
  3840. }
  3841. /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
  3842. statement. */
  3843. static inline void
  3844. gimple_debug_source_bind_set_value (gimple *dbg, tree value)
  3845. {
  3846. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3847. gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
  3848. gimple_set_op (dbg, 1, value);
  3849. }
  3850. /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
  3851. static inline bool
  3852. gimple_debug_begin_stmt_p (const gimple *s)
  3853. {
  3854. if (is_gimple_debug (s))
  3855. return s->subcode == GIMPLE_DEBUG_BEGIN_STMT;
  3856. return false;
  3857. }
  3858. /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
  3859. static inline bool
  3860. gimple_debug_inline_entry_p (const gimple *s)
  3861. {
  3862. if (is_gimple_debug (s))
  3863. return s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
  3864. return false;
  3865. }
  3866. /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
  3867. static inline bool
  3868. gimple_debug_nonbind_marker_p (const gimple *s)
  3869. {
  3870. if (is_gimple_debug (s))
  3871. return s->subcode == GIMPLE_DEBUG_BEGIN_STMT
  3872. || s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
  3873. return false;
  3874. }
  3875. /* Return the line number for EXPR, or return -1 if we have no line
  3876. number information for it. */
  3877. static inline int
  3878. get_lineno (const gimple *stmt)
  3879. {
  3880. location_t loc;
  3881. if (!stmt)
  3882. return -1;
  3883. loc = gimple_location (stmt);
  3884. if (loc == UNKNOWN_LOCATION)
  3885. return -1;
  3886. return LOCATION_LINE (loc);
  3887. }
  3888. /* Return a pointer to the body for the OMP statement GS. */
  3889. static inline gimple_seq *
  3890. gimple_omp_body_ptr (gimple *gs)
  3891. {
  3892. return &static_cast <gimple_statement_omp *> (gs)->body;
  3893. }
  3894. /* Return the body for the OMP statement GS. */
  3895. static inline gimple_seq
  3896. gimple_omp_body (const gimple *gs)
  3897. {
  3898. return *gimple_omp_body_ptr (const_cast <gimple *> (gs));
  3899. }
  3900. /* Set BODY to be the body for the OMP statement GS. */
  3901. static inline void
  3902. gimple_omp_set_body (gimple *gs, gimple_seq body)
  3903. {
  3904. static_cast <gimple_statement_omp *> (gs)->body = body;
  3905. }
  3906. /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
  3907. static inline tree
  3908. gimple_omp_critical_name (const gomp_critical *crit_stmt)
  3909. {
  3910. return crit_stmt->name;
  3911. }
  3912. /* Return a pointer to the name associated with OMP critical statement
  3913. CRIT_STMT. */
  3914. static inline tree *
  3915. gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
  3916. {
  3917. return &crit_stmt->name;
  3918. }
  3919. /* Set NAME to be the name associated with OMP critical statement
  3920. CRIT_STMT. */
  3921. static inline void
  3922. gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
  3923. {
  3924. crit_stmt->name = name;
  3925. }
  3926. /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
  3927. static inline tree
  3928. gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
  3929. {
  3930. return crit_stmt->clauses;
  3931. }
  3932. /* Return a pointer to the clauses associated with OMP critical statement
  3933. CRIT_STMT. */
  3934. static inline tree *
  3935. gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
  3936. {
  3937. return &crit_stmt->clauses;
  3938. }
  3939. /* Set CLAUSES to be the clauses associated with OMP critical statement
  3940. CRIT_STMT. */
  3941. static inline void
  3942. gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
  3943. {
  3944. crit_stmt->clauses = clauses;
  3945. }
  3946. /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
  3947. static inline tree
  3948. gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
  3949. {
  3950. return ord_stmt->clauses;
  3951. }
  3952. /* Return a pointer to the clauses associated with OMP ordered statement
  3953. ORD_STMT. */
  3954. static inline tree *
  3955. gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
  3956. {
  3957. return &ord_stmt->clauses;
  3958. }
  3959. /* Set CLAUSES to be the clauses associated with OMP ordered statement
  3960. ORD_STMT. */
  3961. static inline void
  3962. gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
  3963. {
  3964. ord_stmt->clauses = clauses;
  3965. }
  3966. /* Return the clauses associated with OMP_SCAN statement SCAN_STMT. */
  3967. static inline tree
  3968. gimple_omp_scan_clauses (const gomp_scan *scan_stmt)
  3969. {
  3970. return scan_stmt->clauses;
  3971. }
  3972. /* Return a pointer to the clauses associated with OMP scan statement
  3973. ORD_STMT. */
  3974. static inline tree *
  3975. gimple_omp_scan_clauses_ptr (gomp_scan *scan_stmt)
  3976. {
  3977. return &scan_stmt->clauses;
  3978. }
  3979. /* Set CLAUSES to be the clauses associated with OMP scan statement
  3980. ORD_STMT. */
  3981. static inline void
  3982. gimple_omp_scan_set_clauses (gomp_scan *scan_stmt, tree clauses)
  3983. {
  3984. scan_stmt->clauses = clauses;
  3985. }
  3986. /* Return the clauses associated with OMP_TASKGROUP statement GS. */
  3987. static inline tree
  3988. gimple_omp_taskgroup_clauses (const gimple *gs)
  3989. {
  3990. GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
  3991. return
  3992. static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
  3993. }
  3994. /* Return a pointer to the clauses associated with OMP taskgroup statement
  3995. GS. */
  3996. static inline tree *
  3997. gimple_omp_taskgroup_clauses_ptr (gimple *gs)
  3998. {
  3999. GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
  4000. return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
  4001. }
  4002. /* Set CLAUSES to be the clauses associated with OMP taskgroup statement
  4003. GS. */
  4004. static inline void
  4005. gimple_omp_taskgroup_set_clauses (gimple *gs, tree clauses)
  4006. {
  4007. GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
  4008. static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
  4009. = clauses;
  4010. }
  4011. /* Return the kind of the OMP_FOR statemement G. */
  4012. static inline int
  4013. gimple_omp_for_kind (const gimple *g)
  4014. {
  4015. GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
  4016. return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
  4017. }
  4018. /* Set the kind of the OMP_FOR statement G. */
  4019. static inline void
  4020. gimple_omp_for_set_kind (gomp_for *g, int kind)
  4021. {
  4022. g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
  4023. | (kind & GF_OMP_FOR_KIND_MASK);
  4024. }
  4025. /* Return true if OMP_FOR statement G has the
  4026. GF_OMP_FOR_COMBINED flag set. */
  4027. static inline bool
  4028. gimple_omp_for_combined_p (const gimple *g)
  4029. {
  4030. GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
  4031. return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
  4032. }
  4033. /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
  4034. the boolean value of COMBINED_P. */
  4035. static inline void
  4036. gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
  4037. {
  4038. if (combined_p)
  4039. g->subcode |= GF_OMP_FOR_COMBINED;
  4040. else
  4041. g->subcode &= ~GF_OMP_FOR_COMBINED;
  4042. }
  4043. /* Return true if the OMP_FOR statement G has the
  4044. GF_OMP_FOR_COMBINED_INTO flag set. */
  4045. static inline bool
  4046. gimple_omp_for_combined_into_p (const gimple *g)
  4047. {
  4048. GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
  4049. return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
  4050. }
  4051. /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
  4052. on the boolean value of COMBINED_P. */
  4053. static inline void
  4054. gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
  4055. {
  4056. if (combined_p)
  4057. g->subcode |= GF_OMP_FOR_COMBINED_INTO;
  4058. else
  4059. g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
  4060. }
  4061. /* Return the clauses associated with the OMP_FOR statement GS. */
  4062. static inline tree
  4063. gimple_omp_for_clauses (const gimple *gs)
  4064. {
  4065. const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
  4066. return omp_for_stmt->clauses;
  4067. }
  4068. /* Return a pointer to the clauses associated with the OMP_FOR statement
  4069. GS. */
  4070. static inline tree *
  4071. gimple_omp_for_clauses_ptr (gimple *gs)
  4072. {
  4073. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4074. return &omp_for_stmt->clauses;
  4075. }
  4076. /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
  4077. GS. */
  4078. static inline void
  4079. gimple_omp_for_set_clauses (gimple *gs, tree clauses)
  4080. {
  4081. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4082. omp_for_stmt->clauses = clauses;
  4083. }
  4084. /* Get the collapse count of the OMP_FOR statement GS. */
  4085. static inline size_t
  4086. gimple_omp_for_collapse (const gimple *gs)
  4087. {
  4088. const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
  4089. return omp_for_stmt->collapse;
  4090. }
  4091. /* Return the condition code associated with the OMP_FOR statement GS. */
  4092. static inline enum tree_code
  4093. gimple_omp_for_cond (const gimple *gs, size_t i)
  4094. {
  4095. const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
  4096. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4097. return omp_for_stmt->iter[i].cond;
  4098. }
  4099. /* Set COND to be the condition code for the OMP_FOR statement GS. */
  4100. static inline void
  4101. gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
  4102. {
  4103. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4104. gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
  4105. && i < omp_for_stmt->collapse);
  4106. omp_for_stmt->iter[i].cond = cond;
  4107. }
  4108. /* Return the index variable for the OMP_FOR statement GS. */
  4109. static inline tree
  4110. gimple_omp_for_index (const gimple *gs, size_t i)
  4111. {
  4112. const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
  4113. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4114. return omp_for_stmt->iter[i].index;
  4115. }
  4116. /* Return a pointer to the index variable for the OMP_FOR statement GS. */
  4117. static inline tree *
  4118. gimple_omp_for_index_ptr (gimple *gs, size_t i)
  4119. {
  4120. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4121. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4122. return &omp_for_stmt->iter[i].index;
  4123. }
  4124. /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
  4125. static inline void
  4126. gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
  4127. {
  4128. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4129. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4130. omp_for_stmt->iter[i].index = index;
  4131. }
  4132. /* Return the initial value for the OMP_FOR statement GS. */
  4133. static inline tree
  4134. gimple_omp_for_initial (const gimple *gs, size_t i)
  4135. {
  4136. const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
  4137. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4138. return omp_for_stmt->iter[i].initial;
  4139. }
  4140. /* Return a pointer to the initial value for the OMP_FOR statement GS. */
  4141. static inline tree *
  4142. gimple_omp_for_initial_ptr (gimple *gs, size_t i)
  4143. {
  4144. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4145. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4146. return &omp_for_stmt->iter[i].initial;
  4147. }
  4148. /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
  4149. static inline void
  4150. gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
  4151. {
  4152. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4153. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4154. omp_for_stmt->iter[i].initial = initial;
  4155. }
  4156. /* Return the final value for the OMP_FOR statement GS. */
  4157. static inline tree
  4158. gimple_omp_for_final (const gimple *gs, size_t i)
  4159. {
  4160. const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
  4161. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4162. return omp_for_stmt->iter[i].final;
  4163. }
  4164. /* Return a pointer to the final value for the OMP_FOR statement GS. */
  4165. static inline tree *
  4166. gimple_omp_for_final_ptr (gimple *gs, size_t i)
  4167. {
  4168. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4169. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4170. return &omp_for_stmt->iter[i].final;
  4171. }
  4172. /* Set FINAL to be the final value for the OMP_FOR statement GS. */
  4173. static inline void
  4174. gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
  4175. {
  4176. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4177. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4178. omp_for_stmt->iter[i].final = final;
  4179. }
  4180. /* Return the increment value for the OMP_FOR statement GS. */
  4181. static inline tree
  4182. gimple_omp_for_incr (const gimple *gs, size_t i)
  4183. {
  4184. const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
  4185. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4186. return omp_for_stmt->iter[i].incr;
  4187. }
  4188. /* Return a pointer to the increment value for the OMP_FOR statement GS. */
  4189. static inline tree *
  4190. gimple_omp_for_incr_ptr (gimple *gs, size_t i)
  4191. {
  4192. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4193. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4194. return &omp_for_stmt->iter[i].incr;
  4195. }
  4196. /* Set INCR to be the increment value for the OMP_FOR statement GS. */
  4197. static inline void
  4198. gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
  4199. {
  4200. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4201. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4202. omp_for_stmt->iter[i].incr = incr;
  4203. }
  4204. /* Return a pointer to the sequence of statements to execute before the OMP_FOR
  4205. statement GS starts. */
  4206. static inline gimple_seq *
  4207. gimple_omp_for_pre_body_ptr (gimple *gs)
  4208. {
  4209. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4210. return &omp_for_stmt->pre_body;
  4211. }
  4212. /* Return the sequence of statements to execute before the OMP_FOR
  4213. statement GS starts. */
  4214. static inline gimple_seq
  4215. gimple_omp_for_pre_body (const gimple *gs)
  4216. {
  4217. return *gimple_omp_for_pre_body_ptr (const_cast <gimple *> (gs));
  4218. }
  4219. /* Set PRE_BODY to be the sequence of statements to execute before the
  4220. OMP_FOR statement GS starts. */
  4221. static inline void
  4222. gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
  4223. {
  4224. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4225. omp_for_stmt->pre_body = pre_body;
  4226. }
  4227. /* Return the kernel_phony of OMP_FOR statement. */
  4228. static inline bool
  4229. gimple_omp_for_grid_phony (const gomp_for *omp_for)
  4230. {
  4231. gcc_checking_assert (gimple_omp_for_kind (omp_for)
  4232. != GF_OMP_FOR_KIND_GRID_LOOP);
  4233. return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0;
  4234. }
  4235. /* Set kernel_phony flag of OMP_FOR to VALUE. */
  4236. static inline void
  4237. gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value)
  4238. {
  4239. gcc_checking_assert (gimple_omp_for_kind (omp_for)
  4240. != GF_OMP_FOR_KIND_GRID_LOOP);
  4241. if (value)
  4242. omp_for->subcode |= GF_OMP_FOR_GRID_PHONY;
  4243. else
  4244. omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY;
  4245. }
  4246. /* Return the kernel_intra_group of a GRID_LOOP OMP_FOR statement. */
  4247. static inline bool
  4248. gimple_omp_for_grid_intra_group (const gomp_for *omp_for)
  4249. {
  4250. gcc_checking_assert (gimple_omp_for_kind (omp_for)
  4251. == GF_OMP_FOR_KIND_GRID_LOOP);
  4252. return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_INTRA_GROUP) != 0;
  4253. }
  4254. /* Set kernel_intra_group flag of OMP_FOR to VALUE. */
  4255. static inline void
  4256. gimple_omp_for_set_grid_intra_group (gomp_for *omp_for, bool value)
  4257. {
  4258. gcc_checking_assert (gimple_omp_for_kind (omp_for)
  4259. == GF_OMP_FOR_KIND_GRID_LOOP);
  4260. if (value)
  4261. omp_for->subcode |= GF_OMP_FOR_GRID_INTRA_GROUP;
  4262. else
  4263. omp_for->subcode &= ~GF_OMP_FOR_GRID_INTRA_GROUP;
  4264. }
  4265. /* Return true if iterations of a grid OMP_FOR statement correspond to HSA
  4266. groups. */
  4267. static inline bool
  4268. gimple_omp_for_grid_group_iter (const gomp_for *omp_for)
  4269. {
  4270. gcc_checking_assert (gimple_omp_for_kind (omp_for)
  4271. == GF_OMP_FOR_KIND_GRID_LOOP);
  4272. return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_GROUP_ITER) != 0;
  4273. }
  4274. /* Set group_iter flag of OMP_FOR to VALUE. */
  4275. static inline void
  4276. gimple_omp_for_set_grid_group_iter (gomp_for *omp_for, bool value)
  4277. {
  4278. gcc_checking_assert (gimple_omp_for_kind (omp_for)
  4279. == GF_OMP_FOR_KIND_GRID_LOOP);
  4280. if (value)
  4281. omp_for->subcode |= GF_OMP_FOR_GRID_GROUP_ITER;
  4282. else
  4283. omp_for->subcode &= ~GF_OMP_FOR_GRID_GROUP_ITER;
  4284. }
  4285. /* Return the clauses associated with OMP_PARALLEL GS. */
  4286. static inline tree
  4287. gimple_omp_parallel_clauses (const gimple *gs)
  4288. {
  4289. const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
  4290. return omp_parallel_stmt->clauses;
  4291. }
  4292. /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
  4293. static inline tree *
  4294. gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
  4295. {
  4296. return &omp_parallel_stmt->clauses;
  4297. }
  4298. /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
  4299. static inline void
  4300. gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
  4301. tree clauses)
  4302. {
  4303. omp_parallel_stmt->clauses = clauses;
  4304. }
  4305. /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
  4306. static inline tree
  4307. gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
  4308. {
  4309. return omp_parallel_stmt->child_fn;
  4310. }
  4311. /* Return a pointer to the child function used to hold the body of
  4312. OMP_PARALLEL_STMT. */
  4313. static inline tree *
  4314. gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
  4315. {
  4316. return &omp_parallel_stmt->child_fn;
  4317. }
  4318. /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
  4319. static inline void
  4320. gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
  4321. tree child_fn)
  4322. {
  4323. omp_parallel_stmt->child_fn = child_fn;
  4324. }
  4325. /* Return the artificial argument used to send variables and values
  4326. from the parent to the children threads in OMP_PARALLEL_STMT. */
  4327. static inline tree
  4328. gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
  4329. {
  4330. return omp_parallel_stmt->data_arg;
  4331. }
  4332. /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
  4333. static inline tree *
  4334. gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
  4335. {
  4336. return &omp_parallel_stmt->data_arg;
  4337. }
  4338. /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
  4339. static inline void
  4340. gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
  4341. tree data_arg)
  4342. {
  4343. omp_parallel_stmt->data_arg = data_arg;
  4344. }
  4345. /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
  4346. static inline bool
  4347. gimple_omp_parallel_grid_phony (const gomp_parallel *stmt)
  4348. {
  4349. return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0;
  4350. }
  4351. /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
  4352. static inline void
  4353. gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value)
  4354. {
  4355. if (value)
  4356. stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY;
  4357. else
  4358. stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY;
  4359. }
  4360. /* Return the clauses associated with OMP_TASK GS. */
  4361. static inline tree
  4362. gimple_omp_task_clauses (const gimple *gs)
  4363. {
  4364. const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
  4365. return omp_task_stmt->clauses;
  4366. }
  4367. /* Return a pointer to the clauses associated with OMP_TASK GS. */
  4368. static inline tree *
  4369. gimple_omp_task_clauses_ptr (gimple *gs)
  4370. {
  4371. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4372. return &omp_task_stmt->clauses;
  4373. }
  4374. /* Set CLAUSES to be the list of clauses associated with OMP_TASK
  4375. GS. */
  4376. static inline void
  4377. gimple_omp_task_set_clauses (gimple *gs, tree clauses)
  4378. {
  4379. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4380. omp_task_stmt->clauses = clauses;
  4381. }
  4382. /* Return true if OMP task statement G has the
  4383. GF_OMP_TASK_TASKLOOP flag set. */
  4384. static inline bool
  4385. gimple_omp_task_taskloop_p (const gimple *g)
  4386. {
  4387. GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
  4388. return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
  4389. }
  4390. /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
  4391. value of TASKLOOP_P. */
  4392. static inline void
  4393. gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
  4394. {
  4395. GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
  4396. if (taskloop_p)
  4397. g->subcode |= GF_OMP_TASK_TASKLOOP;
  4398. else
  4399. g->subcode &= ~GF_OMP_TASK_TASKLOOP;
  4400. }
  4401. /* Return true if OMP task statement G has the
  4402. GF_OMP_TASK_TASKWAIT flag set. */
  4403. static inline bool
  4404. gimple_omp_task_taskwait_p (const gimple *g)
  4405. {
  4406. GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
  4407. return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKWAIT) != 0;
  4408. }
  4409. /* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean
  4410. value of TASKWAIT_P. */
  4411. static inline void
  4412. gimple_omp_task_set_taskwait_p (gimple *g, bool taskwait_p)
  4413. {
  4414. GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
  4415. if (taskwait_p)
  4416. g->subcode |= GF_OMP_TASK_TASKWAIT;
  4417. else
  4418. g->subcode &= ~GF_OMP_TASK_TASKWAIT;
  4419. }
  4420. /* Return the child function used to hold the body of OMP_TASK GS. */
  4421. static inline tree
  4422. gimple_omp_task_child_fn (const gimple *gs)
  4423. {
  4424. const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
  4425. return omp_task_stmt->child_fn;
  4426. }
  4427. /* Return a pointer to the child function used to hold the body of
  4428. OMP_TASK GS. */
  4429. static inline tree *
  4430. gimple_omp_task_child_fn_ptr (gimple *gs)
  4431. {
  4432. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4433. return &omp_task_stmt->child_fn;
  4434. }
  4435. /* Set CHILD_FN to be the child function for OMP_TASK GS. */
  4436. static inline void
  4437. gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
  4438. {
  4439. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4440. omp_task_stmt->child_fn = child_fn;
  4441. }
  4442. /* Return the artificial argument used to send variables and values
  4443. from the parent to the children threads in OMP_TASK GS. */
  4444. static inline tree
  4445. gimple_omp_task_data_arg (const gimple *gs)
  4446. {
  4447. const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
  4448. return omp_task_stmt->data_arg;
  4449. }
  4450. /* Return a pointer to the data argument for OMP_TASK GS. */
  4451. static inline tree *
  4452. gimple_omp_task_data_arg_ptr (gimple *gs)
  4453. {
  4454. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4455. return &omp_task_stmt->data_arg;
  4456. }
  4457. /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
  4458. static inline void
  4459. gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
  4460. {
  4461. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4462. omp_task_stmt->data_arg = data_arg;
  4463. }
  4464. /* Return the clauses associated with OMP_TASK GS. */
  4465. static inline tree
  4466. gimple_omp_taskreg_clauses (const gimple *gs)
  4467. {
  4468. const gimple_statement_omp_taskreg *omp_taskreg_stmt
  4469. = as_a <const gimple_statement_omp_taskreg *> (gs);
  4470. return omp_taskreg_stmt->clauses;
  4471. }
  4472. /* Return a pointer to the clauses associated with OMP_TASK GS. */
  4473. static inline tree *
  4474. gimple_omp_taskreg_clauses_ptr (gimple *gs)
  4475. {
  4476. gimple_statement_omp_taskreg *omp_taskreg_stmt
  4477. = as_a <gimple_statement_omp_taskreg *> (gs);
  4478. return &omp_taskreg_stmt->clauses;
  4479. }
  4480. /* Set CLAUSES to be the list of clauses associated with OMP_TASK
  4481. GS. */
  4482. static inline void
  4483. gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
  4484. {
  4485. gimple_statement_omp_taskreg *omp_taskreg_stmt
  4486. = as_a <gimple_statement_omp_taskreg *> (gs);
  4487. omp_taskreg_stmt->clauses = clauses;
  4488. }
  4489. /* Return the child function used to hold the body of OMP_TASK GS. */
  4490. static inline tree
  4491. gimple_omp_taskreg_child_fn (const gimple *gs)
  4492. {
  4493. const gimple_statement_omp_taskreg *omp_taskreg_stmt
  4494. = as_a <const gimple_statement_omp_taskreg *> (gs);
  4495. return omp_taskreg_stmt->child_fn;
  4496. }
  4497. /* Return a pointer to the child function used to hold the body of
  4498. OMP_TASK GS. */
  4499. static inline tree *
  4500. gimple_omp_taskreg_child_fn_ptr (gimple *gs)
  4501. {
  4502. gimple_statement_omp_taskreg *omp_taskreg_stmt
  4503. = as_a <gimple_statement_omp_taskreg *> (gs);
  4504. return &omp_taskreg_stmt->child_fn;
  4505. }
  4506. /* Set CHILD_FN to be the child function for OMP_TASK GS. */
  4507. static inline void
  4508. gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
  4509. {
  4510. gimple_statement_omp_taskreg *omp_taskreg_stmt
  4511. = as_a <gimple_statement_omp_taskreg *> (gs);
  4512. omp_taskreg_stmt->child_fn = child_fn;
  4513. }
  4514. /* Return the artificial argument used to send variables and values
  4515. from the parent to the children threads in OMP_TASK GS. */
  4516. static inline tree
  4517. gimple_omp_taskreg_data_arg (const gimple *gs)
  4518. {
  4519. const gimple_statement_omp_taskreg *omp_taskreg_stmt
  4520. = as_a <const gimple_statement_omp_taskreg *> (gs);
  4521. return omp_taskreg_stmt->data_arg;
  4522. }
  4523. /* Return a pointer to the data argument for OMP_TASK GS. */
  4524. static inline tree *
  4525. gimple_omp_taskreg_data_arg_ptr (gimple *gs)
  4526. {
  4527. gimple_statement_omp_taskreg *omp_taskreg_stmt
  4528. = as_a <gimple_statement_omp_taskreg *> (gs);
  4529. return &omp_taskreg_stmt->data_arg;
  4530. }
  4531. /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
  4532. static inline void
  4533. gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
  4534. {
  4535. gimple_statement_omp_taskreg *omp_taskreg_stmt
  4536. = as_a <gimple_statement_omp_taskreg *> (gs);
  4537. omp_taskreg_stmt->data_arg = data_arg;
  4538. }
  4539. /* Return the copy function used to hold the body of OMP_TASK GS. */
  4540. static inline tree
  4541. gimple_omp_task_copy_fn (const gimple *gs)
  4542. {
  4543. const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
  4544. return omp_task_stmt->copy_fn;
  4545. }
  4546. /* Return a pointer to the copy function used to hold the body of
  4547. OMP_TASK GS. */
  4548. static inline tree *
  4549. gimple_omp_task_copy_fn_ptr (gimple *gs)
  4550. {
  4551. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4552. return &omp_task_stmt->copy_fn;
  4553. }
  4554. /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
  4555. static inline void
  4556. gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
  4557. {
  4558. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4559. omp_task_stmt->copy_fn = copy_fn;
  4560. }
  4561. /* Return size of the data block in bytes in OMP_TASK GS. */
  4562. static inline tree
  4563. gimple_omp_task_arg_size (const gimple *gs)
  4564. {
  4565. const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
  4566. return omp_task_stmt->arg_size;
  4567. }
  4568. /* Return a pointer to the data block size for OMP_TASK GS. */
  4569. static inline tree *
  4570. gimple_omp_task_arg_size_ptr (gimple *gs)
  4571. {
  4572. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4573. return &omp_task_stmt->arg_size;
  4574. }
  4575. /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
  4576. static inline void
  4577. gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
  4578. {
  4579. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4580. omp_task_stmt->arg_size = arg_size;
  4581. }
  4582. /* Return align of the data block in bytes in OMP_TASK GS. */
  4583. static inline tree
  4584. gimple_omp_task_arg_align (const gimple *gs)
  4585. {
  4586. const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
  4587. return omp_task_stmt->arg_align;
  4588. }
  4589. /* Return a pointer to the data block align for OMP_TASK GS. */
  4590. static inline tree *
  4591. gimple_omp_task_arg_align_ptr (gimple *gs)
  4592. {
  4593. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4594. return &omp_task_stmt->arg_align;
  4595. }
  4596. /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
  4597. static inline void
  4598. gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
  4599. {
  4600. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4601. omp_task_stmt->arg_align = arg_align;
  4602. }
  4603. /* Return the clauses associated with OMP_SINGLE GS. */
  4604. static inline tree
  4605. gimple_omp_single_clauses (const gimple *gs)
  4606. {
  4607. const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
  4608. return omp_single_stmt->clauses;
  4609. }
  4610. /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
  4611. static inline tree *
  4612. gimple_omp_single_clauses_ptr (gimple *gs)
  4613. {
  4614. gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
  4615. return &omp_single_stmt->clauses;
  4616. }
  4617. /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
  4618. static inline void
  4619. gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
  4620. {
  4621. omp_single_stmt->clauses = clauses;
  4622. }
  4623. /* Return the clauses associated with OMP_TARGET GS. */
  4624. static inline tree
  4625. gimple_omp_target_clauses (const gimple *gs)
  4626. {
  4627. const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
  4628. return omp_target_stmt->clauses;
  4629. }
  4630. /* Return a pointer to the clauses associated with OMP_TARGET GS. */
  4631. static inline tree *
  4632. gimple_omp_target_clauses_ptr (gimple *gs)
  4633. {
  4634. gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
  4635. return &omp_target_stmt->clauses;
  4636. }
  4637. /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
  4638. static inline void
  4639. gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
  4640. tree clauses)
  4641. {
  4642. omp_target_stmt->clauses = clauses;
  4643. }
  4644. /* Return the kind of the OMP_TARGET G. */
  4645. static inline int
  4646. gimple_omp_target_kind (const gimple *g)
  4647. {
  4648. GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
  4649. return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
  4650. }
  4651. /* Set the kind of the OMP_TARGET G. */
  4652. static inline void
  4653. gimple_omp_target_set_kind (gomp_target *g, int kind)
  4654. {
  4655. g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
  4656. | (kind & GF_OMP_TARGET_KIND_MASK);
  4657. }
  4658. /* Return the child function used to hold the body of OMP_TARGET_STMT. */
  4659. static inline tree
  4660. gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
  4661. {
  4662. return omp_target_stmt->child_fn;
  4663. }
  4664. /* Return a pointer to the child function used to hold the body of
  4665. OMP_TARGET_STMT. */
  4666. static inline tree *
  4667. gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
  4668. {
  4669. return &omp_target_stmt->child_fn;
  4670. }
  4671. /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
  4672. static inline void
  4673. gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
  4674. tree child_fn)
  4675. {
  4676. omp_target_stmt->child_fn = child_fn;
  4677. }
  4678. /* Return the artificial argument used to send variables and values
  4679. from the parent to the children threads in OMP_TARGET_STMT. */
  4680. static inline tree
  4681. gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
  4682. {
  4683. return omp_target_stmt->data_arg;
  4684. }
  4685. /* Return a pointer to the data argument for OMP_TARGET GS. */
  4686. static inline tree *
  4687. gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
  4688. {
  4689. return &omp_target_stmt->data_arg;
  4690. }
  4691. /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
  4692. static inline void
  4693. gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
  4694. tree data_arg)
  4695. {
  4696. omp_target_stmt->data_arg = data_arg;
  4697. }
  4698. /* Return the clauses associated with OMP_TEAMS GS. */
  4699. static inline tree
  4700. gimple_omp_teams_clauses (const gimple *gs)
  4701. {
  4702. const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
  4703. return omp_teams_stmt->clauses;
  4704. }
  4705. /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
  4706. static inline tree *
  4707. gimple_omp_teams_clauses_ptr (gimple *gs)
  4708. {
  4709. gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
  4710. return &omp_teams_stmt->clauses;
  4711. }
  4712. /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
  4713. static inline void
  4714. gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
  4715. {
  4716. omp_teams_stmt->clauses = clauses;
  4717. }
  4718. /* Return the child function used to hold the body of OMP_TEAMS_STMT. */
  4719. static inline tree
  4720. gimple_omp_teams_child_fn (const gomp_teams *omp_teams_stmt)
  4721. {
  4722. return omp_teams_stmt->child_fn;
  4723. }
  4724. /* Return a pointer to the child function used to hold the body of
  4725. OMP_TEAMS_STMT. */
  4726. static inline tree *
  4727. gimple_omp_teams_child_fn_ptr (gomp_teams *omp_teams_stmt)
  4728. {
  4729. return &omp_teams_stmt->child_fn;
  4730. }
  4731. /* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */
  4732. static inline void
  4733. gimple_omp_teams_set_child_fn (gomp_teams *omp_teams_stmt, tree child_fn)
  4734. {
  4735. omp_teams_stmt->child_fn = child_fn;
  4736. }
  4737. /* Return the artificial argument used to send variables and values
  4738. from the parent to the children threads in OMP_TEAMS_STMT. */
  4739. static inline tree
  4740. gimple_omp_teams_data_arg (const gomp_teams *omp_teams_stmt)
  4741. {
  4742. return omp_teams_stmt->data_arg;
  4743. }
  4744. /* Return a pointer to the data argument for OMP_TEAMS_STMT. */
  4745. static inline tree *
  4746. gimple_omp_teams_data_arg_ptr (gomp_teams *omp_teams_stmt)
  4747. {
  4748. return &omp_teams_stmt->data_arg;
  4749. }
  4750. /* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */
  4751. static inline void
  4752. gimple_omp_teams_set_data_arg (gomp_teams *omp_teams_stmt, tree data_arg)
  4753. {
  4754. omp_teams_stmt->data_arg = data_arg;
  4755. }
  4756. /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
  4757. static inline bool
  4758. gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt)
  4759. {
  4760. return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0;
  4761. }
  4762. /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
  4763. static inline void
  4764. gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value)
  4765. {
  4766. if (value)
  4767. omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY;
  4768. else
  4769. omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY;
  4770. }
  4771. /* Return the host flag of an OMP_TEAMS_STMT. */
  4772. static inline bool
  4773. gimple_omp_teams_host (const gomp_teams *omp_teams_stmt)
  4774. {
  4775. return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_HOST) != 0;
  4776. }
  4777. /* Set host flag of an OMP_TEAMS_STMT to VALUE. */
  4778. static inline void
  4779. gimple_omp_teams_set_host (gomp_teams *omp_teams_stmt, bool value)
  4780. {
  4781. if (value)
  4782. omp_teams_stmt->subcode |= GF_OMP_TEAMS_HOST;
  4783. else
  4784. omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_HOST;
  4785. }
  4786. /* Return the clauses associated with OMP_SECTIONS GS. */
  4787. static inline tree
  4788. gimple_omp_sections_clauses (const gimple *gs)
  4789. {
  4790. const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
  4791. return omp_sections_stmt->clauses;
  4792. }
  4793. /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
  4794. static inline tree *
  4795. gimple_omp_sections_clauses_ptr (gimple *gs)
  4796. {
  4797. gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
  4798. return &omp_sections_stmt->clauses;
  4799. }
  4800. /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
  4801. GS. */
  4802. static inline void
  4803. gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
  4804. {
  4805. gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
  4806. omp_sections_stmt->clauses = clauses;
  4807. }
  4808. /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
  4809. in GS. */
  4810. static inline tree
  4811. gimple_omp_sections_control (const gimple *gs)
  4812. {
  4813. const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
  4814. return omp_sections_stmt->control;
  4815. }
  4816. /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
  4817. GS. */
  4818. static inline tree *
  4819. gimple_omp_sections_control_ptr (gimple *gs)
  4820. {
  4821. gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
  4822. return &omp_sections_stmt->control;
  4823. }
  4824. /* Set CONTROL to be the set of clauses associated with the
  4825. GIMPLE_OMP_SECTIONS in GS. */
  4826. static inline void
  4827. gimple_omp_sections_set_control (gimple *gs, tree control)
  4828. {
  4829. gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
  4830. omp_sections_stmt->control = control;
  4831. }
  4832. /* Set the value being stored in an atomic store. */
  4833. static inline void
  4834. gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
  4835. {
  4836. store_stmt->val = val;
  4837. }
  4838. /* Return the value being stored in an atomic store. */
  4839. static inline tree
  4840. gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
  4841. {
  4842. return store_stmt->val;
  4843. }
  4844. /* Return a pointer to the value being stored in an atomic store. */
  4845. static inline tree *
  4846. gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
  4847. {
  4848. return &store_stmt->val;
  4849. }
  4850. /* Set the LHS of an atomic load. */
  4851. static inline void
  4852. gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
  4853. {
  4854. load_stmt->lhs = lhs;
  4855. }
  4856. /* Get the LHS of an atomic load. */
  4857. static inline tree
  4858. gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
  4859. {
  4860. return load_stmt->lhs;
  4861. }
  4862. /* Return a pointer to the LHS of an atomic load. */
  4863. static inline tree *
  4864. gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
  4865. {
  4866. return &load_stmt->lhs;
  4867. }
  4868. /* Set the RHS of an atomic load. */
  4869. static inline void
  4870. gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
  4871. {
  4872. load_stmt->rhs = rhs;
  4873. }
  4874. /* Get the RHS of an atomic load. */
  4875. static inline tree
  4876. gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
  4877. {
  4878. return load_stmt->rhs;
  4879. }
  4880. /* Return a pointer to the RHS of an atomic load. */
  4881. static inline tree *
  4882. gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
  4883. {
  4884. return &load_stmt->rhs;
  4885. }
  4886. /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
  4887. static inline tree
  4888. gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
  4889. {
  4890. return cont_stmt->control_def;
  4891. }
  4892. /* The same as above, but return the address. */
  4893. static inline tree *
  4894. gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
  4895. {
  4896. return &cont_stmt->control_def;
  4897. }
  4898. /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
  4899. static inline void
  4900. gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
  4901. {
  4902. cont_stmt->control_def = def;
  4903. }
  4904. /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
  4905. static inline tree
  4906. gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
  4907. {
  4908. return cont_stmt->control_use;
  4909. }
  4910. /* The same as above, but return the address. */
  4911. static inline tree *
  4912. gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
  4913. {
  4914. return &cont_stmt->control_use;
  4915. }
  4916. /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
  4917. static inline void
  4918. gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
  4919. {
  4920. cont_stmt->control_use = use;
  4921. }
  4922. /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
  4923. TRANSACTION_STMT. */
  4924. static inline gimple_seq *
  4925. gimple_transaction_body_ptr (gtransaction *transaction_stmt)
  4926. {
  4927. return &transaction_stmt->body;
  4928. }
  4929. /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
  4930. static inline gimple_seq
  4931. gimple_transaction_body (const gtransaction *transaction_stmt)
  4932. {
  4933. return transaction_stmt->body;
  4934. }
  4935. /* Return the label associated with a GIMPLE_TRANSACTION. */
  4936. static inline tree
  4937. gimple_transaction_label_norm (const gtransaction *transaction_stmt)
  4938. {
  4939. return transaction_stmt->label_norm;
  4940. }
  4941. static inline tree *
  4942. gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
  4943. {
  4944. return &transaction_stmt->label_norm;
  4945. }
  4946. static inline tree
  4947. gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
  4948. {
  4949. return transaction_stmt->label_uninst;
  4950. }
  4951. static inline tree *
  4952. gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
  4953. {
  4954. return &transaction_stmt->label_uninst;
  4955. }
  4956. static inline tree
  4957. gimple_transaction_label_over (const gtransaction *transaction_stmt)
  4958. {
  4959. return transaction_stmt->label_over;
  4960. }
  4961. static inline tree *
  4962. gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
  4963. {
  4964. return &transaction_stmt->label_over;
  4965. }
  4966. /* Return the subcode associated with a GIMPLE_TRANSACTION. */
  4967. static inline unsigned int
  4968. gimple_transaction_subcode (const gtransaction *transaction_stmt)
  4969. {
  4970. return transaction_stmt->subcode;
  4971. }
  4972. /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
  4973. TRANSACTION_STMT. */
  4974. static inline void
  4975. gimple_transaction_set_body (gtransaction *transaction_stmt,
  4976. gimple_seq body)
  4977. {
  4978. transaction_stmt->body = body;
  4979. }
  4980. /* Set the label associated with a GIMPLE_TRANSACTION. */
  4981. static inline void
  4982. gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
  4983. {
  4984. transaction_stmt->label_norm = label;
  4985. }
  4986. static inline void
  4987. gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
  4988. {
  4989. transaction_stmt->label_uninst = label;
  4990. }
  4991. static inline void
  4992. gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
  4993. {
  4994. transaction_stmt->label_over = label;
  4995. }
  4996. /* Set the subcode associated with a GIMPLE_TRANSACTION. */
  4997. static inline void
  4998. gimple_transaction_set_subcode (gtransaction *transaction_stmt,
  4999. unsigned int subcode)
  5000. {
  5001. transaction_stmt->subcode = subcode;
  5002. }
  5003. /* Return a pointer to the return value for GIMPLE_RETURN GS. */
  5004. static inline tree *
  5005. gimple_return_retval_ptr (greturn *gs)
  5006. {
  5007. return &gs->op[0];
  5008. }
  5009. /* Return the return value for GIMPLE_RETURN GS. */
  5010. static inline tree
  5011. gimple_return_retval (const greturn *gs)
  5012. {
  5013. return gs->op[0];
  5014. }
  5015. /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
  5016. static inline void
  5017. gimple_return_set_retval (greturn *gs, tree retval)
  5018. {
  5019. gs->op[0] = retval;
  5020. }
  5021. /* Returns true when the gimple statement STMT is any of the OMP types. */
  5022. #define CASE_GIMPLE_OMP \
  5023. case GIMPLE_OMP_PARALLEL: \
  5024. case GIMPLE_OMP_TASK: \
  5025. case GIMPLE_OMP_FOR: \
  5026. case GIMPLE_OMP_SECTIONS: \
  5027. case GIMPLE_OMP_SECTIONS_SWITCH: \
  5028. case GIMPLE_OMP_SINGLE: \
  5029. case GIMPLE_OMP_TARGET: \
  5030. case GIMPLE_OMP_TEAMS: \
  5031. case GIMPLE_OMP_SECTION: \
  5032. case GIMPLE_OMP_MASTER: \
  5033. case GIMPLE_OMP_TASKGROUP: \
  5034. case GIMPLE_OMP_ORDERED: \
  5035. case GIMPLE_OMP_CRITICAL: \
  5036. case GIMPLE_OMP_SCAN: \
  5037. case GIMPLE_OMP_RETURN: \
  5038. case GIMPLE_OMP_ATOMIC_LOAD: \
  5039. case GIMPLE_OMP_ATOMIC_STORE: \
  5040. case GIMPLE_OMP_CONTINUE: \
  5041. case GIMPLE_OMP_GRID_BODY
  5042. static inline bool
  5043. is_gimple_omp (const gimple *stmt)
  5044. {
  5045. switch (gimple_code (stmt))
  5046. {
  5047. CASE_GIMPLE_OMP:
  5048. return true;
  5049. default:
  5050. return false;
  5051. }
  5052. }
  5053. /* Return true if the OMP gimple statement STMT is any of the OpenACC types
  5054. specifically. */
  5055. static inline bool
  5056. is_gimple_omp_oacc (const gimple *stmt)
  5057. {
  5058. gcc_assert (is_gimple_omp (stmt));
  5059. switch (gimple_code (stmt))
  5060. {
  5061. case GIMPLE_OMP_FOR:
  5062. switch (gimple_omp_for_kind (stmt))
  5063. {
  5064. case GF_OMP_FOR_KIND_OACC_LOOP:
  5065. return true;
  5066. default:
  5067. return false;
  5068. }
  5069. case GIMPLE_OMP_TARGET:
  5070. switch (gimple_omp_target_kind (stmt))
  5071. {
  5072. case GF_OMP_TARGET_KIND_OACC_PARALLEL:
  5073. case GF_OMP_TARGET_KIND_OACC_KERNELS:
  5074. case GF_OMP_TARGET_KIND_OACC_SERIAL:
  5075. case GF_OMP_TARGET_KIND_OACC_DATA:
  5076. case GF_OMP_TARGET_KIND_OACC_UPDATE:
  5077. case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
  5078. case GF_OMP_TARGET_KIND_OACC_DECLARE:
  5079. case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
  5080. return true;
  5081. default:
  5082. return false;
  5083. }
  5084. default:
  5085. return false;
  5086. }
  5087. }
  5088. /* Return true if the OMP gimple statement STMT is offloaded. */
  5089. static inline bool
  5090. is_gimple_omp_offloaded (const gimple *stmt)
  5091. {
  5092. gcc_assert (is_gimple_omp (stmt));
  5093. switch (gimple_code (stmt))
  5094. {
  5095. case GIMPLE_OMP_TARGET:
  5096. switch (gimple_omp_target_kind (stmt))
  5097. {
  5098. case GF_OMP_TARGET_KIND_REGION:
  5099. case GF_OMP_TARGET_KIND_OACC_PARALLEL:
  5100. case GF_OMP_TARGET_KIND_OACC_KERNELS:
  5101. case GF_OMP_TARGET_KIND_OACC_SERIAL:
  5102. return true;
  5103. default:
  5104. return false;
  5105. }
  5106. default:
  5107. return false;
  5108. }
  5109. }
  5110. /* Returns TRUE if statement G is a GIMPLE_NOP. */
  5111. static inline bool
  5112. gimple_nop_p (const gimple *g)
  5113. {
  5114. return gimple_code (g) == GIMPLE_NOP;
  5115. }
  5116. /* Return true if GS is a GIMPLE_RESX. */
  5117. static inline bool
  5118. is_gimple_resx (const gimple *gs)
  5119. {
  5120. return gimple_code (gs) == GIMPLE_RESX;
  5121. }
  5122. /* Return the type of the main expression computed by STMT. Return
  5123. void_type_node if the statement computes nothing. */
  5124. static inline tree
  5125. gimple_expr_type (const gimple *stmt)
  5126. {
  5127. enum gimple_code code = gimple_code (stmt);
  5128. /* In general we want to pass out a type that can be substituted
  5129. for both the RHS and the LHS types if there is a possibly
  5130. useless conversion involved. That means returning the
  5131. original RHS type as far as we can reconstruct it. */
  5132. if (code == GIMPLE_CALL)
  5133. {
  5134. const gcall *call_stmt = as_a <const gcall *> (stmt);
  5135. if (gimple_call_internal_p (call_stmt))
  5136. switch (gimple_call_internal_fn (call_stmt))
  5137. {
  5138. case IFN_MASK_STORE:
  5139. case IFN_SCATTER_STORE:
  5140. return TREE_TYPE (gimple_call_arg (call_stmt, 3));
  5141. case IFN_MASK_SCATTER_STORE:
  5142. return TREE_TYPE (gimple_call_arg (call_stmt, 4));
  5143. default:
  5144. break;
  5145. }
  5146. return gimple_call_return_type (call_stmt);
  5147. }
  5148. else if (code == GIMPLE_ASSIGN)
  5149. {
  5150. if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
  5151. return TREE_TYPE (gimple_assign_rhs1 (stmt));
  5152. else
  5153. /* As fallback use the type of the LHS. */
  5154. return TREE_TYPE (gimple_get_lhs (stmt));
  5155. }
  5156. else if (code == GIMPLE_COND)
  5157. return boolean_type_node;
  5158. else
  5159. return void_type_node;
  5160. }
  5161. /* Enum and arrays used for allocation stats. Keep in sync with
  5162. gimple.c:gimple_alloc_kind_names. */
  5163. enum gimple_alloc_kind
  5164. {
  5165. gimple_alloc_kind_assign, /* Assignments. */
  5166. gimple_alloc_kind_phi, /* PHI nodes. */
  5167. gimple_alloc_kind_cond, /* Conditionals. */
  5168. gimple_alloc_kind_rest, /* Everything else. */
  5169. gimple_alloc_kind_all
  5170. };
  5171. extern uint64_t gimple_alloc_counts[];
  5172. extern uint64_t gimple_alloc_sizes[];
  5173. /* Return the allocation kind for a given stmt CODE. */
  5174. static inline enum gimple_alloc_kind
  5175. gimple_alloc_kind (enum gimple_code code)
  5176. {
  5177. switch (code)
  5178. {
  5179. case GIMPLE_ASSIGN:
  5180. return gimple_alloc_kind_assign;
  5181. case GIMPLE_PHI:
  5182. return gimple_alloc_kind_phi;
  5183. case GIMPLE_COND:
  5184. return gimple_alloc_kind_cond;
  5185. default:
  5186. return gimple_alloc_kind_rest;
  5187. }
  5188. }
  5189. /* Return true if a location should not be emitted for this statement
  5190. by annotate_all_with_location. */
  5191. static inline bool
  5192. gimple_do_not_emit_location_p (gimple *g)
  5193. {
  5194. return gimple_plf (g, GF_PLF_1);
  5195. }
  5196. /* Mark statement G so a location will not be emitted by
  5197. annotate_one_with_location. */
  5198. static inline void
  5199. gimple_set_do_not_emit_location (gimple *g)
  5200. {
  5201. /* The PLF flags are initialized to 0 when a new tuple is created,
  5202. so no need to initialize it anywhere. */
  5203. gimple_set_plf (g, GF_PLF_1, true);
  5204. }
  5205. #endif /* GCC_GIMPLE_H */