aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-nested.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-nested.cc')
-rw-r--r--gcc/tree-nested.cc69
1 files changed, 38 insertions, 31 deletions
diff --git a/gcc/tree-nested.cc b/gcc/tree-nested.cc
index c8f07f78185..fc0495d6443 100644
--- a/gcc/tree-nested.cc
+++ b/gcc/tree-nested.cc
@@ -1047,6 +1047,37 @@ get_frame_field (struct nesting_info *info, tree target_context,
static void note_nonlocal_vla_type (struct nesting_info *info, tree type);
+/* Helper for get_nonlocal_debug_decl and get_local_debug_decl. */
+
+static tree
+get_debug_decl (tree decl)
+{
+ tree new_decl
+ = build_decl (DECL_SOURCE_LOCATION (decl),
+ VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl));
+ DECL_ARTIFICIAL (new_decl) = DECL_ARTIFICIAL (decl);
+ DECL_IGNORED_P (new_decl) = DECL_IGNORED_P (decl);
+ TREE_THIS_VOLATILE (new_decl) = TREE_THIS_VOLATILE (decl);
+ TREE_SIDE_EFFECTS (new_decl) = TREE_SIDE_EFFECTS (decl);
+ TREE_READONLY (new_decl) = TREE_READONLY (decl);
+ TREE_ADDRESSABLE (new_decl) = TREE_ADDRESSABLE (decl);
+ DECL_SEEN_IN_BIND_EXPR_P (new_decl) = 1;
+ if ((TREE_CODE (decl) == PARM_DECL
+ || TREE_CODE (decl) == RESULT_DECL
+ || VAR_P (decl))
+ && DECL_BY_REFERENCE (decl))
+ DECL_BY_REFERENCE (new_decl) = 1;
+ /* Copy DECL_LANG_SPECIFIC and DECL_LANG_FLAG_* for OpenMP langhook
+ purposes. */
+ DECL_LANG_SPECIFIC (new_decl) = DECL_LANG_SPECIFIC (decl);
+#define COPY_DLF(n) DECL_LANG_FLAG_##n (new_decl) = DECL_LANG_FLAG_##n (decl)
+ COPY_DLF (0); COPY_DLF (1); COPY_DLF (2); COPY_DLF (3);
+ COPY_DLF (4); COPY_DLF (5); COPY_DLF (6); COPY_DLF (7);
+ COPY_DLF (8);
+#undef COPY_DLF
+ return new_decl;
+}
+
/* A subroutine of convert_nonlocal_reference_op. Create a local variable
in the nested function with DECL_VALUE_EXPR set to reference the true
variable in the parent function. This is used both for debug info
@@ -1094,21 +1125,8 @@ get_nonlocal_debug_decl (struct nesting_info *info, tree decl)
x = build_simple_mem_ref_notrap (x);
/* ??? We should be remapping types as well, surely. */
- new_decl = build_decl (DECL_SOURCE_LOCATION (decl),
- VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl));
+ new_decl = get_debug_decl (decl);
DECL_CONTEXT (new_decl) = info->context;
- DECL_ARTIFICIAL (new_decl) = DECL_ARTIFICIAL (decl);
- DECL_IGNORED_P (new_decl) = DECL_IGNORED_P (decl);
- TREE_THIS_VOLATILE (new_decl) = TREE_THIS_VOLATILE (decl);
- TREE_SIDE_EFFECTS (new_decl) = TREE_SIDE_EFFECTS (decl);
- TREE_READONLY (new_decl) = TREE_READONLY (decl);
- TREE_ADDRESSABLE (new_decl) = TREE_ADDRESSABLE (decl);
- DECL_SEEN_IN_BIND_EXPR_P (new_decl) = 1;
- if ((TREE_CODE (decl) == PARM_DECL
- || TREE_CODE (decl) == RESULT_DECL
- || VAR_P (decl))
- && DECL_BY_REFERENCE (decl))
- DECL_BY_REFERENCE (new_decl) = 1;
SET_DECL_VALUE_EXPR (new_decl, x);
DECL_HAS_VALUE_EXPR_P (new_decl) = 1;
@@ -1892,21 +1910,8 @@ get_local_debug_decl (struct nesting_info *info, tree decl, tree field)
x = info->frame_decl;
x = build3 (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
- new_decl = build_decl (DECL_SOURCE_LOCATION (decl),
- VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl));
+ new_decl = get_debug_decl (decl);
DECL_CONTEXT (new_decl) = info->context;
- DECL_ARTIFICIAL (new_decl) = DECL_ARTIFICIAL (decl);
- DECL_IGNORED_P (new_decl) = DECL_IGNORED_P (decl);
- TREE_THIS_VOLATILE (new_decl) = TREE_THIS_VOLATILE (decl);
- TREE_SIDE_EFFECTS (new_decl) = TREE_SIDE_EFFECTS (decl);
- TREE_READONLY (new_decl) = TREE_READONLY (decl);
- TREE_ADDRESSABLE (new_decl) = TREE_ADDRESSABLE (decl);
- DECL_SEEN_IN_BIND_EXPR_P (new_decl) = 1;
- if ((TREE_CODE (decl) == PARM_DECL
- || TREE_CODE (decl) == RESULT_DECL
- || VAR_P (decl))
- && DECL_BY_REFERENCE (decl))
- DECL_BY_REFERENCE (new_decl) = 1;
SET_DECL_VALUE_EXPR (new_decl, x);
DECL_HAS_VALUE_EXPR_P (new_decl) = 1;
@@ -2901,9 +2906,11 @@ convert_tramp_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
continue;
decl = i ? get_chain_decl (info) : info->frame_decl;
/* Don't add CHAIN.* or FRAME.* twice. */
- for (c = gimple_omp_taskreg_clauses (stmt);
- c;
- c = OMP_CLAUSE_CHAIN (c))
+ if (gimple_code (stmt) == GIMPLE_OMP_TARGET)
+ c = gimple_omp_target_clauses (stmt);
+ else
+ c = gimple_omp_taskreg_clauses (stmt);
+ for (; c; c = OMP_CLAUSE_CHAIN (c))
if ((OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE
|| OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SHARED)
&& OMP_CLAUSE_DECL (c) == decl)