comparison gcc/gimple.h @ 146:351920fa3827

merge
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 01 Mar 2020 16:13:28 +0900
parents d34655255c78 1830386684a0
children
comparison
equal deleted inserted replaced
144:8f4e72ab4e11 146:351920fa3827
1 /* Gimple IR definitions. 1 /* Gimple IR definitions.
2 2
3 Copyright (C) 2007-2018 Free Software Foundation, Inc. 3 Copyright (C) 2007-2020 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com> 4 Contributed by Aldy Hernandez <aldyh@redhat.com>
5 5
6 This file is part of GCC. 6 This file is part of GCC.
7 7
8 GCC is free software; you can redistribute it and/or modify it under 8 GCC is free software; you can redistribute it and/or modify it under
135 135
136 Keep this list sorted. */ 136 Keep this list sorted. */
137 enum gf_mask { 137 enum gf_mask {
138 GF_ASM_INPUT = 1 << 0, 138 GF_ASM_INPUT = 1 << 0,
139 GF_ASM_VOLATILE = 1 << 1, 139 GF_ASM_VOLATILE = 1 << 1,
140 GF_ASM_INLINE = 1 << 2,
140 GF_CALL_FROM_THUNK = 1 << 0, 141 GF_CALL_FROM_THUNK = 1 << 0,
141 GF_CALL_RETURN_SLOT_OPT = 1 << 1, 142 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
142 GF_CALL_TAILCALL = 1 << 2, 143 GF_CALL_TAILCALL = 1 << 2,
143 GF_CALL_VA_ARG_PACK = 1 << 3, 144 GF_CALL_VA_ARG_PACK = 1 << 3,
144 GF_CALL_NOTHROW = 1 << 4, 145 GF_CALL_NOTHROW = 1 << 4,
152 GF_CALL_CBC_GOTO = 1 << 5, 153 GF_CALL_CBC_GOTO = 1 << 5,
153 #endif 154 #endif
154 GF_OMP_PARALLEL_COMBINED = 1 << 0, 155 GF_OMP_PARALLEL_COMBINED = 1 << 0,
155 GF_OMP_PARALLEL_GRID_PHONY = 1 << 1, 156 GF_OMP_PARALLEL_GRID_PHONY = 1 << 1,
156 GF_OMP_TASK_TASKLOOP = 1 << 0, 157 GF_OMP_TASK_TASKLOOP = 1 << 0,
157 GF_OMP_FOR_KIND_MASK = (1 << 4) - 1, 158 GF_OMP_TASK_TASKWAIT = 1 << 1,
159 GF_OMP_FOR_KIND_MASK = (1 << 3) - 1,
158 GF_OMP_FOR_KIND_FOR = 0, 160 GF_OMP_FOR_KIND_FOR = 0,
159 GF_OMP_FOR_KIND_DISTRIBUTE = 1, 161 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
160 GF_OMP_FOR_KIND_TASKLOOP = 2, 162 GF_OMP_FOR_KIND_TASKLOOP = 2,
161 GF_OMP_FOR_KIND_OACC_LOOP = 4, 163 GF_OMP_FOR_KIND_OACC_LOOP = 4,
162 GF_OMP_FOR_KIND_GRID_LOOP = 5, 164 GF_OMP_FOR_KIND_GRID_LOOP = 5,
163 /* Flag for SIMD variants of OMP_FOR kinds. */ 165 GF_OMP_FOR_KIND_SIMD = 6,
164 GF_OMP_FOR_SIMD = 1 << 3, 166 GF_OMP_FOR_COMBINED = 1 << 3,
165 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0, 167 GF_OMP_FOR_COMBINED_INTO = 1 << 4,
166 GF_OMP_FOR_COMBINED = 1 << 4,
167 GF_OMP_FOR_COMBINED_INTO = 1 << 5,
168 /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop 168 /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop
169 statements. */ 169 statements. */
170 GF_OMP_FOR_GRID_PHONY = 1 << 6, 170 GF_OMP_FOR_GRID_PHONY = 1 << 5,
171 /* The following two flags should only be set on GF_OMP_FOR_KIND_GRID_LOOP 171 /* The following two flags should only be set on GF_OMP_FOR_KIND_GRID_LOOP
172 loop statements. */ 172 loop statements. */
173 GF_OMP_FOR_GRID_INTRA_GROUP = 1 << 6, 173 GF_OMP_FOR_GRID_INTRA_GROUP = 1 << 5,
174 GF_OMP_FOR_GRID_GROUP_ITER = 1 << 7, 174 GF_OMP_FOR_GRID_GROUP_ITER = 1 << 6,
175 GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1, 175 GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1,
176 GF_OMP_TARGET_KIND_REGION = 0, 176 GF_OMP_TARGET_KIND_REGION = 0,
177 GF_OMP_TARGET_KIND_DATA = 1, 177 GF_OMP_TARGET_KIND_DATA = 1,
178 GF_OMP_TARGET_KIND_UPDATE = 2, 178 GF_OMP_TARGET_KIND_UPDATE = 2,
179 GF_OMP_TARGET_KIND_ENTER_DATA = 3, 179 GF_OMP_TARGET_KIND_ENTER_DATA = 3,
180 GF_OMP_TARGET_KIND_EXIT_DATA = 4, 180 GF_OMP_TARGET_KIND_EXIT_DATA = 4,
181 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5, 181 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
182 GF_OMP_TARGET_KIND_OACC_KERNELS = 6, 182 GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
183 GF_OMP_TARGET_KIND_OACC_DATA = 7, 183 GF_OMP_TARGET_KIND_OACC_SERIAL = 7,
184 GF_OMP_TARGET_KIND_OACC_UPDATE = 8, 184 GF_OMP_TARGET_KIND_OACC_DATA = 8,
185 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 9, 185 GF_OMP_TARGET_KIND_OACC_UPDATE = 9,
186 GF_OMP_TARGET_KIND_OACC_DECLARE = 10, 186 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 10,
187 GF_OMP_TARGET_KIND_OACC_HOST_DATA = 11, 187 GF_OMP_TARGET_KIND_OACC_DECLARE = 11,
188 GF_OMP_TARGET_KIND_OACC_HOST_DATA = 12,
188 GF_OMP_TEAMS_GRID_PHONY = 1 << 0, 189 GF_OMP_TEAMS_GRID_PHONY = 1 << 0,
190 GF_OMP_TEAMS_HOST = 1 << 1,
189 191
190 /* True on an GIMPLE_OMP_RETURN statement if the return does not require 192 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
191 a thread synchronization via some sort of barrier. The exact barrier 193 a thread synchronization via some sort of barrier. The exact barrier
192 that would otherwise be emitted is dependent on the OMP statement with 194 that would otherwise be emitted is dependent on the OMP statement with
193 which this return is associated. */ 195 which this return is associated. */
194 GF_OMP_RETURN_NOWAIT = 1 << 0, 196 GF_OMP_RETURN_NOWAIT = 1 << 0,
195 197
196 GF_OMP_SECTION_LAST = 1 << 0, 198 GF_OMP_SECTION_LAST = 1 << 0,
197 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0, 199 GF_OMP_ATOMIC_MEMORY_ORDER = (1 << 3) - 1,
198 GF_OMP_ATOMIC_SEQ_CST = 1 << 1, 200 GF_OMP_ATOMIC_NEED_VALUE = 1 << 3,
199 GF_PREDICT_TAKEN = 1 << 15 201 GF_PREDICT_TAKEN = 1 << 15
200 }; 202 };
201 203
202 /* This subcode tells apart different kinds of stmts that are not used 204 /* This subcode tells apart different kinds of stmts that are not used
203 for codegen, but rather to retain debug information. */ 205 for codegen, but rather to retain debug information. */
638 Pre-body evaluated before the loop body begins. */ 640 Pre-body evaluated before the loop body begins. */
639 gimple_seq pre_body; 641 gimple_seq pre_body;
640 }; 642 };
641 643
642 644
643 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */ 645 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */
644 646
645 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) 647 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
646 gimple_statement_omp_parallel_layout : public gimple_statement_omp 648 gimple_statement_omp_parallel_layout : public gimple_statement_omp
647 { 649 {
648 /* [ WORD 1-7 ] : base class */ 650 /* [ WORD 1-7 ] : base class */
664 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) 666 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
665 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout 667 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
666 { 668 {
667 /* No extra fields; adds invariant: 669 /* No extra fields; adds invariant:
668 stmt->code == GIMPLE_OMP_PARALLEL 670 stmt->code == GIMPLE_OMP_PARALLEL
669 || stmt->code == GIMPLE_OMP_TASK. */ 671 || stmt->code == GIMPLE_OMP_TASK
672 || stmt->code == GIMPLE_OMP_TEAMS. */
670 }; 673 };
671 674
672 /* GIMPLE_OMP_PARALLEL */ 675 /* GIMPLE_OMP_PARALLEL */
673 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) 676 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
674 gomp_parallel : public gimple_statement_omp_taskreg 677 gomp_parallel : public gimple_statement_omp_taskreg
738 741
739 /* [ WORD 8 ] */ 742 /* [ WORD 8 ] */
740 tree control_use; 743 tree control_use;
741 }; 744 };
742 745
743 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS, GIMPLE_OMP_ORDERED */ 746 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP,
747 GIMPLE_OMP_SCAN. */
744 748
745 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) 749 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
746 gimple_statement_omp_single_layout : public gimple_statement_omp 750 gimple_statement_omp_single_layout : public gimple_statement_omp
747 { 751 {
748 /* [ WORD 1-7 ] : base class */ 752 /* [ WORD 1-7 ] : base class */
756 { 760 {
757 /* No extra fields; adds invariant: 761 /* No extra fields; adds invariant:
758 stmt->code == GIMPLE_OMP_SINGLE. */ 762 stmt->code == GIMPLE_OMP_SINGLE. */
759 }; 763 };
760 764
761 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) 765 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
762 gomp_teams : public gimple_statement_omp_single_layout 766 gomp_teams : public gimple_statement_omp_taskreg
763 { 767 {
764 /* No extra fields; adds invariant: 768 /* No extra fields; adds invariant:
765 stmt->code == GIMPLE_OMP_TEAMS. */ 769 stmt->code == GIMPLE_OMP_TEAMS. */
766 }; 770 };
767 771
768 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) 772 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
769 gomp_ordered : public gimple_statement_omp_single_layout 773 gomp_ordered : public gimple_statement_omp_single_layout
770 { 774 {
771 /* No extra fields; adds invariant: 775 /* No extra fields; adds invariant:
772 stmt->code == GIMPLE_OMP_ORDERED. */ 776 stmt->code == GIMPLE_OMP_ORDERED. */
777 };
778
779 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
780 gomp_scan : public gimple_statement_omp_single_layout
781 {
782 /* No extra fields; adds invariant:
783 stmt->code == GIMPLE_OMP_SCAN. */
773 }; 784 };
774 785
775 786
776 /* GIMPLE_OMP_ATOMIC_LOAD. 787 /* GIMPLE_OMP_ATOMIC_LOAD.
777 Note: This is based on gimple, not g_s_omp, because g_s_omp 788 Note: This is based on gimple, not g_s_omp, because g_s_omp
1008 } 1019 }
1009 1020
1010 template <> 1021 template <>
1011 template <> 1022 template <>
1012 inline bool 1023 inline bool
1024 is_a_helper <const gdebug *>::test (const gimple *gs)
1025 {
1026 return gs->code == GIMPLE_DEBUG;
1027 }
1028
1029 template <>
1030 template <>
1031 inline bool
1013 is_a_helper <ggoto *>::test (gimple *gs) 1032 is_a_helper <ggoto *>::test (gimple *gs)
1014 { 1033 {
1015 return gs->code == GIMPLE_GOTO; 1034 return gs->code == GIMPLE_GOTO;
1016 } 1035 }
1017 1036
1018 template <> 1037 template <>
1019 template <> 1038 template <>
1020 inline bool 1039 inline bool
1040 is_a_helper <const ggoto *>::test (const gimple *gs)
1041 {
1042 return gs->code == GIMPLE_GOTO;
1043 }
1044
1045 template <>
1046 template <>
1047 inline bool
1021 is_a_helper <glabel *>::test (gimple *gs) 1048 is_a_helper <glabel *>::test (gimple *gs)
1022 { 1049 {
1023 return gs->code == GIMPLE_LABEL; 1050 return gs->code == GIMPLE_LABEL;
1024 } 1051 }
1025 1052
1026 template <> 1053 template <>
1027 template <> 1054 template <>
1028 inline bool 1055 inline bool
1056 is_a_helper <const glabel *>::test (const gimple *gs)
1057 {
1058 return gs->code == GIMPLE_LABEL;
1059 }
1060
1061 template <>
1062 template <>
1063 inline bool
1029 is_a_helper <gresx *>::test (gimple *gs) 1064 is_a_helper <gresx *>::test (gimple *gs)
1030 { 1065 {
1031 return gs->code == GIMPLE_RESX; 1066 return gs->code == GIMPLE_RESX;
1032 } 1067 }
1033 1068
1048 } 1083 }
1049 1084
1050 template <> 1085 template <>
1051 template <> 1086 template <>
1052 inline bool 1087 inline bool
1088 is_a_helper <const geh_else *>::test (const gimple *gs)
1089 {
1090 return gs->code == GIMPLE_EH_ELSE;
1091 }
1092
1093 template <>
1094 template <>
1095 inline bool
1053 is_a_helper <geh_filter *>::test (gimple *gs) 1096 is_a_helper <geh_filter *>::test (gimple *gs)
1054 { 1097 {
1055 return gs->code == GIMPLE_EH_FILTER; 1098 return gs->code == GIMPLE_EH_FILTER;
1056 } 1099 }
1057 1100
1064 } 1107 }
1065 1108
1066 template <> 1109 template <>
1067 template <> 1110 template <>
1068 inline bool 1111 inline bool
1112 is_a_helper <const geh_mnt *>::test (const gimple *gs)
1113 {
1114 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1115 }
1116
1117 template <>
1118 template <>
1119 inline bool
1069 is_a_helper <gomp_atomic_load *>::test (gimple *gs) 1120 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1070 { 1121 {
1071 return gs->code == GIMPLE_OMP_ATOMIC_LOAD; 1122 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1072 } 1123 }
1073 1124
1112 } 1163 }
1113 1164
1114 template <> 1165 template <>
1115 template <> 1166 template <>
1116 inline bool 1167 inline bool
1168 is_a_helper <gomp_scan *>::test (gimple *gs)
1169 {
1170 return gs->code == GIMPLE_OMP_SCAN;
1171 }
1172
1173 template <>
1174 template <>
1175 inline bool
1117 is_a_helper <gomp_for *>::test (gimple *gs) 1176 is_a_helper <gomp_for *>::test (gimple *gs)
1118 { 1177 {
1119 return gs->code == GIMPLE_OMP_FOR; 1178 return gs->code == GIMPLE_OMP_FOR;
1120 } 1179 }
1121 1180
1122 template <> 1181 template <>
1123 template <> 1182 template <>
1124 inline bool 1183 inline bool
1125 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs) 1184 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1126 { 1185 {
1127 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK; 1186 return (gs->code == GIMPLE_OMP_PARALLEL
1187 || gs->code == GIMPLE_OMP_TASK
1188 || gs->code == GIMPLE_OMP_TEAMS);
1128 } 1189 }
1129 1190
1130 template <> 1191 template <>
1131 template <> 1192 template <>
1132 inline bool 1193 inline bool
1200 } 1261 }
1201 1262
1202 template <> 1263 template <>
1203 template <> 1264 template <>
1204 inline bool 1265 inline bool
1266 is_a_helper <const gswitch *>::test (const gimple *gs)
1267 {
1268 return gs->code == GIMPLE_SWITCH;
1269 }
1270
1271 template <>
1272 template <>
1273 inline bool
1205 is_a_helper <gtransaction *>::test (gimple *gs) 1274 is_a_helper <gtransaction *>::test (gimple *gs)
1206 { 1275 {
1207 return gs->code == GIMPLE_TRANSACTION; 1276 return gs->code == GIMPLE_TRANSACTION;
1208 } 1277 }
1209 1278
1216 } 1285 }
1217 1286
1218 template <> 1287 template <>
1219 template <> 1288 template <>
1220 inline bool 1289 inline bool
1290 is_a_helper <const gtry *>::test (const gimple *gs)
1291 {
1292 return gs->code == GIMPLE_TRY;
1293 }
1294
1295 template <>
1296 template <>
1297 inline bool
1221 is_a_helper <gimple_statement_wce *>::test (gimple *gs) 1298 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1222 { 1299 {
1223 return gs->code == GIMPLE_WITH_CLEANUP_EXPR; 1300 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1224 } 1301 }
1225 1302
1328 } 1405 }
1329 1406
1330 template <> 1407 template <>
1331 template <> 1408 template <>
1332 inline bool 1409 inline bool
1410 is_a_helper <const gomp_scan *>::test (const gimple *gs)
1411 {
1412 return gs->code == GIMPLE_OMP_SCAN;
1413 }
1414
1415 template <>
1416 template <>
1417 inline bool
1333 is_a_helper <const gomp_for *>::test (const gimple *gs) 1418 is_a_helper <const gomp_for *>::test (const gimple *gs)
1334 { 1419 {
1335 return gs->code == GIMPLE_OMP_FOR; 1420 return gs->code == GIMPLE_OMP_FOR;
1336 } 1421 }
1337 1422
1338 template <> 1423 template <>
1339 template <> 1424 template <>
1340 inline bool 1425 inline bool
1341 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs) 1426 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1342 { 1427 {
1343 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK; 1428 return (gs->code == GIMPLE_OMP_PARALLEL
1429 || gs->code == GIMPLE_OMP_TASK
1430 || gs->code == GIMPLE_OMP_TEAMS);
1344 } 1431 }
1345 1432
1346 template <> 1433 template <>
1347 template <> 1434 template <>
1348 inline bool 1435 inline bool
1395 template <> 1482 template <>
1396 inline bool 1483 inline bool
1397 is_a_helper <const gphi *>::test (const gimple *gs) 1484 is_a_helper <const gphi *>::test (const gimple *gs)
1398 { 1485 {
1399 return gs->code == GIMPLE_PHI; 1486 return gs->code == GIMPLE_PHI;
1487 }
1488
1489 template <>
1490 template <>
1491 inline bool
1492 is_a_helper <const greturn *>::test (const gimple *gs)
1493 {
1494 return gs->code == GIMPLE_RETURN;
1400 } 1495 }
1401 1496
1402 template <> 1497 template <>
1403 template <> 1498 template <>
1404 inline bool 1499 inline bool
1416 1511
1417 /* This variable holds the currently expanded gimple statement for purposes 1512 /* This variable holds the currently expanded gimple statement for purposes
1418 of comminucating the profile info to the builtin expanders. */ 1513 of comminucating the profile info to the builtin expanders. */
1419 extern gimple *currently_expanding_gimple_stmt; 1514 extern gimple *currently_expanding_gimple_stmt;
1420 1515
1516 size_t gimple_size (enum gimple_code code, unsigned num_ops = 0);
1517 void gimple_init (gimple *g, enum gimple_code code, unsigned num_ops);
1421 gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO); 1518 gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
1422 greturn *gimple_build_return (tree); 1519 greturn *gimple_build_return (tree);
1423 void gimple_call_reset_alias_info (gcall *); 1520 void gimple_call_reset_alias_info (gcall *);
1424 gcall *gimple_build_call_vec (tree, vec<tree> ); 1521 gcall *gimple_build_call_vec (tree, vec<tree> );
1425 gcall *gimple_build_call (tree, unsigned, ...); 1522 gcall *gimple_build_call (tree, unsigned, ...);
1464 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, 1561 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1465 tree, tree); 1562 tree, tree);
1466 gimple *gimple_build_omp_section (gimple_seq); 1563 gimple *gimple_build_omp_section (gimple_seq);
1467 gimple *gimple_build_omp_master (gimple_seq); 1564 gimple *gimple_build_omp_master (gimple_seq);
1468 gimple *gimple_build_omp_grid_body (gimple_seq); 1565 gimple *gimple_build_omp_grid_body (gimple_seq);
1469 gimple *gimple_build_omp_taskgroup (gimple_seq); 1566 gimple *gimple_build_omp_taskgroup (gimple_seq, tree);
1470 gomp_continue *gimple_build_omp_continue (tree, tree); 1567 gomp_continue *gimple_build_omp_continue (tree, tree);
1471 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree); 1568 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1472 gimple *gimple_build_omp_return (bool); 1569 gimple *gimple_build_omp_return (bool);
1570 gomp_scan *gimple_build_omp_scan (gimple_seq, tree);
1473 gomp_sections *gimple_build_omp_sections (gimple_seq, tree); 1571 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1474 gimple *gimple_build_omp_sections_switch (void); 1572 gimple *gimple_build_omp_sections_switch (void);
1475 gomp_single *gimple_build_omp_single (gimple_seq, tree); 1573 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1476 gomp_target *gimple_build_omp_target (gimple_seq, int, tree); 1574 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1477 gomp_teams *gimple_build_omp_teams (gimple_seq, tree); 1575 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1478 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree); 1576 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree,
1479 gomp_atomic_store *gimple_build_omp_atomic_store (tree); 1577 enum omp_memory_order);
1578 gomp_atomic_store *gimple_build_omp_atomic_store (tree, enum omp_memory_order);
1480 gtransaction *gimple_build_transaction (gimple_seq); 1579 gtransaction *gimple_build_transaction (gimple_seq);
1481 extern void gimple_seq_add_stmt (gimple_seq *, gimple *); 1580 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1482 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *); 1581 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1483 void gimple_seq_add_seq (gimple_seq *, gimple_seq); 1582 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1484 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq); 1583 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1501 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code, 1600 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1502 tree, tree, tree); 1601 tree, tree, tree);
1503 tree gimple_get_lhs (const gimple *); 1602 tree gimple_get_lhs (const gimple *);
1504 void gimple_set_lhs (gimple *, tree); 1603 void gimple_set_lhs (gimple *, tree);
1505 gimple *gimple_copy (gimple *); 1604 gimple *gimple_copy (gimple *);
1605 void gimple_move_vops (gimple *, gimple *);
1506 bool gimple_has_side_effects (const gimple *); 1606 bool gimple_has_side_effects (const gimple *);
1507 bool gimple_could_trap_p_1 (gimple *, bool, bool); 1607 bool gimple_could_trap_p_1 (gimple *, bool, bool);
1508 bool gimple_could_trap_p (gimple *); 1608 bool gimple_could_trap_p (gimple *);
1509 bool gimple_assign_rhs_could_trap_p (gimple *); 1609 bool gimple_assign_rhs_could_trap_p (gimple *);
1510 extern void dump_gimple_statistics (void); 1610 extern void dump_gimple_statistics (void);
1516 extern tree gimple_signed_type (tree); 1616 extern tree gimple_signed_type (tree);
1517 extern alias_set_type gimple_get_alias_set (tree); 1617 extern alias_set_type gimple_get_alias_set (tree);
1518 extern bool gimple_ior_addresses_taken (bitmap, gimple *); 1618 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1519 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree); 1619 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1520 extern combined_fn gimple_call_combined_fn (const gimple *); 1620 extern combined_fn gimple_call_combined_fn (const gimple *);
1621 extern bool gimple_call_operator_delete_p (const gcall *);
1521 extern bool gimple_call_builtin_p (const gimple *); 1622 extern bool gimple_call_builtin_p (const gimple *);
1522 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class); 1623 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1523 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function); 1624 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1524 extern bool gimple_asm_clobbers_memory_p (const gasm *); 1625 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1525 extern void dump_decl_set (FILE *, bitmap); 1626 extern void dump_decl_set (FILE *, bitmap);
2194 2295
2195 static inline unsigned 2296 static inline unsigned
2196 gimple_omp_subcode (const gimple *s) 2297 gimple_omp_subcode (const gimple *s)
2197 { 2298 {
2198 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD 2299 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2199 && gimple_code (s) <= GIMPLE_OMP_TEAMS); 2300 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2200 return s->subcode; 2301 return s->subcode;
2201 } 2302 }
2202 2303
2203 /* Set the subcode for OMP statement S to SUBCODE. */ 2304 /* Set the subcode for OMP statement S to SUBCODE. */
2204 2305
2332 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); 2433 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2333 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE; 2434 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2334 } 2435 }
2335 2436
2336 2437
2337 /* Return true if OMP atomic load/store statement G has the 2438 /* Return the memory order of the OMP atomic load/store statement G. */
2338 GF_OMP_ATOMIC_SEQ_CST flag set. */ 2439
2339 2440 static inline enum omp_memory_order
2340 static inline bool 2441 gimple_omp_atomic_memory_order (const gimple *g)
2341 gimple_omp_atomic_seq_cst_p (const gimple *g)
2342 { 2442 {
2343 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) 2443 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2344 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); 2444 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2345 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0; 2445 return (enum omp_memory_order)
2346 } 2446 (gimple_omp_subcode (g) & GF_OMP_ATOMIC_MEMORY_ORDER);
2347 2447 }
2348 2448
2349 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */ 2449
2350 2450 /* Set the memory order on G. */
2351 static inline void 2451
2352 gimple_omp_atomic_set_seq_cst (gimple *g) 2452 static inline void
2453 gimple_omp_atomic_set_memory_order (gimple *g, enum omp_memory_order mo)
2353 { 2454 {
2354 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) 2455 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2355 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); 2456 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2356 g->subcode |= GF_OMP_ATOMIC_SEQ_CST; 2457 g->subcode = ((g->subcode & ~GF_OMP_ATOMIC_MEMORY_ORDER)
2458 | (mo & GF_OMP_ATOMIC_MEMORY_ORDER));
2357 } 2459 }
2358 2460
2359 2461
2360 /* Return the number of operands for statement GS. */ 2462 /* Return the number of operands for statement GS. */
2361 2463
3233 #endif 3335 #endif
3234 3336
3235 /* Return true if GIMPLE_CALL S is marked as a tail call. */ 3337 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3236 3338
3237 static inline bool 3339 static inline bool
3238 gimple_call_tail_p (gcall *s) 3340 gimple_call_tail_p (const gcall *s)
3239 { 3341 {
3240 return (s->subcode & GF_CALL_TAILCALL) != 0; 3342 return (s->subcode & GF_CALL_TAILCALL) != 0;
3241 } 3343 }
3242 3344
3243 /* Mark (or clear) call statement S as requiring tail call optimization. */ 3345 /* Mark (or clear) call statement S as requiring tail call optimization. */
3286 3388
3287 3389
3288 /* Return true if S is marked for return slot optimization. */ 3390 /* Return true if S is marked for return slot optimization. */
3289 3391
3290 static inline bool 3392 static inline bool
3291 gimple_call_return_slot_opt_p (gcall *s) 3393 gimple_call_return_slot_opt_p (const gcall *s)
3292 { 3394 {
3293 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0; 3395 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3294 } 3396 }
3295 3397
3296 3398
3331 3433
3332 /* Return true if GIMPLE_CALL S is a stdarg call that needs the 3434 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3333 argument pack in its argument list. */ 3435 argument pack in its argument list. */
3334 3436
3335 static inline bool 3437 static inline bool
3336 gimple_call_va_arg_pack_p (gcall *s) 3438 gimple_call_va_arg_pack_p (const gcall *s)
3337 { 3439 {
3338 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0; 3440 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3339 } 3441 }
3340 3442
3341 3443
3433 gimple_call_use_set (gcall *call_stmt) 3535 gimple_call_use_set (gcall *call_stmt)
3434 { 3536 {
3435 return &call_stmt->call_used; 3537 return &call_stmt->call_used;
3436 } 3538 }
3437 3539
3540 /* As above, but const. */
3541
3542 static inline const pt_solution *
3543 gimple_call_use_set (const gcall *call_stmt)
3544 {
3545 return &call_stmt->call_used;
3546 }
3438 3547
3439 /* Return a pointer to the points-to solution for the set of call-used 3548 /* Return a pointer to the points-to solution for the set of call-used
3440 variables of the call CALL_STMT. */ 3549 variables of the call CALL_STMT. */
3441 3550
3442 static inline struct pt_solution * 3551 static inline struct pt_solution *
3443 gimple_call_clobber_set (gcall *call_stmt) 3552 gimple_call_clobber_set (gcall *call_stmt)
3444 { 3553 {
3445 return &call_stmt->call_clobbered; 3554 return &call_stmt->call_clobbered;
3446 } 3555 }
3447 3556
3557 /* As above, but const. */
3558
3559 static inline const pt_solution *
3560 gimple_call_clobber_set (const gcall *call_stmt)
3561 {
3562 return &call_stmt->call_clobbered;
3563 }
3564
3448 3565
3449 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a 3566 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3450 non-NULL lhs. */ 3567 non-NULL lhs. */
3451 3568
3452 static inline bool 3569 static inline bool
3453 gimple_has_lhs (gimple *stmt) 3570 gimple_has_lhs (const gimple *stmt)
3454 { 3571 {
3455 if (is_gimple_assign (stmt)) 3572 if (is_gimple_assign (stmt))
3456 return true; 3573 return true;
3457 if (gcall *call = dyn_cast <gcall *> (stmt)) 3574 if (const gcall *call = dyn_cast <const gcall *> (stmt))
3458 return gimple_call_lhs (call) != NULL_TREE; 3575 return gimple_call_lhs (call) != NULL_TREE;
3459 return false; 3576 return false;
3460 } 3577 }
3461 3578
3462 3579
3750 } 3867 }
3751 3868
3752 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */ 3869 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3753 3870
3754 static inline gimple_seq 3871 static inline gimple_seq
3755 gimple_bind_body (gbind *gs) 3872 gimple_bind_body (const gbind *gs)
3756 { 3873 {
3757 return *gimple_bind_body_ptr (gs); 3874 return *gimple_bind_body_ptr (const_cast <gbind *> (gs));
3758 } 3875 }
3759 3876
3760 3877
3761 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND 3878 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3762 statement GS. */ 3879 statement GS. */
3929 { 4046 {
3930 return asm_stmt->string; 4047 return asm_stmt->string;
3931 } 4048 }
3932 4049
3933 4050
3934 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */ 4051 /* Return true if ASM_STMT is marked volatile. */
3935 4052
3936 static inline bool 4053 static inline bool
3937 gimple_asm_volatile_p (const gasm *asm_stmt) 4054 gimple_asm_volatile_p (const gasm *asm_stmt)
3938 { 4055 {
3939 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0; 4056 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3940 } 4057 }
3941 4058
3942 4059
3943 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */ 4060 /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
3944 4061
3945 static inline void 4062 static inline void
3946 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p) 4063 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3947 { 4064 {
3948 if (volatile_p) 4065 if (volatile_p)
3950 else 4067 else
3951 asm_stmt->subcode &= ~GF_ASM_VOLATILE; 4068 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3952 } 4069 }
3953 4070
3954 4071
4072 /* Return true if ASM_STMT is marked inline. */
4073
4074 static inline bool
4075 gimple_asm_inline_p (const gasm *asm_stmt)
4076 {
4077 return (asm_stmt->subcode & GF_ASM_INLINE) != 0;
4078 }
4079
4080
4081 /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
4082
4083 static inline void
4084 gimple_asm_set_inline (gasm *asm_stmt, bool inline_p)
4085 {
4086 if (inline_p)
4087 asm_stmt->subcode |= GF_ASM_INLINE;
4088 else
4089 asm_stmt->subcode &= ~GF_ASM_INLINE;
4090 }
4091
4092
3955 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */ 4093 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3956 4094
3957 static inline void 4095 static inline void
3958 gimple_asm_set_input (gasm *asm_stmt, bool input_p) 4096 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3959 { 4097 {
4003 4141
4004 /* Return the GIMPLE sequence representing the body of the handler of 4142 /* Return the GIMPLE sequence representing the body of the handler of
4005 GIMPLE_CATCH statement CATCH_STMT. */ 4143 GIMPLE_CATCH statement CATCH_STMT. */
4006 4144
4007 static inline gimple_seq 4145 static inline gimple_seq
4008 gimple_catch_handler (gcatch *catch_stmt) 4146 gimple_catch_handler (const gcatch *catch_stmt)
4009 { 4147 {
4010 return *gimple_catch_handler_ptr (catch_stmt); 4148 return *gimple_catch_handler_ptr (const_cast <gcatch *> (catch_stmt));
4011 } 4149 }
4012 4150
4013 4151
4014 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */ 4152 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4015 4153
4063 4201
4064 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER 4202 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4065 statement fails. */ 4203 statement fails. */
4066 4204
4067 static inline gimple_seq 4205 static inline gimple_seq
4068 gimple_eh_filter_failure (gimple *gs) 4206 gimple_eh_filter_failure (const gimple *gs)
4069 { 4207 {
4070 return *gimple_eh_filter_failure_ptr (gs); 4208 return *gimple_eh_filter_failure_ptr (const_cast <gimple *> (gs));
4071 } 4209 }
4072 4210
4073 4211
4074 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER 4212 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4075 EH_FILTER_STMT. */ 4213 EH_FILTER_STMT. */
4092 } 4230 }
4093 4231
4094 /* Get the function decl to be called by the MUST_NOT_THROW region. */ 4232 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4095 4233
4096 static inline tree 4234 static inline tree
4097 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt) 4235 gimple_eh_must_not_throw_fndecl (const geh_mnt *eh_mnt_stmt)
4098 { 4236 {
4099 return eh_mnt_stmt->fndecl; 4237 return eh_mnt_stmt->fndecl;
4100 } 4238 }
4101 4239
4102 /* Set the function decl to be called by GS to DECL. */ 4240 /* Set the function decl to be called by GS to DECL. */
4115 { 4253 {
4116 return &eh_else_stmt->n_body; 4254 return &eh_else_stmt->n_body;
4117 } 4255 }
4118 4256
4119 static inline gimple_seq 4257 static inline gimple_seq
4120 gimple_eh_else_n_body (geh_else *eh_else_stmt) 4258 gimple_eh_else_n_body (const geh_else *eh_else_stmt)
4121 { 4259 {
4122 return *gimple_eh_else_n_body_ptr (eh_else_stmt); 4260 return *gimple_eh_else_n_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4123 } 4261 }
4124 4262
4125 static inline gimple_seq * 4263 static inline gimple_seq *
4126 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt) 4264 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4127 { 4265 {
4128 return &eh_else_stmt->e_body; 4266 return &eh_else_stmt->e_body;
4129 } 4267 }
4130 4268
4131 static inline gimple_seq 4269 static inline gimple_seq
4132 gimple_eh_else_e_body (geh_else *eh_else_stmt) 4270 gimple_eh_else_e_body (const geh_else *eh_else_stmt)
4133 { 4271 {
4134 return *gimple_eh_else_e_body_ptr (eh_else_stmt); 4272 return *gimple_eh_else_e_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4135 } 4273 }
4136 4274
4137 static inline void 4275 static inline void
4138 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq) 4276 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4139 { 4277 {
4193 4331
4194 4332
4195 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */ 4333 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4196 4334
4197 static inline gimple_seq 4335 static inline gimple_seq
4198 gimple_try_eval (gimple *gs) 4336 gimple_try_eval (const gimple *gs)
4199 { 4337 {
4200 return *gimple_try_eval_ptr (gs); 4338 return *gimple_try_eval_ptr (const_cast <gimple *> (gs));
4201 } 4339 }
4202 4340
4203 4341
4204 /* Return a pointer to the sequence of statements used as the cleanup body for 4342 /* Return a pointer to the sequence of statements used as the cleanup body for
4205 GIMPLE_TRY GS. */ 4343 GIMPLE_TRY GS. */
4214 4352
4215 /* Return the sequence of statements used as the cleanup body for 4353 /* Return the sequence of statements used as the cleanup body for
4216 GIMPLE_TRY GS. */ 4354 GIMPLE_TRY GS. */
4217 4355
4218 static inline gimple_seq 4356 static inline gimple_seq
4219 gimple_try_cleanup (gimple *gs) 4357 gimple_try_cleanup (const gimple *gs)
4220 { 4358 {
4221 return *gimple_try_cleanup_ptr (gs); 4359 return *gimple_try_cleanup_ptr (const_cast <gimple *> (gs));
4222 } 4360 }
4223 4361
4224 4362
4225 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */ 4363 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4226 4364
4375 { 4513 {
4376 gcc_gimple_checking_assert (index < gs->nargs); 4514 gcc_gimple_checking_assert (index < gs->nargs);
4377 return &(gs->args[index]); 4515 return &(gs->args[index]);
4378 } 4516 }
4379 4517
4518 static inline const phi_arg_d *
4519 gimple_phi_arg (const gphi *gs, unsigned index)
4520 {
4521 gcc_gimple_checking_assert (index < gs->nargs);
4522 return &(gs->args[index]);
4523 }
4524
4380 static inline struct phi_arg_d * 4525 static inline struct phi_arg_d *
4381 gimple_phi_arg (gimple *gs, unsigned index) 4526 gimple_phi_arg (gimple *gs, unsigned index)
4382 { 4527 {
4383 gphi *phi_stmt = as_a <gphi *> (gs); 4528 gphi *phi_stmt = as_a <gphi *> (gs);
4384 return gimple_phi_arg (phi_stmt, index); 4529 return gimple_phi_arg (phi_stmt, index);
4414 } 4559 }
4415 4560
4416 /* Return the tree operand for argument I of PHI node GS. */ 4561 /* Return the tree operand for argument I of PHI node GS. */
4417 4562
4418 static inline tree 4563 static inline tree
4419 gimple_phi_arg_def (gphi *gs, size_t index) 4564 gimple_phi_arg_def (const gphi *gs, size_t index)
4420 { 4565 {
4421 return gimple_phi_arg (gs, index)->def; 4566 return gimple_phi_arg (gs, index)->def;
4422 } 4567 }
4423 4568
4424 static inline tree 4569 static inline tree
4437 } 4582 }
4438 4583
4439 /* Return the edge associated with argument I of phi node PHI. */ 4584 /* Return the edge associated with argument I of phi node PHI. */
4440 4585
4441 static inline edge 4586 static inline edge
4442 gimple_phi_arg_edge (gphi *phi, size_t i) 4587 gimple_phi_arg_edge (const gphi *phi, size_t i)
4443 { 4588 {
4444 return EDGE_PRED (gimple_bb (phi), i); 4589 return EDGE_PRED (gimple_bb (phi), i);
4445 } 4590 }
4446 4591
4447 /* Return the source location of gimple argument I of phi node PHI. */ 4592 /* Return the source location of gimple argument I of phi node PHI. */
4448 4593
4449 static inline source_location 4594 static inline location_t
4450 gimple_phi_arg_location (gphi *phi, size_t i) 4595 gimple_phi_arg_location (const gphi *phi, size_t i)
4451 { 4596 {
4452 return gimple_phi_arg (phi, i)->locus; 4597 return gimple_phi_arg (phi, i)->locus;
4453 } 4598 }
4454 4599
4455 /* Return the source location of the argument on edge E of phi node PHI. */ 4600 /* Return the source location of the argument on edge E of phi node PHI. */
4456 4601
4457 static inline source_location 4602 static inline location_t
4458 gimple_phi_arg_location_from_edge (gphi *phi, edge e) 4603 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4459 { 4604 {
4460 return gimple_phi_arg (phi, e->dest_idx)->locus; 4605 return gimple_phi_arg (phi, e->dest_idx)->locus;
4461 } 4606 }
4462 4607
4463 /* Set the source location of gimple argument I of phi node PHI to LOC. */ 4608 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4464 4609
4465 static inline void 4610 static inline void
4466 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc) 4611 gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc)
4467 { 4612 {
4468 gimple_phi_arg (phi, i)->locus = loc; 4613 gimple_phi_arg (phi, i)->locus = loc;
4469 } 4614 }
4470 4615
4471 /* Return TRUE if argument I of phi node PHI has a location record. */ 4616 /* Return TRUE if argument I of phi node PHI has a location record. */
4472 4617
4473 static inline bool 4618 static inline bool
4474 gimple_phi_arg_has_location (gphi *phi, size_t i) 4619 gimple_phi_arg_has_location (const gphi *phi, size_t i)
4475 { 4620 {
4476 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION; 4621 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4477 } 4622 }
4478 4623
4479 4624
4637 } 4782 }
4638 4783
4639 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */ 4784 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4640 4785
4641 static inline tree 4786 static inline tree
4642 gimple_debug_bind_get_var (gimple *dbg) 4787 gimple_debug_bind_get_var (const gimple *dbg)
4643 { 4788 {
4644 GIMPLE_CHECK (dbg, GIMPLE_DEBUG); 4789 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4645 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); 4790 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4646 return gimple_op (dbg, 0); 4791 return gimple_op (dbg, 0);
4647 } 4792 }
4648 4793
4649 /* Return the value bound to the variable in a GIMPLE_DEBUG bind 4794 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4650 statement. */ 4795 statement. */
4651 4796
4652 static inline tree 4797 static inline tree
4653 gimple_debug_bind_get_value (gimple *dbg) 4798 gimple_debug_bind_get_value (const gimple *dbg)
4654 { 4799 {
4655 GIMPLE_CHECK (dbg, GIMPLE_DEBUG); 4800 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4656 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); 4801 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4657 return gimple_op (dbg, 1); 4802 return gimple_op (dbg, 1);
4658 } 4803 }
4729 } 4874 }
4730 4875
4731 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */ 4876 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4732 4877
4733 static inline tree 4878 static inline tree
4734 gimple_debug_source_bind_get_var (gimple *dbg) 4879 gimple_debug_source_bind_get_var (const gimple *dbg)
4735 { 4880 {
4736 GIMPLE_CHECK (dbg, GIMPLE_DEBUG); 4881 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4737 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); 4882 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4738 return gimple_op (dbg, 0); 4883 return gimple_op (dbg, 0);
4739 } 4884 }
4740 4885
4741 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind 4886 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4742 statement. */ 4887 statement. */
4743 4888
4744 static inline tree 4889 static inline tree
4745 gimple_debug_source_bind_get_value (gimple *dbg) 4890 gimple_debug_source_bind_get_value (const gimple *dbg)
4746 { 4891 {
4747 GIMPLE_CHECK (dbg, GIMPLE_DEBUG); 4892 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4748 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); 4893 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4749 return gimple_op (dbg, 1); 4894 return gimple_op (dbg, 1);
4750 } 4895 }
4841 } 4986 }
4842 4987
4843 /* Return the body for the OMP statement GS. */ 4988 /* Return the body for the OMP statement GS. */
4844 4989
4845 static inline gimple_seq 4990 static inline gimple_seq
4846 gimple_omp_body (gimple *gs) 4991 gimple_omp_body (const gimple *gs)
4847 { 4992 {
4848 return *gimple_omp_body_ptr (gs); 4993 return *gimple_omp_body_ptr (const_cast <gimple *> (gs));
4849 } 4994 }
4850 4995
4851 /* Set BODY to be the body for the OMP statement GS. */ 4996 /* Set BODY to be the body for the OMP statement GS. */
4852 4997
4853 static inline void 4998 static inline void
4939 5084
4940 static inline void 5085 static inline void
4941 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses) 5086 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
4942 { 5087 {
4943 ord_stmt->clauses = clauses; 5088 ord_stmt->clauses = clauses;
5089 }
5090
5091
5092 /* Return the clauses associated with OMP_SCAN statement SCAN_STMT. */
5093
5094 static inline tree
5095 gimple_omp_scan_clauses (const gomp_scan *scan_stmt)
5096 {
5097 return scan_stmt->clauses;
5098 }
5099
5100
5101 /* Return a pointer to the clauses associated with OMP scan statement
5102 ORD_STMT. */
5103
5104 static inline tree *
5105 gimple_omp_scan_clauses_ptr (gomp_scan *scan_stmt)
5106 {
5107 return &scan_stmt->clauses;
5108 }
5109
5110
5111 /* Set CLAUSES to be the clauses associated with OMP scan statement
5112 ORD_STMT. */
5113
5114 static inline void
5115 gimple_omp_scan_set_clauses (gomp_scan *scan_stmt, tree clauses)
5116 {
5117 scan_stmt->clauses = clauses;
5118 }
5119
5120
5121 /* Return the clauses associated with OMP_TASKGROUP statement GS. */
5122
5123 static inline tree
5124 gimple_omp_taskgroup_clauses (const gimple *gs)
5125 {
5126 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5127 return
5128 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5129 }
5130
5131
5132 /* Return a pointer to the clauses associated with OMP taskgroup statement
5133 GS. */
5134
5135 static inline tree *
5136 gimple_omp_taskgroup_clauses_ptr (gimple *gs)
5137 {
5138 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5139 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5140 }
5141
5142
5143 /* Set CLAUSES to be the clauses associated with OMP taskgroup statement
5144 GS. */
5145
5146 static inline void
5147 gimple_omp_taskgroup_set_clauses (gimple *gs, tree clauses)
5148 {
5149 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5150 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5151 = clauses;
4944 } 5152 }
4945 5153
4946 5154
4947 /* Return the kind of the OMP_FOR statemement G. */ 5155 /* Return the kind of the OMP_FOR statemement G. */
4948 5156
5045 5253
5046 5254
5047 /* Get the collapse count of the OMP_FOR statement GS. */ 5255 /* Get the collapse count of the OMP_FOR statement GS. */
5048 5256
5049 static inline size_t 5257 static inline size_t
5050 gimple_omp_for_collapse (gimple *gs) 5258 gimple_omp_for_collapse (const gimple *gs)
5051 { 5259 {
5052 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); 5260 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5053 return omp_for_stmt->collapse; 5261 return omp_for_stmt->collapse;
5054 } 5262 }
5055 5263
5056 5264
5057 /* Return the condition code associated with the OMP_FOR statement GS. */ 5265 /* Return the condition code associated with the OMP_FOR statement GS. */
5222 5430
5223 /* Return the sequence of statements to execute before the OMP_FOR 5431 /* Return the sequence of statements to execute before the OMP_FOR
5224 statement GS starts. */ 5432 statement GS starts. */
5225 5433
5226 static inline gimple_seq 5434 static inline gimple_seq
5227 gimple_omp_for_pre_body (gimple *gs) 5435 gimple_omp_for_pre_body (const gimple *gs)
5228 { 5436 {
5229 return *gimple_omp_for_pre_body_ptr (gs); 5437 return *gimple_omp_for_pre_body_ptr (const_cast <gimple *> (gs));
5230 } 5438 }
5231 5439
5232 5440
5233 /* Set PRE_BODY to be the sequence of statements to execute before the 5441 /* Set PRE_BODY to be the sequence of statements to execute before the
5234 OMP_FOR statement GS starts. */ 5442 OMP_FOR statement GS starts. */
5468 else 5676 else
5469 g->subcode &= ~GF_OMP_TASK_TASKLOOP; 5677 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5470 } 5678 }
5471 5679
5472 5680
5681 /* Return true if OMP task statement G has the
5682 GF_OMP_TASK_TASKWAIT flag set. */
5683
5684 static inline bool
5685 gimple_omp_task_taskwait_p (const gimple *g)
5686 {
5687 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5688 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKWAIT) != 0;
5689 }
5690
5691
5692 /* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean
5693 value of TASKWAIT_P. */
5694
5695 static inline void
5696 gimple_omp_task_set_taskwait_p (gimple *g, bool taskwait_p)
5697 {
5698 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5699 if (taskwait_p)
5700 g->subcode |= GF_OMP_TASK_TASKWAIT;
5701 else
5702 g->subcode &= ~GF_OMP_TASK_TASKWAIT;
5703 }
5704
5705
5473 /* Return the child function used to hold the body of OMP_TASK GS. */ 5706 /* Return the child function used to hold the body of OMP_TASK GS. */
5474 5707
5475 static inline tree 5708 static inline tree
5476 gimple_omp_task_child_fn (const gimple *gs) 5709 gimple_omp_task_child_fn (const gimple *gs)
5477 { 5710 {
5882 6115
5883 static inline void 6116 static inline void
5884 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses) 6117 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5885 { 6118 {
5886 omp_teams_stmt->clauses = clauses; 6119 omp_teams_stmt->clauses = clauses;
6120 }
6121
6122 /* Return the child function used to hold the body of OMP_TEAMS_STMT. */
6123
6124 static inline tree
6125 gimple_omp_teams_child_fn (const gomp_teams *omp_teams_stmt)
6126 {
6127 return omp_teams_stmt->child_fn;
6128 }
6129
6130 /* Return a pointer to the child function used to hold the body of
6131 OMP_TEAMS_STMT. */
6132
6133 static inline tree *
6134 gimple_omp_teams_child_fn_ptr (gomp_teams *omp_teams_stmt)
6135 {
6136 return &omp_teams_stmt->child_fn;
6137 }
6138
6139
6140 /* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */
6141
6142 static inline void
6143 gimple_omp_teams_set_child_fn (gomp_teams *omp_teams_stmt, tree child_fn)
6144 {
6145 omp_teams_stmt->child_fn = child_fn;
6146 }
6147
6148
6149 /* Return the artificial argument used to send variables and values
6150 from the parent to the children threads in OMP_TEAMS_STMT. */
6151
6152 static inline tree
6153 gimple_omp_teams_data_arg (const gomp_teams *omp_teams_stmt)
6154 {
6155 return omp_teams_stmt->data_arg;
6156 }
6157
6158
6159 /* Return a pointer to the data argument for OMP_TEAMS_STMT. */
6160
6161 static inline tree *
6162 gimple_omp_teams_data_arg_ptr (gomp_teams *omp_teams_stmt)
6163 {
6164 return &omp_teams_stmt->data_arg;
6165 }
6166
6167
6168 /* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */
6169
6170 static inline void
6171 gimple_omp_teams_set_data_arg (gomp_teams *omp_teams_stmt, tree data_arg)
6172 {
6173 omp_teams_stmt->data_arg = data_arg;
5887 } 6174 }
5888 6175
5889 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */ 6176 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
5890 6177
5891 static inline bool 6178 static inline bool
5903 omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY; 6190 omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY;
5904 else 6191 else
5905 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY; 6192 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY;
5906 } 6193 }
5907 6194
6195 /* Return the host flag of an OMP_TEAMS_STMT. */
6196
6197 static inline bool
6198 gimple_omp_teams_host (const gomp_teams *omp_teams_stmt)
6199 {
6200 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_HOST) != 0;
6201 }
6202
6203 /* Set host flag of an OMP_TEAMS_STMT to VALUE. */
6204
6205 static inline void
6206 gimple_omp_teams_set_host (gomp_teams *omp_teams_stmt, bool value)
6207 {
6208 if (value)
6209 omp_teams_stmt->subcode |= GF_OMP_TEAMS_HOST;
6210 else
6211 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_HOST;
6212 }
6213
5908 /* Return the clauses associated with OMP_SECTIONS GS. */ 6214 /* Return the clauses associated with OMP_SECTIONS GS. */
5909 6215
5910 static inline tree 6216 static inline tree
5911 gimple_omp_sections_clauses (const gimple *gs) 6217 gimple_omp_sections_clauses (const gimple *gs)
5912 { 6218 {
6111 } 6417 }
6112 6418
6113 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */ 6419 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6114 6420
6115 static inline gimple_seq 6421 static inline gimple_seq
6116 gimple_transaction_body (gtransaction *transaction_stmt) 6422 gimple_transaction_body (const gtransaction *transaction_stmt)
6117 { 6423 {
6118 return transaction_stmt->body; 6424 return transaction_stmt->body;
6119 } 6425 }
6120 6426
6121 /* Return the label associated with a GIMPLE_TRANSACTION. */ 6427 /* Return the label associated with a GIMPLE_TRANSACTION. */
6243 case GIMPLE_OMP_SECTION: \ 6549 case GIMPLE_OMP_SECTION: \
6244 case GIMPLE_OMP_MASTER: \ 6550 case GIMPLE_OMP_MASTER: \
6245 case GIMPLE_OMP_TASKGROUP: \ 6551 case GIMPLE_OMP_TASKGROUP: \
6246 case GIMPLE_OMP_ORDERED: \ 6552 case GIMPLE_OMP_ORDERED: \
6247 case GIMPLE_OMP_CRITICAL: \ 6553 case GIMPLE_OMP_CRITICAL: \
6554 case GIMPLE_OMP_SCAN: \
6248 case GIMPLE_OMP_RETURN: \ 6555 case GIMPLE_OMP_RETURN: \
6249 case GIMPLE_OMP_ATOMIC_LOAD: \ 6556 case GIMPLE_OMP_ATOMIC_LOAD: \
6250 case GIMPLE_OMP_ATOMIC_STORE: \ 6557 case GIMPLE_OMP_ATOMIC_STORE: \
6251 case GIMPLE_OMP_CONTINUE: \ 6558 case GIMPLE_OMP_CONTINUE: \
6252 case GIMPLE_OMP_GRID_BODY 6559 case GIMPLE_OMP_GRID_BODY
6283 case GIMPLE_OMP_TARGET: 6590 case GIMPLE_OMP_TARGET:
6284 switch (gimple_omp_target_kind (stmt)) 6591 switch (gimple_omp_target_kind (stmt))
6285 { 6592 {
6286 case GF_OMP_TARGET_KIND_OACC_PARALLEL: 6593 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6287 case GF_OMP_TARGET_KIND_OACC_KERNELS: 6594 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6595 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6288 case GF_OMP_TARGET_KIND_OACC_DATA: 6596 case GF_OMP_TARGET_KIND_OACC_DATA:
6289 case GF_OMP_TARGET_KIND_OACC_UPDATE: 6597 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6290 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA: 6598 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6291 case GF_OMP_TARGET_KIND_OACC_DECLARE: 6599 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6292 case GF_OMP_TARGET_KIND_OACC_HOST_DATA: 6600 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6312 switch (gimple_omp_target_kind (stmt)) 6620 switch (gimple_omp_target_kind (stmt))
6313 { 6621 {
6314 case GF_OMP_TARGET_KIND_REGION: 6622 case GF_OMP_TARGET_KIND_REGION:
6315 case GF_OMP_TARGET_KIND_OACC_PARALLEL: 6623 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6316 case GF_OMP_TARGET_KIND_OACC_KERNELS: 6624 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6625 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6317 return true; 6626 return true;
6318 default: 6627 default:
6319 return false; 6628 return false;
6320 } 6629 }
6321 default: 6630 default:
6431 /* The PLF flags are initialized to 0 when a new tuple is created, 6740 /* The PLF flags are initialized to 0 when a new tuple is created,
6432 so no need to initialize it anywhere. */ 6741 so no need to initialize it anywhere. */
6433 gimple_set_plf (g, GF_PLF_1, true); 6742 gimple_set_plf (g, GF_PLF_1, true);
6434 } 6743 }
6435 6744
6436
6437 /* Macros for showing usage statistics. */
6438 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6439 ? (x) \
6440 : ((x) < 1024*1024*10 \
6441 ? (x) / 1024 \
6442 : (x) / (1024*1024))))
6443
6444 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6445
6446 #endif /* GCC_GIMPLE_H */ 6745 #endif /* GCC_GIMPLE_H */