From 17f385d8dabbfff8eeb45012d63c8cd232958330 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Fri, 29 Aug 2014 00:07:51 +0000 Subject: [PATCH] Make insn_addresses_new require an rtx_insn gcc/ 2014-08-28 David Malcolm * 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 --- gcc/ChangeLog | 18 ++++++++++++++++++ gcc/config/s390/s390.c | 30 +++++++++++++++--------------- gcc/config/sh/sh.c | 14 ++++++++------ gcc/insn-addr.h | 2 +- 4 files changed, 42 insertions(+), 22 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1c6df0d03cb..a928f92f9e1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2014-08-28 David Malcolm + + * 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 * rtl.h (INSN_HAS_LOCATION): Strengthen param from const_rtx to diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index fbaef4594bd..5933b96b442 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 11657130595..dbfaade91b6 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -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; } diff --git a/gcc/insn-addr.h b/gcc/insn-addr.h index aec09fd102c..e255ac48f50 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)); -- 2.30.2