aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cfgexpand.c5
-rw-r--r--gcc/ipa-param-manipulation.c5
-rw-r--r--gcc/omp-simd-clone.c5
-rw-r--r--gcc/tree-ssa-ccp.c5
-rw-r--r--gcc/tree-ssa-phiopt.c10
-rw-r--r--gcc/tree-ssa-reassoc.c5
-rw-r--r--gcc/tree.c12
-rw-r--r--gcc/tree.h1
8 files changed, 20 insertions, 28 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 01d0cdc..55ff75b 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -4341,11 +4341,8 @@ avoid_deep_ter_for_debug (gimple *stmt, int depth)
tree &vexpr = deep_ter_debug_map->get_or_insert (use);
if (vexpr != NULL)
continue;
- vexpr = make_node (DEBUG_EXPR_DECL);
+ vexpr = build_debug_expr_decl (TREE_TYPE (use));
gimple *def_temp = gimple_build_debug_bind (vexpr, use, g);
- DECL_ARTIFICIAL (vexpr) = 1;
- TREE_TYPE (vexpr) = TREE_TYPE (use);
- SET_DECL_MODE (vexpr, TYPE_MODE (TREE_TYPE (use)));
gimple_stmt_iterator gsi = gsi_for_stmt (g);
gsi_insert_after (&gsi, def_temp, GSI_NEW_STMT);
avoid_deep_ter_for_debug (def_temp, 0);
diff --git a/gcc/ipa-param-manipulation.c b/gcc/ipa-param-manipulation.c
index 4610fc4..ae31497 100644
--- a/gcc/ipa-param-manipulation.c
+++ b/gcc/ipa-param-manipulation.c
@@ -1200,10 +1200,7 @@ ipa_param_body_adjustments::prepare_debug_expressions (tree dead_ssa)
= unshare_expr_without_location (gimple_assign_rhs_to_tree (def));
remap_with_debug_expressions (&val);
- tree vexpr = make_node (DEBUG_EXPR_DECL);
- DECL_ARTIFICIAL (vexpr) = 1;
- TREE_TYPE (vexpr) = TREE_TYPE (val);
- SET_DECL_MODE (vexpr, TYPE_MODE (TREE_TYPE (val)));
+ tree vexpr = build_debug_expr_decl (TREE_TYPE (val));
m_dead_stmt_debug_equiv.put (def, val);
m_dead_ssa_debug_equiv.put (dead_ssa, vexpr);
return true;
diff --git a/gcc/omp-simd-clone.c b/gcc/omp-simd-clone.c
index b772b7f..4d43a86 100644
--- a/gcc/omp-simd-clone.c
+++ b/gcc/omp-simd-clone.c
@@ -910,11 +910,8 @@ ipa_simd_modify_stmt_ops (tree *tp, int *walk_subtrees, void *data)
gimple *stmt;
if (is_gimple_debug (info->stmt))
{
- tree vexpr = make_node (DEBUG_EXPR_DECL);
+ tree vexpr = build_debug_expr_decl (TREE_TYPE (repl));
stmt = gimple_build_debug_source_bind (vexpr, repl, NULL);
- DECL_ARTIFICIAL (vexpr) = 1;
- TREE_TYPE (vexpr) = TREE_TYPE (repl);
- SET_DECL_MODE (vexpr, TYPE_MODE (TREE_TYPE (repl)));
repl = vexpr;
}
else
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 70ce6a4..60ae5e6 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -3452,10 +3452,7 @@ optimize_atomic_bit_test_and (gimple_stmt_iterator *gsip,
tree temp = NULL_TREE;
if (!throws || after || single_pred_p (e->dest))
{
- temp = make_node (DEBUG_EXPR_DECL);
- DECL_ARTIFICIAL (temp) = 1;
- TREE_TYPE (temp) = TREE_TYPE (lhs);
- SET_DECL_MODE (temp, TYPE_MODE (TREE_TYPE (lhs)));
+ temp = build_debug_expr_decl (TREE_TYPE (lhs));
tree t = build2 (LSHIFT_EXPR, TREE_TYPE (lhs), new_lhs, bit);
g = gimple_build_debug_bind (temp, t, g);
if (throws && !after)
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 0e339c4..173ac83 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -2429,19 +2429,13 @@ spaceship_replacement (basic_block cond_bb, basic_block middle_bb,
all floating point numbers should be comparable. */
gimple_stmt_iterator gsi = gsi_after_labels (gimple_bb (phi));
tree type = TREE_TYPE (phires);
- tree temp1 = make_node (DEBUG_EXPR_DECL);
- DECL_ARTIFICIAL (temp1) = 1;
- TREE_TYPE (temp1) = type;
- SET_DECL_MODE (temp1, TYPE_MODE (type));
+ tree temp1 = build_debug_expr_decl (type);
tree t = build2 (one_cmp, boolean_type_node, lhs1, rhs2);
t = build3 (COND_EXPR, type, t, build_one_cst (type),
build_int_cst (type, -1));
gimple *g = gimple_build_debug_bind (temp1, t, phi);
gsi_insert_before (&gsi, g, GSI_SAME_STMT);
- tree temp2 = make_node (DEBUG_EXPR_DECL);
- DECL_ARTIFICIAL (temp2) = 1;
- TREE_TYPE (temp2) = type;
- SET_DECL_MODE (temp2, TYPE_MODE (type));
+ tree temp2 = build_debug_expr_decl (type);
t = build2 (EQ_EXPR, boolean_type_node, lhs1, rhs2);
t = build3 (COND_EXPR, type, t, build_zero_cst (type), temp1);
g = gimple_build_debug_bind (temp2, t, phi);
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index db9fb4e..6a555e7 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -1259,15 +1259,12 @@ make_new_ssa_for_def (gimple *stmt, enum tree_code opcode, tree op)
{
if (new_debug_lhs == NULL_TREE)
{
- new_debug_lhs = make_node (DEBUG_EXPR_DECL);
+ new_debug_lhs = build_debug_expr_decl (TREE_TYPE (lhs));
gdebug *def_temp
= gimple_build_debug_bind (new_debug_lhs,
build2 (opcode, TREE_TYPE (lhs),
new_lhs, op),
stmt);
- DECL_ARTIFICIAL (new_debug_lhs) = 1;
- TREE_TYPE (new_debug_lhs) = TREE_TYPE (lhs);
- SET_DECL_MODE (new_debug_lhs, TYPE_MODE (TREE_TYPE (lhs)));
gimple_set_uid (def_temp, gimple_uid (stmt));
gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
gsi_insert_after (&gsi, def_temp, GSI_SAME_STMT);
diff --git a/gcc/tree.c b/gcc/tree.c
index 7bfd641..845228a 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5280,6 +5280,18 @@ build_decl (location_t loc, enum tree_code code, tree name,
return t;
}
+/* Create and return a DEBUG_EXPR_DECL node of the given TYPE. */
+
+tree
+build_debug_expr_decl (tree type)
+{
+ tree vexpr = make_node (DEBUG_EXPR_DECL);
+ DECL_ARTIFICIAL (vexpr) = 1;
+ TREE_TYPE (vexpr) = type;
+ SET_DECL_MODE (vexpr, TYPE_MODE (type));
+ return vexpr;
+}
+
/* Builds and returns function declaration with NAME and TYPE. */
tree
diff --git a/gcc/tree.h b/gcc/tree.h
index 7542d97..f62c00b 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4567,6 +4567,7 @@ extern tree build_tree_list (tree, tree CXX_MEM_STAT_INFO);
extern tree build_tree_list_vec (const vec<tree, va_gc> * CXX_MEM_STAT_INFO);
extern tree build_decl (location_t, enum tree_code,
tree, tree CXX_MEM_STAT_INFO);
+extern tree build_debug_expr_decl (tree type);
extern tree build_fn_decl (const char *, tree);
extern tree build_translation_unit_decl (tree);
extern tree build_block (tree, tree, tree, tree);