This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 212/236] Use rtx_expr_list for expr_status.x_forced_labels
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: David Malcolm <dmalcolm at redhat dot com>
- Date: Wed, 6 Aug 2014 13:23:11 -0400
- Subject: [PATCH 212/236] Use rtx_expr_list for expr_status.x_forced_labels
- Authentication-results: sourceware.org; auth=none
- References: <1407345815-14551-1-git-send-email-dmalcolm at redhat dot com>
gcc/
* function.h (struct expr_status): Strengthen field
"x_forced_labels" from rtx to rtx_expr_list *.
* cfgbuild.c (make_edges): Split local "x" into two locals,
strengthening one from rtx to rtx_expr_list *, and using methods
of said class.
* dwarf2cfi.c (create_trace_edges): Split local "lab" out; within
loop over forced_labels, introduce strengthen it from rtx to
rtx_expr_list *, using methods to clarify the code.
* jump.c (rebuild_jump_labels_1): Strengthen local "insn" from rtx
to rtx_expr_list *, using methods of said class to clarify the
code.
* reload1.c (set_initial_label_offsets): Split local "x" into two
per-loop variables, strengthening the first from rtx to
rtx_expr_list * and using methods.
---
gcc/cfgbuild.c | 7 +++----
gcc/dwarf2cfi.c | 14 +++++++-------
gcc/function.h | 2 +-
gcc/jump.c | 8 ++++----
gcc/reload1.c | 9 ++++-----
5 files changed, 19 insertions(+), 21 deletions(-)
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index dd6ed7a..05adac0 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -219,7 +219,6 @@ make_edges (basic_block min, basic_block max, int update_p)
FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
{
rtx_insn *insn;
- rtx x;
enum rtx_code code;
edge e;
edge_iterator ei;
@@ -285,8 +284,8 @@ make_edges (basic_block min, basic_block max, int update_p)
everything on the forced_labels list. */
else if (computed_jump_p (insn))
{
- for (x = forced_labels; x; x = XEXP (x, 1))
- make_label_edge (edge_cache, bb, XEXP (x, 0), EDGE_ABNORMAL);
+ for (rtx_expr_list *x = forced_labels; x; x = x->next ())
+ make_label_edge (edge_cache, bb, x->element (), EDGE_ABNORMAL);
}
/* Returns create an exit out. */
@@ -338,7 +337,7 @@ make_edges (basic_block min, basic_block max, int update_p)
taken, then only calls to those functions or to other
nested functions that use them could possibly do
nonlocal gotos. */
- for (x = nonlocal_goto_handler_labels; x; x = XEXP (x, 1))
+ for (rtx x = nonlocal_goto_handler_labels; x; x = XEXP (x, 1))
make_label_edge (edge_cache, bb, XEXP (x, 0),
EDGE_ABNORMAL | EDGE_ABNORMAL_CALL);
}
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 38c60d0..b5ea683 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -2286,7 +2286,7 @@ maybe_record_trace_start_abnormal (rtx start, rtx origin)
static void
create_trace_edges (rtx insn)
{
- rtx tmp, lab;
+ rtx tmp;
int i, n;
if (JUMP_P (insn))
@@ -2303,14 +2303,14 @@ create_trace_edges (rtx insn)
n = GET_NUM_ELEM (vec);
for (i = 0; i < n; ++i)
{
- lab = XEXP (RTVEC_ELT (vec, i), 0);
+ rtx lab = XEXP (RTVEC_ELT (vec, i), 0);
maybe_record_trace_start (lab, insn);
}
}
else if (computed_jump_p (insn))
{
- for (lab = forced_labels; lab; lab = XEXP (lab, 1))
- maybe_record_trace_start (XEXP (lab, 0), insn);
+ for (rtx_expr_list *lab = forced_labels; lab; lab = lab->next ())
+ maybe_record_trace_start (lab->element (), insn);
}
else if (returnjump_p (insn))
;
@@ -2319,13 +2319,13 @@ create_trace_edges (rtx insn)
n = ASM_OPERANDS_LABEL_LENGTH (tmp);
for (i = 0; i < n; ++i)
{
- lab = XEXP (ASM_OPERANDS_LABEL (tmp, i), 0);
+ rtx lab = XEXP (ASM_OPERANDS_LABEL (tmp, i), 0);
maybe_record_trace_start (lab, insn);
}
}
else
{
- lab = JUMP_LABEL (insn);
+ rtx lab = JUMP_LABEL (insn);
gcc_assert (lab != NULL);
maybe_record_trace_start (lab, insn);
}
@@ -2338,7 +2338,7 @@ create_trace_edges (rtx insn)
/* Process non-local goto edges. */
if (can_nonlocal_goto (insn))
- for (lab = nonlocal_goto_handler_labels; lab; lab = XEXP (lab, 1))
+ for (rtx lab = nonlocal_goto_handler_labels; lab; lab = XEXP (lab, 1))
maybe_record_trace_start_abnormal (XEXP (lab, 0), insn);
}
else if (rtx_sequence *seq = dyn_cast <rtx_sequence *> (PATTERN (insn)))
diff --git a/gcc/function.h b/gcc/function.h
index 28a20f3..ba7597c 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -135,7 +135,7 @@ struct GTY(()) expr_status {
rtx x_apply_args_value;
/* List of labels that must never be deleted. */
- rtx x_forced_labels;
+ rtx_expr_list *x_forced_labels;
};
typedef struct call_site_record_d *call_site_record;
diff --git a/gcc/jump.c b/gcc/jump.c
index d24e51f..ca1f2d2 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -74,7 +74,7 @@ static int returnjump_p_1 (rtx *, void *);
static void
rebuild_jump_labels_1 (rtx_insn *f, bool count_forced)
{
- rtx insn;
+ rtx_expr_list *insn;
timevar_push (TV_REBUILD_JUMP);
init_label_info (f);
@@ -85,9 +85,9 @@ rebuild_jump_labels_1 (rtx_insn *f, bool count_forced)
count doesn't drop to zero. */
if (count_forced)
- for (insn = forced_labels; insn; insn = XEXP (insn, 1))
- if (LABEL_P (XEXP (insn, 0)))
- LABEL_NUSES (XEXP (insn, 0))++;
+ for (insn = forced_labels; insn; insn = insn->next ())
+ if (LABEL_P (insn->element ()))
+ LABEL_NUSES (insn->element ())++;
timevar_pop (TV_REBUILD_JUMP);
}
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 6f9ec47..c669043 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -3922,14 +3922,13 @@ set_initial_eh_label_offset (rtx label)
static void
set_initial_label_offsets (void)
{
- rtx x;
memset (offsets_known_at, 0, num_labels);
- for (x = forced_labels; x; x = XEXP (x, 1))
- if (XEXP (x, 0))
- set_label_offsets (XEXP (x, 0), NULL, 1);
+ for (rtx_expr_list *x = forced_labels; x; x = x->next ())
+ if (x->element ())
+ set_label_offsets (x->element (), NULL, 1);
- for (x = nonlocal_goto_handler_labels; x; x = XEXP (x, 1))
+ for (rtx x = nonlocal_goto_handler_labels; x; x = XEXP (x, 1))
if (XEXP (x, 0))
set_label_offsets (XEXP (x, 0), NULL, 1);
--
1.8.5.3