aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/gimple.c')
-rw-r--r--gcc/gimple.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 9bc62c0..573dbb1 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -4063,3 +4063,24 @@ nonfreeing_call_p (gimple call)
return false;
}
+
+/* Create a new VAR_DECL and copy information from VAR to it. */
+
+tree
+copy_var_decl (tree var, tree name, tree type)
+{
+ tree copy = build_decl (DECL_SOURCE_LOCATION (var), VAR_DECL, name, type);
+
+ TREE_ADDRESSABLE (copy) = TREE_ADDRESSABLE (var);
+ TREE_THIS_VOLATILE (copy) = TREE_THIS_VOLATILE (var);
+ DECL_GIMPLE_REG_P (copy) = DECL_GIMPLE_REG_P (var);
+ DECL_ARTIFICIAL (copy) = DECL_ARTIFICIAL (var);
+ DECL_IGNORED_P (copy) = DECL_IGNORED_P (var);
+ DECL_CONTEXT (copy) = DECL_CONTEXT (var);
+ TREE_NO_WARNING (copy) = TREE_NO_WARNING (var);
+ TREE_USED (copy) = 1;
+ DECL_SEEN_IN_BIND_EXPR_P (copy) = 1;
+ DECL_ATTRIBUTES (copy) = DECL_ATTRIBUTES (var);
+
+ return copy;
+}