Mercurial > hg > CbC > CbC_gcc
comparison gcc/tree-nested.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* Nested function decomposition for GIMPLE. | 1 /* Nested function decomposition for GIMPLE. |
2 Copyright (C) 2004-2018 Free Software Foundation, Inc. | 2 Copyright (C) 2004-2020 Free Software Foundation, Inc. |
3 | 3 |
4 This file is part of GCC. | 4 This file is part of GCC. |
5 | 5 |
6 GCC is free software; you can redistribute it and/or modify | 6 GCC is free software; you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
167 info->new_local_var_chain = tmp_var; | 167 info->new_local_var_chain = tmp_var; |
168 | 168 |
169 return tmp_var; | 169 return tmp_var; |
170 } | 170 } |
171 | 171 |
172 /* Like build_simple_mem_ref, but set TREE_THIS_NOTRAP on the result. */ | |
173 | |
174 static tree | |
175 build_simple_mem_ref_notrap (tree ptr) | |
176 { | |
177 tree t = build_simple_mem_ref (ptr); | |
178 TREE_THIS_NOTRAP (t) = 1; | |
179 return t; | |
180 } | |
181 | |
172 /* Take the address of EXP to be used within function CONTEXT. | 182 /* Take the address of EXP to be used within function CONTEXT. |
173 Mark it for addressability as necessary. */ | 183 Mark it for addressability as necessary. */ |
174 | 184 |
175 tree | 185 tree |
176 build_addr (tree exp) | 186 build_addr (tree exp) |
875 | 885 |
876 for (i = info->outer; i->context != target_context; i = i->outer) | 886 for (i = info->outer; i->context != target_context; i = i->outer) |
877 { | 887 { |
878 tree field = get_chain_field (i); | 888 tree field = get_chain_field (i); |
879 | 889 |
880 x = build_simple_mem_ref (x); | 890 x = build_simple_mem_ref_notrap (x); |
881 x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE); | 891 x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE); |
882 x = init_tmp_var (info, x, gsi); | 892 x = init_tmp_var (info, x, gsi); |
883 } | 893 } |
884 } | 894 } |
885 | 895 |
912 | 922 |
913 for (i = info->outer; i->context != target_context; i = i->outer) | 923 for (i = info->outer; i->context != target_context; i = i->outer) |
914 { | 924 { |
915 tree field = get_chain_field (i); | 925 tree field = get_chain_field (i); |
916 | 926 |
917 x = build_simple_mem_ref (x); | 927 x = build_simple_mem_ref_notrap (x); |
918 x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE); | 928 x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE); |
919 x = init_tmp_var (info, x, gsi); | 929 x = init_tmp_var (info, x, gsi); |
920 } | 930 } |
921 | 931 |
922 x = build_simple_mem_ref (x); | 932 x = build_simple_mem_ref_notrap (x); |
923 } | 933 } |
924 | 934 |
925 x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE); | 935 x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE); |
926 return x; | 936 return x; |
927 } | 937 } |
961 x = get_chain_decl (info); | 971 x = get_chain_decl (info); |
962 info->static_chain_added |= 2; | 972 info->static_chain_added |= 2; |
963 for (i = info->outer; i->context != target_context; i = i->outer) | 973 for (i = info->outer; i->context != target_context; i = i->outer) |
964 { | 974 { |
965 field = get_chain_field (i); | 975 field = get_chain_field (i); |
966 x = build_simple_mem_ref (x); | 976 x = build_simple_mem_ref_notrap (x); |
967 x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE); | 977 x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE); |
968 } | 978 } |
969 x = build_simple_mem_ref (x); | 979 x = build_simple_mem_ref_notrap (x); |
970 } | 980 } |
971 | 981 |
972 field = lookup_field_for_decl (i, decl, INSERT); | 982 field = lookup_field_for_decl (i, decl, INSERT); |
973 x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE); | 983 x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE); |
974 if (use_pointer_in_frame (decl)) | 984 if (use_pointer_in_frame (decl)) |
975 x = build_simple_mem_ref (x); | 985 x = build_simple_mem_ref_notrap (x); |
976 | 986 |
977 /* ??? We should be remapping types as well, surely. */ | 987 /* ??? We should be remapping types as well, surely. */ |
978 new_decl = build_decl (DECL_SOURCE_LOCATION (decl), | 988 new_decl = build_decl (DECL_SOURCE_LOCATION (decl), |
979 VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl)); | 989 VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl)); |
980 DECL_CONTEXT (new_decl) = info->context; | 990 DECL_CONTEXT (new_decl) = info->context; |
1058 x = lookup_field_for_decl (i, t, INSERT); | 1068 x = lookup_field_for_decl (i, t, INSERT); |
1059 x = get_frame_field (info, target_context, x, &wi->gsi); | 1069 x = get_frame_field (info, target_context, x, &wi->gsi); |
1060 if (use_pointer_in_frame (t)) | 1070 if (use_pointer_in_frame (t)) |
1061 { | 1071 { |
1062 x = init_tmp_var (info, x, &wi->gsi); | 1072 x = init_tmp_var (info, x, &wi->gsi); |
1063 x = build_simple_mem_ref (x); | 1073 x = build_simple_mem_ref_notrap (x); |
1064 } | 1074 } |
1065 } | 1075 } |
1066 | 1076 |
1067 if (wi->val_only) | 1077 if (wi->val_only) |
1068 { | 1078 { |
1188 for (clause = *pclauses; clause ; clause = OMP_CLAUSE_CHAIN (clause)) | 1198 for (clause = *pclauses; clause ; clause = OMP_CLAUSE_CHAIN (clause)) |
1189 { | 1199 { |
1190 switch (OMP_CLAUSE_CODE (clause)) | 1200 switch (OMP_CLAUSE_CODE (clause)) |
1191 { | 1201 { |
1192 case OMP_CLAUSE_REDUCTION: | 1202 case OMP_CLAUSE_REDUCTION: |
1203 case OMP_CLAUSE_IN_REDUCTION: | |
1204 case OMP_CLAUSE_TASK_REDUCTION: | |
1193 if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause)) | 1205 if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause)) |
1194 need_stmts = true; | 1206 need_stmts = true; |
1195 goto do_decl_clause; | 1207 goto do_decl_clause; |
1196 | 1208 |
1197 case OMP_CLAUSE_LASTPRIVATE: | 1209 case OMP_CLAUSE_LASTPRIVATE: |
1213 case OMP_CLAUSE_COPYPRIVATE: | 1225 case OMP_CLAUSE_COPYPRIVATE: |
1214 case OMP_CLAUSE_SHARED: | 1226 case OMP_CLAUSE_SHARED: |
1215 case OMP_CLAUSE_TO_DECLARE: | 1227 case OMP_CLAUSE_TO_DECLARE: |
1216 case OMP_CLAUSE_LINK: | 1228 case OMP_CLAUSE_LINK: |
1217 case OMP_CLAUSE_USE_DEVICE_PTR: | 1229 case OMP_CLAUSE_USE_DEVICE_PTR: |
1230 case OMP_CLAUSE_USE_DEVICE_ADDR: | |
1218 case OMP_CLAUSE_IS_DEVICE_PTR: | 1231 case OMP_CLAUSE_IS_DEVICE_PTR: |
1219 do_decl_clause: | 1232 do_decl_clause: |
1220 decl = OMP_CLAUSE_DECL (clause); | 1233 decl = OMP_CLAUSE_DECL (clause); |
1221 if (VAR_P (decl) | 1234 if (VAR_P (decl) |
1222 && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) | 1235 && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) |
1312 wi->val_only = true; | 1325 wi->val_only = true; |
1313 wi->is_lhs = false; | 1326 wi->is_lhs = false; |
1314 convert_nonlocal_reference_op | 1327 convert_nonlocal_reference_op |
1315 (&OMP_CLAUSE_ALIGNED_ALIGNMENT (clause), &dummy, wi); | 1328 (&OMP_CLAUSE_ALIGNED_ALIGNMENT (clause), &dummy, wi); |
1316 } | 1329 } |
1330 /* FALLTHRU */ | |
1331 case OMP_CLAUSE_NONTEMPORAL: | |
1317 /* Like do_decl_clause, but don't add any suppression. */ | 1332 /* Like do_decl_clause, but don't add any suppression. */ |
1318 decl = OMP_CLAUSE_DECL (clause); | 1333 decl = OMP_CLAUSE_DECL (clause); |
1319 if (VAR_P (decl) | 1334 if (VAR_P (decl) |
1320 && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) | 1335 && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) |
1321 break; | 1336 break; |
1322 if (decl_function_context (decl) != info->context) | 1337 if (decl_function_context (decl) != info->context) |
1323 { | 1338 { |
1324 OMP_CLAUSE_DECL (clause) = get_nonlocal_debug_decl (info, decl); | 1339 OMP_CLAUSE_DECL (clause) = get_nonlocal_debug_decl (info, decl); |
1325 if (OMP_CLAUSE_CODE (clause) != OMP_CLAUSE_PRIVATE) | 1340 need_chain = true; |
1326 need_chain = true; | |
1327 } | 1341 } |
1328 break; | 1342 break; |
1329 | 1343 |
1330 case OMP_CLAUSE_NOWAIT: | 1344 case OMP_CLAUSE_NOWAIT: |
1331 case OMP_CLAUSE_ORDERED: | 1345 case OMP_CLAUSE_ORDERED: |
1338 case OMP_CLAUSE_PROC_BIND: | 1352 case OMP_CLAUSE_PROC_BIND: |
1339 case OMP_CLAUSE_NOGROUP: | 1353 case OMP_CLAUSE_NOGROUP: |
1340 case OMP_CLAUSE_THREADS: | 1354 case OMP_CLAUSE_THREADS: |
1341 case OMP_CLAUSE_SIMD: | 1355 case OMP_CLAUSE_SIMD: |
1342 case OMP_CLAUSE_DEFAULTMAP: | 1356 case OMP_CLAUSE_DEFAULTMAP: |
1357 case OMP_CLAUSE_ORDER: | |
1343 case OMP_CLAUSE_SEQ: | 1358 case OMP_CLAUSE_SEQ: |
1344 case OMP_CLAUSE_INDEPENDENT: | 1359 case OMP_CLAUSE_INDEPENDENT: |
1345 case OMP_CLAUSE_AUTO: | 1360 case OMP_CLAUSE_AUTO: |
1346 case OMP_CLAUSE_IF_PRESENT: | 1361 case OMP_CLAUSE_IF_PRESENT: |
1347 case OMP_CLAUSE_FINALIZE: | 1362 case OMP_CLAUSE_FINALIZE: |
1363 case OMP_CLAUSE__CONDTEMP_: | |
1364 case OMP_CLAUSE__SCANTEMP_: | |
1348 break; | 1365 break; |
1349 | 1366 |
1350 /* The following clause belongs to the OpenACC cache directive, which | 1367 /* The following clause belongs to the OpenACC cache directive, which |
1351 is discarded during gimplification. */ | 1368 is discarded during gimplification. */ |
1352 case OMP_CLAUSE__CACHE_: | 1369 case OMP_CLAUSE__CACHE_: |
1363 case OMP_CLAUSE_SECTIONS: | 1380 case OMP_CLAUSE_SECTIONS: |
1364 case OMP_CLAUSE_TASKGROUP: | 1381 case OMP_CLAUSE_TASKGROUP: |
1365 /* The following clauses are only added during OMP lowering; nested | 1382 /* The following clauses are only added during OMP lowering; nested |
1366 function decomposition happens before that. */ | 1383 function decomposition happens before that. */ |
1367 case OMP_CLAUSE__LOOPTEMP_: | 1384 case OMP_CLAUSE__LOOPTEMP_: |
1385 case OMP_CLAUSE__REDUCTEMP_: | |
1368 case OMP_CLAUSE__SIMDUID_: | 1386 case OMP_CLAUSE__SIMDUID_: |
1369 case OMP_CLAUSE__GRIDDIM_: | 1387 case OMP_CLAUSE__GRIDDIM_: |
1388 case OMP_CLAUSE__SIMT_: | |
1370 /* Anything else. */ | 1389 /* Anything else. */ |
1371 default: | 1390 default: |
1372 gcc_unreachable (); | 1391 gcc_unreachable (); |
1373 } | 1392 } |
1374 } | 1393 } |
1378 if (need_stmts) | 1397 if (need_stmts) |
1379 for (clause = *pclauses; clause ; clause = OMP_CLAUSE_CHAIN (clause)) | 1398 for (clause = *pclauses; clause ; clause = OMP_CLAUSE_CHAIN (clause)) |
1380 switch (OMP_CLAUSE_CODE (clause)) | 1399 switch (OMP_CLAUSE_CODE (clause)) |
1381 { | 1400 { |
1382 case OMP_CLAUSE_REDUCTION: | 1401 case OMP_CLAUSE_REDUCTION: |
1402 case OMP_CLAUSE_IN_REDUCTION: | |
1403 case OMP_CLAUSE_TASK_REDUCTION: | |
1383 if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause)) | 1404 if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause)) |
1384 { | 1405 { |
1385 tree old_context | 1406 tree old_context |
1386 = DECL_CONTEXT (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause)); | 1407 = DECL_CONTEXT (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause)); |
1387 DECL_CONTEXT (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause)) | 1408 DECL_CONTEXT (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause)) |
1488 *handled_ops_p = false; | 1509 *handled_ops_p = false; |
1489 return NULL_TREE; | 1510 return NULL_TREE; |
1490 } | 1511 } |
1491 break; | 1512 break; |
1492 | 1513 |
1514 case GIMPLE_OMP_TEAMS: | |
1515 if (!gimple_omp_teams_host (as_a <gomp_teams *> (stmt))) | |
1516 { | |
1517 save_suppress = info->suppress_expansion; | |
1518 convert_nonlocal_omp_clauses (gimple_omp_teams_clauses_ptr (stmt), | |
1519 wi); | |
1520 walk_body (convert_nonlocal_reference_stmt, | |
1521 convert_nonlocal_reference_op, info, | |
1522 gimple_omp_body_ptr (stmt)); | |
1523 info->suppress_expansion = save_suppress; | |
1524 break; | |
1525 } | |
1526 /* FALLTHRU */ | |
1527 | |
1493 case GIMPLE_OMP_PARALLEL: | 1528 case GIMPLE_OMP_PARALLEL: |
1494 case GIMPLE_OMP_TASK: | 1529 case GIMPLE_OMP_TASK: |
1495 save_suppress = info->suppress_expansion; | 1530 save_suppress = info->suppress_expansion; |
1496 if (convert_nonlocal_omp_clauses (gimple_omp_taskreg_clauses_ptr (stmt), | 1531 if (convert_nonlocal_omp_clauses (gimple_omp_taskreg_clauses_ptr (stmt), |
1497 wi)) | 1532 wi)) |
1544 walk_body (convert_nonlocal_reference_stmt, convert_nonlocal_reference_op, | 1579 walk_body (convert_nonlocal_reference_stmt, convert_nonlocal_reference_op, |
1545 info, gimple_omp_body_ptr (stmt)); | 1580 info, gimple_omp_body_ptr (stmt)); |
1546 info->suppress_expansion = save_suppress; | 1581 info->suppress_expansion = save_suppress; |
1547 break; | 1582 break; |
1548 | 1583 |
1584 case GIMPLE_OMP_TASKGROUP: | |
1585 save_suppress = info->suppress_expansion; | |
1586 convert_nonlocal_omp_clauses (gimple_omp_taskgroup_clauses_ptr (stmt), wi); | |
1587 walk_body (convert_nonlocal_reference_stmt, convert_nonlocal_reference_op, | |
1588 info, gimple_omp_body_ptr (stmt)); | |
1589 info->suppress_expansion = save_suppress; | |
1590 break; | |
1591 | |
1549 case GIMPLE_OMP_TARGET: | 1592 case GIMPLE_OMP_TARGET: |
1550 if (!is_gimple_omp_offloaded (stmt)) | 1593 if (!is_gimple_omp_offloaded (stmt)) |
1551 { | 1594 { |
1552 save_suppress = info->suppress_expansion; | 1595 save_suppress = info->suppress_expansion; |
1553 convert_nonlocal_omp_clauses (gimple_omp_target_clauses_ptr (stmt), | 1596 convert_nonlocal_omp_clauses (gimple_omp_target_clauses_ptr (stmt), |
1584 false); | 1627 false); |
1585 info->new_local_var_chain = save_local_var_chain; | 1628 info->new_local_var_chain = save_local_var_chain; |
1586 info->suppress_expansion = save_suppress; | 1629 info->suppress_expansion = save_suppress; |
1587 break; | 1630 break; |
1588 | 1631 |
1589 case GIMPLE_OMP_TEAMS: | |
1590 save_suppress = info->suppress_expansion; | |
1591 convert_nonlocal_omp_clauses (gimple_omp_teams_clauses_ptr (stmt), wi); | |
1592 walk_body (convert_nonlocal_reference_stmt, convert_nonlocal_reference_op, | |
1593 info, gimple_omp_body_ptr (stmt)); | |
1594 info->suppress_expansion = save_suppress; | |
1595 break; | |
1596 | |
1597 case GIMPLE_OMP_SECTION: | 1632 case GIMPLE_OMP_SECTION: |
1598 case GIMPLE_OMP_MASTER: | 1633 case GIMPLE_OMP_MASTER: |
1599 case GIMPLE_OMP_TASKGROUP: | |
1600 case GIMPLE_OMP_ORDERED: | 1634 case GIMPLE_OMP_ORDERED: |
1635 case GIMPLE_OMP_SCAN: | |
1601 walk_body (convert_nonlocal_reference_stmt, convert_nonlocal_reference_op, | 1636 walk_body (convert_nonlocal_reference_stmt, convert_nonlocal_reference_op, |
1602 info, gimple_omp_body_ptr (stmt)); | 1637 info, gimple_omp_body_ptr (stmt)); |
1603 break; | 1638 break; |
1604 | 1639 |
1605 case GIMPLE_BIND: | 1640 case GIMPLE_BIND: |
1629 return NULL_TREE; | 1664 return NULL_TREE; |
1630 } | 1665 } |
1631 case GIMPLE_COND: | 1666 case GIMPLE_COND: |
1632 wi->val_only = true; | 1667 wi->val_only = true; |
1633 wi->is_lhs = false; | 1668 wi->is_lhs = false; |
1669 *handled_ops_p = false; | |
1670 return NULL_TREE; | |
1671 | |
1672 case GIMPLE_ASSIGN: | |
1673 if (gimple_clobber_p (stmt)) | |
1674 { | |
1675 tree lhs = gimple_assign_lhs (stmt); | |
1676 if (DECL_P (lhs) | |
1677 && !(TREE_STATIC (lhs) || DECL_EXTERNAL (lhs)) | |
1678 && decl_function_context (lhs) != info->context) | |
1679 { | |
1680 gsi_replace (gsi, gimple_build_nop (), true); | |
1681 break; | |
1682 } | |
1683 } | |
1634 *handled_ops_p = false; | 1684 *handled_ops_p = false; |
1635 return NULL_TREE; | 1685 return NULL_TREE; |
1636 | 1686 |
1637 default: | 1687 default: |
1638 /* For every other statement that we are not interested in | 1688 /* For every other statement that we are not interested in |
1869 for (clause = *pclauses; clause ; clause = OMP_CLAUSE_CHAIN (clause)) | 1919 for (clause = *pclauses; clause ; clause = OMP_CLAUSE_CHAIN (clause)) |
1870 { | 1920 { |
1871 switch (OMP_CLAUSE_CODE (clause)) | 1921 switch (OMP_CLAUSE_CODE (clause)) |
1872 { | 1922 { |
1873 case OMP_CLAUSE_REDUCTION: | 1923 case OMP_CLAUSE_REDUCTION: |
1924 case OMP_CLAUSE_IN_REDUCTION: | |
1925 case OMP_CLAUSE_TASK_REDUCTION: | |
1874 if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause)) | 1926 if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause)) |
1875 need_stmts = true; | 1927 need_stmts = true; |
1876 goto do_decl_clause; | 1928 goto do_decl_clause; |
1877 | 1929 |
1878 case OMP_CLAUSE_LASTPRIVATE: | 1930 case OMP_CLAUSE_LASTPRIVATE: |
1894 case OMP_CLAUSE_COPYPRIVATE: | 1946 case OMP_CLAUSE_COPYPRIVATE: |
1895 case OMP_CLAUSE_SHARED: | 1947 case OMP_CLAUSE_SHARED: |
1896 case OMP_CLAUSE_TO_DECLARE: | 1948 case OMP_CLAUSE_TO_DECLARE: |
1897 case OMP_CLAUSE_LINK: | 1949 case OMP_CLAUSE_LINK: |
1898 case OMP_CLAUSE_USE_DEVICE_PTR: | 1950 case OMP_CLAUSE_USE_DEVICE_PTR: |
1951 case OMP_CLAUSE_USE_DEVICE_ADDR: | |
1899 case OMP_CLAUSE_IS_DEVICE_PTR: | 1952 case OMP_CLAUSE_IS_DEVICE_PTR: |
1900 do_decl_clause: | 1953 do_decl_clause: |
1901 decl = OMP_CLAUSE_DECL (clause); | 1954 decl = OMP_CLAUSE_DECL (clause); |
1902 if (VAR_P (decl) | 1955 if (VAR_P (decl) |
1903 && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) | 1956 && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) |
1998 wi->val_only = true; | 2051 wi->val_only = true; |
1999 wi->is_lhs = false; | 2052 wi->is_lhs = false; |
2000 convert_local_reference_op | 2053 convert_local_reference_op |
2001 (&OMP_CLAUSE_ALIGNED_ALIGNMENT (clause), &dummy, wi); | 2054 (&OMP_CLAUSE_ALIGNED_ALIGNMENT (clause), &dummy, wi); |
2002 } | 2055 } |
2056 /* FALLTHRU */ | |
2057 case OMP_CLAUSE_NONTEMPORAL: | |
2003 /* Like do_decl_clause, but don't add any suppression. */ | 2058 /* Like do_decl_clause, but don't add any suppression. */ |
2004 decl = OMP_CLAUSE_DECL (clause); | 2059 decl = OMP_CLAUSE_DECL (clause); |
2005 if (VAR_P (decl) | 2060 if (VAR_P (decl) |
2006 && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) | 2061 && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) |
2007 break; | 2062 break; |
2029 case OMP_CLAUSE_PROC_BIND: | 2084 case OMP_CLAUSE_PROC_BIND: |
2030 case OMP_CLAUSE_NOGROUP: | 2085 case OMP_CLAUSE_NOGROUP: |
2031 case OMP_CLAUSE_THREADS: | 2086 case OMP_CLAUSE_THREADS: |
2032 case OMP_CLAUSE_SIMD: | 2087 case OMP_CLAUSE_SIMD: |
2033 case OMP_CLAUSE_DEFAULTMAP: | 2088 case OMP_CLAUSE_DEFAULTMAP: |
2089 case OMP_CLAUSE_ORDER: | |
2034 case OMP_CLAUSE_SEQ: | 2090 case OMP_CLAUSE_SEQ: |
2035 case OMP_CLAUSE_INDEPENDENT: | 2091 case OMP_CLAUSE_INDEPENDENT: |
2036 case OMP_CLAUSE_AUTO: | 2092 case OMP_CLAUSE_AUTO: |
2037 case OMP_CLAUSE_IF_PRESENT: | 2093 case OMP_CLAUSE_IF_PRESENT: |
2038 case OMP_CLAUSE_FINALIZE: | 2094 case OMP_CLAUSE_FINALIZE: |
2095 case OMP_CLAUSE__CONDTEMP_: | |
2096 case OMP_CLAUSE__SCANTEMP_: | |
2039 break; | 2097 break; |
2040 | 2098 |
2041 /* The following clause belongs to the OpenACC cache directive, which | 2099 /* The following clause belongs to the OpenACC cache directive, which |
2042 is discarded during gimplification. */ | 2100 is discarded during gimplification. */ |
2043 case OMP_CLAUSE__CACHE_: | 2101 case OMP_CLAUSE__CACHE_: |
2054 case OMP_CLAUSE_SECTIONS: | 2112 case OMP_CLAUSE_SECTIONS: |
2055 case OMP_CLAUSE_TASKGROUP: | 2113 case OMP_CLAUSE_TASKGROUP: |
2056 /* The following clauses are only added during OMP lowering; nested | 2114 /* The following clauses are only added during OMP lowering; nested |
2057 function decomposition happens before that. */ | 2115 function decomposition happens before that. */ |
2058 case OMP_CLAUSE__LOOPTEMP_: | 2116 case OMP_CLAUSE__LOOPTEMP_: |
2117 case OMP_CLAUSE__REDUCTEMP_: | |
2059 case OMP_CLAUSE__SIMDUID_: | 2118 case OMP_CLAUSE__SIMDUID_: |
2060 case OMP_CLAUSE__GRIDDIM_: | 2119 case OMP_CLAUSE__GRIDDIM_: |
2120 case OMP_CLAUSE__SIMT_: | |
2061 /* Anything else. */ | 2121 /* Anything else. */ |
2062 default: | 2122 default: |
2063 gcc_unreachable (); | 2123 gcc_unreachable (); |
2064 } | 2124 } |
2065 } | 2125 } |
2069 if (need_stmts) | 2129 if (need_stmts) |
2070 for (clause = *pclauses; clause ; clause = OMP_CLAUSE_CHAIN (clause)) | 2130 for (clause = *pclauses; clause ; clause = OMP_CLAUSE_CHAIN (clause)) |
2071 switch (OMP_CLAUSE_CODE (clause)) | 2131 switch (OMP_CLAUSE_CODE (clause)) |
2072 { | 2132 { |
2073 case OMP_CLAUSE_REDUCTION: | 2133 case OMP_CLAUSE_REDUCTION: |
2134 case OMP_CLAUSE_IN_REDUCTION: | |
2135 case OMP_CLAUSE_TASK_REDUCTION: | |
2074 if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause)) | 2136 if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause)) |
2075 { | 2137 { |
2076 tree old_context | 2138 tree old_context |
2077 = DECL_CONTEXT (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause)); | 2139 = DECL_CONTEXT (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause)); |
2078 DECL_CONTEXT (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause)) | 2140 DECL_CONTEXT (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause)) |
2129 bool frame_decl_added; | 2191 bool frame_decl_added; |
2130 gimple *stmt = gsi_stmt (*gsi); | 2192 gimple *stmt = gsi_stmt (*gsi); |
2131 | 2193 |
2132 switch (gimple_code (stmt)) | 2194 switch (gimple_code (stmt)) |
2133 { | 2195 { |
2196 case GIMPLE_OMP_TEAMS: | |
2197 if (!gimple_omp_teams_host (as_a <gomp_teams *> (stmt))) | |
2198 { | |
2199 save_suppress = info->suppress_expansion; | |
2200 convert_local_omp_clauses (gimple_omp_teams_clauses_ptr (stmt), wi); | |
2201 walk_body (convert_local_reference_stmt, convert_local_reference_op, | |
2202 info, gimple_omp_body_ptr (stmt)); | |
2203 info->suppress_expansion = save_suppress; | |
2204 break; | |
2205 } | |
2206 /* FALLTHRU */ | |
2207 | |
2134 case GIMPLE_OMP_PARALLEL: | 2208 case GIMPLE_OMP_PARALLEL: |
2135 case GIMPLE_OMP_TASK: | 2209 case GIMPLE_OMP_TASK: |
2136 save_suppress = info->suppress_expansion; | 2210 save_suppress = info->suppress_expansion; |
2137 frame_decl_added = false; | 2211 frame_decl_added = false; |
2138 if (convert_local_omp_clauses (gimple_omp_taskreg_clauses_ptr (stmt), | 2212 if (convert_local_omp_clauses (gimple_omp_taskreg_clauses_ptr (stmt), |
2199 walk_body (convert_local_reference_stmt, convert_local_reference_op, | 2273 walk_body (convert_local_reference_stmt, convert_local_reference_op, |
2200 info, gimple_omp_body_ptr (stmt)); | 2274 info, gimple_omp_body_ptr (stmt)); |
2201 info->suppress_expansion = save_suppress; | 2275 info->suppress_expansion = save_suppress; |
2202 break; | 2276 break; |
2203 | 2277 |
2278 case GIMPLE_OMP_TASKGROUP: | |
2279 save_suppress = info->suppress_expansion; | |
2280 convert_local_omp_clauses (gimple_omp_taskgroup_clauses_ptr (stmt), wi); | |
2281 walk_body (convert_local_reference_stmt, convert_local_reference_op, | |
2282 info, gimple_omp_body_ptr (stmt)); | |
2283 info->suppress_expansion = save_suppress; | |
2284 break; | |
2285 | |
2204 case GIMPLE_OMP_TARGET: | 2286 case GIMPLE_OMP_TARGET: |
2205 if (!is_gimple_omp_offloaded (stmt)) | 2287 if (!is_gimple_omp_offloaded (stmt)) |
2206 { | 2288 { |
2207 save_suppress = info->suppress_expansion; | 2289 save_suppress = info->suppress_expansion; |
2208 convert_local_omp_clauses (gimple_omp_target_clauses_ptr (stmt), wi); | 2290 convert_local_omp_clauses (gimple_omp_target_clauses_ptr (stmt), wi); |
2252 info->new_local_var_chain = save_local_var_chain; | 2334 info->new_local_var_chain = save_local_var_chain; |
2253 info->suppress_expansion = save_suppress; | 2335 info->suppress_expansion = save_suppress; |
2254 info->static_chain_added |= save_static_chain_added; | 2336 info->static_chain_added |= save_static_chain_added; |
2255 break; | 2337 break; |
2256 | 2338 |
2257 case GIMPLE_OMP_TEAMS: | |
2258 save_suppress = info->suppress_expansion; | |
2259 convert_local_omp_clauses (gimple_omp_teams_clauses_ptr (stmt), wi); | |
2260 walk_body (convert_local_reference_stmt, convert_local_reference_op, | |
2261 info, gimple_omp_body_ptr (stmt)); | |
2262 info->suppress_expansion = save_suppress; | |
2263 break; | |
2264 | |
2265 case GIMPLE_OMP_SECTION: | 2339 case GIMPLE_OMP_SECTION: |
2266 case GIMPLE_OMP_MASTER: | 2340 case GIMPLE_OMP_MASTER: |
2267 case GIMPLE_OMP_TASKGROUP: | |
2268 case GIMPLE_OMP_ORDERED: | 2341 case GIMPLE_OMP_ORDERED: |
2342 case GIMPLE_OMP_SCAN: | |
2269 walk_body (convert_local_reference_stmt, convert_local_reference_op, | 2343 walk_body (convert_local_reference_stmt, convert_local_reference_op, |
2270 info, gimple_omp_body_ptr (stmt)); | 2344 info, gimple_omp_body_ptr (stmt)); |
2271 break; | 2345 break; |
2272 | 2346 |
2273 case GIMPLE_COND: | 2347 case GIMPLE_COND: |
2278 | 2352 |
2279 case GIMPLE_ASSIGN: | 2353 case GIMPLE_ASSIGN: |
2280 if (gimple_clobber_p (stmt)) | 2354 if (gimple_clobber_p (stmt)) |
2281 { | 2355 { |
2282 tree lhs = gimple_assign_lhs (stmt); | 2356 tree lhs = gimple_assign_lhs (stmt); |
2283 if (!use_pointer_in_frame (lhs) | 2357 if (DECL_P (lhs) |
2358 && !use_pointer_in_frame (lhs) | |
2284 && lookup_field_for_decl (info, lhs, NO_INSERT)) | 2359 && lookup_field_for_decl (info, lhs, NO_INSERT)) |
2285 { | 2360 { |
2286 gsi_replace (gsi, gimple_build_nop (), true); | 2361 gsi_replace (gsi, gimple_build_nop (), true); |
2287 break; | 2362 break; |
2288 } | 2363 } |
2560 walk_tree (gimple_call_arg_ptr (stmt, i), convert_tramp_reference_op, | 2635 walk_tree (gimple_call_arg_ptr (stmt, i), convert_tramp_reference_op, |
2561 wi, NULL); | 2636 wi, NULL); |
2562 break; | 2637 break; |
2563 } | 2638 } |
2564 | 2639 |
2640 case GIMPLE_OMP_TEAMS: | |
2641 if (!gimple_omp_teams_host (as_a <gomp_teams *> (stmt))) | |
2642 { | |
2643 *handled_ops_p = false; | |
2644 return NULL_TREE; | |
2645 } | |
2646 goto do_parallel; | |
2647 | |
2565 case GIMPLE_OMP_TARGET: | 2648 case GIMPLE_OMP_TARGET: |
2566 if (!is_gimple_omp_offloaded (stmt)) | 2649 if (!is_gimple_omp_offloaded (stmt)) |
2567 { | 2650 { |
2568 *handled_ops_p = false; | 2651 *handled_ops_p = false; |
2569 return NULL_TREE; | 2652 return NULL_TREE; |
2570 } | 2653 } |
2571 /* FALLTHRU */ | 2654 /* FALLTHRU */ |
2572 case GIMPLE_OMP_PARALLEL: | 2655 case GIMPLE_OMP_PARALLEL: |
2573 case GIMPLE_OMP_TASK: | 2656 case GIMPLE_OMP_TASK: |
2657 do_parallel: | |
2574 { | 2658 { |
2575 tree save_local_var_chain = info->new_local_var_chain; | 2659 tree save_local_var_chain = info->new_local_var_chain; |
2576 walk_gimple_op (stmt, convert_tramp_reference_op, wi); | 2660 walk_gimple_op (stmt, convert_tramp_reference_op, wi); |
2577 info->new_local_var_chain = NULL; | 2661 info->new_local_var_chain = NULL; |
2578 char save_static_chain_added = info->static_chain_added; | 2662 char save_static_chain_added = info->static_chain_added; |
2676 &wi->gsi)); | 2760 &wi->gsi)); |
2677 info->static_chain_added |= (1 << (info->context != target_context)); | 2761 info->static_chain_added |= (1 << (info->context != target_context)); |
2678 } | 2762 } |
2679 break; | 2763 break; |
2680 | 2764 |
2765 case GIMPLE_OMP_TEAMS: | |
2766 if (!gimple_omp_teams_host (as_a <gomp_teams *> (stmt))) | |
2767 { | |
2768 walk_body (convert_gimple_call, NULL, info, | |
2769 gimple_omp_body_ptr (stmt)); | |
2770 break; | |
2771 } | |
2772 /* FALLTHRU */ | |
2773 | |
2681 case GIMPLE_OMP_PARALLEL: | 2774 case GIMPLE_OMP_PARALLEL: |
2682 case GIMPLE_OMP_TASK: | 2775 case GIMPLE_OMP_TASK: |
2683 save_static_chain_added = info->static_chain_added; | 2776 save_static_chain_added = info->static_chain_added; |
2684 info->static_chain_added = 0; | 2777 info->static_chain_added = 0; |
2685 walk_body (convert_gimple_call, NULL, info, gimple_omp_body_ptr (stmt)); | 2778 walk_body (convert_gimple_call, NULL, info, gimple_omp_body_ptr (stmt)); |
2751 gimple_omp_for_pre_body_ptr (stmt)); | 2844 gimple_omp_for_pre_body_ptr (stmt)); |
2752 /* FALLTHRU */ | 2845 /* FALLTHRU */ |
2753 case GIMPLE_OMP_SECTIONS: | 2846 case GIMPLE_OMP_SECTIONS: |
2754 case GIMPLE_OMP_SECTION: | 2847 case GIMPLE_OMP_SECTION: |
2755 case GIMPLE_OMP_SINGLE: | 2848 case GIMPLE_OMP_SINGLE: |
2756 case GIMPLE_OMP_TEAMS: | |
2757 case GIMPLE_OMP_MASTER: | 2849 case GIMPLE_OMP_MASTER: |
2758 case GIMPLE_OMP_TASKGROUP: | 2850 case GIMPLE_OMP_TASKGROUP: |
2759 case GIMPLE_OMP_ORDERED: | 2851 case GIMPLE_OMP_ORDERED: |
2852 case GIMPLE_OMP_SCAN: | |
2760 case GIMPLE_OMP_CRITICAL: | 2853 case GIMPLE_OMP_CRITICAL: |
2761 walk_body (convert_gimple_call, NULL, info, gimple_omp_body_ptr (stmt)); | 2854 walk_body (convert_gimple_call, NULL, info, gimple_omp_body_ptr (stmt)); |
2762 break; | 2855 break; |
2763 | 2856 |
2764 default: | 2857 default: |