Make insn_addresses_new require an rtx_insn

gcc/
2014-08-28  David Malcolm  <dmalcolm@redhat.com>

	* 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.

From-SVN: r214701
This commit is contained in:
David Malcolm 2014-08-29 00:07:51 +00:00 committed by David Malcolm
parent 3064b94272
commit 17f385d8da
4 changed files with 42 additions and 22 deletions

View File

@ -1,3 +1,21 @@
2014-08-28 David Malcolm <dmalcolm@redhat.com>
* 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.
2014-08-28 David Malcolm <dmalcolm@redhat.com>
* rtl.h (INSN_HAS_LOCATION): Strengthen param from const_rtx to

View File

@ -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);

View File

@ -2856,11 +2856,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
@ -2877,11 +2878,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;
}

View File

@ -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));