This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 231/236] Make insn_addresses_new require an rtx_insn
- 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:30 -0400
- Subject: [PATCH 231/236] Make insn_addresses_new require an rtx_insn
- Authentication-results: sourceware.org; auth=none
- References: <1407345815-14551-1-git-send-email-dmalcolm at redhat dot com>
This affects the INSN_ADDRESSES_NEW macro, which is defined in terms of
insn_addresses_new.
gcc/
* insn-addr.h (insn_addresses_new): Strengthen param "insn" from
rtx to rtx_insn *.
* config/s390/s390.c (s390_split_branches): Eliminate top-level
local rtx "tmp", in favor of new local rtx "mem" and rtx_insn *
"set_insn".
(s390_mainpool_finish): In three places, split out a local rtx
"insn" into a local rtx - "set" or "pat" - and a rtx_insn *
"insn". Strengthen local "pool_end" from rtx to rtx_code_label *
and split another local rtx "insn" out into rtx "pat" and
rtx_insn * "insn".
* config/sh/sh.c (output_branchy_insn): Rather than working
directly on operands[9], introduce local rtx_code_label *
variables named "lab" in two places, working on them, and then
assigning them to operands[9], so that the intervening operations
are known by the type system to be on insns.
---
gcc/config/s390/s390.c | 30 +++++++++++++++---------------
gcc/config/sh/sh.c | 14 ++++++++------
gcc/insn-addr.h | 2 +-
3 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 027a399..b75652d 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -6030,7 +6030,7 @@ s390_split_branches (void)
rtx temp_reg = gen_rtx_REG (Pmode, RETURN_REGNUM);
int new_literal = 0, ret;
rtx_insn *insn;
- rtx pat, tmp, target;
+ rtx pat, target;
rtx *label;
/* We need correct insn addresses. */
@@ -6076,10 +6076,10 @@ s390_split_branches (void)
if (!flag_pic)
{
new_literal = 1;
- tmp = force_const_mem (Pmode, *label);
- tmp = emit_insn_before (gen_rtx_SET (Pmode, temp_reg, tmp), insn);
- INSN_ADDRESSES_NEW (tmp, -1);
- annotate_constant_pool_refs (&PATTERN (tmp));
+ rtx mem = force_const_mem (Pmode, *label);
+ rtx_insn *set_insn = emit_insn_before (gen_rtx_SET (Pmode, temp_reg, mem), insn);
+ INSN_ADDRESSES_NEW (set_insn, -1);
+ annotate_constant_pool_refs (&PATTERN (set_insn));
target = temp_reg;
}
@@ -6090,9 +6090,9 @@ s390_split_branches (void)
UNSPEC_LTREL_OFFSET);
target = gen_rtx_CONST (Pmode, target);
target = force_const_mem (Pmode, target);
- tmp = emit_insn_before (gen_rtx_SET (Pmode, temp_reg, target), insn);
- INSN_ADDRESSES_NEW (tmp, -1);
- annotate_constant_pool_refs (&PATTERN (tmp));
+ rtx_insn *set_insn = emit_insn_before (gen_rtx_SET (Pmode, temp_reg, target), insn);
+ INSN_ADDRESSES_NEW (set_insn, -1);
+ annotate_constant_pool_refs (&PATTERN (set_insn));
target = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, XEXP (target, 0),
cfun->machine->base_reg),
@@ -6759,8 +6759,8 @@ s390_mainpool_finish (struct constant_pool *pool)
located in the .rodata section, so we emit it after the function. */
if (TARGET_CPU_ZARCH)
{
- rtx insn = gen_main_base_64 (base_reg, pool->label);
- insn = emit_insn_after (insn, pool->pool_insn);
+ rtx set = gen_main_base_64 (base_reg, pool->label);
+ rtx_insn *insn = emit_insn_after (set, pool->pool_insn);
INSN_ADDRESSES_NEW (insn, -1);
remove_insn (pool->pool_insn);
@@ -6777,8 +6777,8 @@ s390_mainpool_finish (struct constant_pool *pool)
else if (INSN_ADDRESSES (INSN_UID (pool->emit_pool_after))
+ pool->size + 8 /* alignment slop */ < 4096)
{
- rtx insn = gen_main_base_31_small (base_reg, pool->label);
- insn = emit_insn_after (insn, pool->pool_insn);
+ rtx set = gen_main_base_31_small (base_reg, pool->label);
+ rtx_insn *insn = emit_insn_after (set, pool->pool_insn);
INSN_ADDRESSES_NEW (insn, -1);
remove_insn (pool->pool_insn);
@@ -6800,10 +6800,10 @@ s390_mainpool_finish (struct constant_pool *pool)
over it, setting up the pool register at the same time. */
else
{
- rtx pool_end = gen_label_rtx ();
+ rtx_code_label *pool_end = gen_label_rtx ();
- rtx insn = gen_main_base_31_large (base_reg, pool->label, pool_end);
- insn = emit_jump_insn_after (insn, pool->pool_insn);
+ rtx pat = gen_main_base_31_large (base_reg, pool->label, pool_end);
+ rtx_insn *insn = emit_jump_insn_after (pat, pool->pool_insn);
JUMP_LABEL (insn) = pool_end;
INSN_ADDRESSES_NEW (insn, -1);
remove_insn (pool->pool_insn);
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index f7f6e70..56c319a 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -2849,11 +2849,12 @@ output_branchy_insn (enum rtx_code code, const char *templ,
if (GET_CODE (src) == IF_THEN_ELSE && GET_CODE (XEXP (src, 0)) != code)
{
/* Following branch not taken */
- operands[9] = gen_label_rtx ();
- emit_label_after (operands[9], next_insn);
- INSN_ADDRESSES_NEW (operands[9],
+ rtx_code_label *lab = gen_label_rtx ();
+ emit_label_after (lab, next_insn);
+ INSN_ADDRESSES_NEW (lab,
INSN_ADDRESSES (INSN_UID (next_insn))
+ get_attr_length (next_insn));
+ operands[9] = lab;
return templ;
}
else
@@ -2870,11 +2871,12 @@ output_branchy_insn (enum rtx_code code, const char *templ,
}
}
}
- operands[9] = gen_label_rtx ();
- emit_label_after (operands[9], insn);
- INSN_ADDRESSES_NEW (operands[9],
+ rtx_code_label *lab = gen_label_rtx ();
+ emit_label_after (lab, insn);
+ INSN_ADDRESSES_NEW (lab,
INSN_ADDRESSES (INSN_UID (insn))
+ get_attr_length (insn));
+ operands[9] = lab;
return templ;
}
diff --git a/gcc/insn-addr.h b/gcc/insn-addr.h
index aec09fd..e255ac4 100644
--- a/gcc/insn-addr.h
+++ b/gcc/insn-addr.h
@@ -38,7 +38,7 @@ extern int insn_current_address;
#define INSN_ADDRESSES_SIZE() (insn_addresses_.length ())
static inline void
-insn_addresses_new (rtx insn, int insn_addr)
+insn_addresses_new (rtx_insn *insn, int insn_addr)
{
unsigned insn_uid = INSN_UID ((insn));
--
1.8.5.3