diff options
author | drow <drow@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-12 19:28:56 +0000 |
---|---|---|
committer | drow <drow@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-12 19:28:56 +0000 |
commit | 6006f9fd085c65362c5c9a9622e3f127e83420cb (patch) | |
tree | 32fb1749887c1bb5a4613d1d87b18c9a8537c8f4 /gcc/reload.c | |
parent | 27bfe4941e3c5a748285d86747bd1cf891cac299 (diff) | |
download | gcc-6006f9fd085c65362c5c9a9622e3f127e83420cb.tar.gz |
* defaults.h (REGNO_MODE_OK_FOR_BASE_P, REG_MODE_OK_FOR_BASE_P)
(MODE_BASE_REG_REG_CLASS, REGNO_MODE_OK_FOR_REG_BASE_P)
(REG_MODE_OK_FOR_REG_BASE_P): Provide default definitions.
* regclass.c (record_address_regs): Remove ifdef. Use
REG_MODE_OK_FOR_REG_BASE_P and MODE_BASE_REG_REG_CLASS.
* regrename.c (REG_MODE_OK_FOR_BASE_P): Remove unnecessary
definition.
(scan_rtx_address, replace_oldest_value_addr): Use
REG_MODE_OK_FOR_REG_BASE_P and MODE_BASE_REG_REG_CLASS.
* reload.c (REGNO_MODE_OK_FOR_BASE_P, REG_MODE_OK_FOR_BASE_P): Remove
unnecessary definitions.
(find_reloads_address_1): Support REG_MODE_OK_FOR_REG_BASE_P
and MODE_BASE_REG_REG_CLASS.
* config/arm/arm.h (MODE_BASE_REG_CLASS): Don't check reload_completed.
(MODE_BASE_REG_REG_CLASS): Define.
(REGNO_MODE_OK_FOR_REG_BASE_P): Define.
(REG_MODE_OK_FOR_REG_BASE_P): Define.
* doc/tm.texi (Register Classes): Document MODE_BASE_REG_REG_CLASS,
REG_MODE_OK_FOR_REG_BASE_P, and REGNO_MODE_OK_FOR_REG_BASE_P.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88948 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reload.c')
-rw-r--r-- | gcc/reload.c | 83 |
1 files changed, 41 insertions, 42 deletions
diff --git a/gcc/reload.c b/gcc/reload.c index f3c5978164e..f6a008d957d 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -108,14 +108,6 @@ a register with any other reload. */ #include "params.h" #include "target.h" -#ifndef REGNO_MODE_OK_FOR_BASE_P -#define REGNO_MODE_OK_FOR_BASE_P(REGNO, MODE) REGNO_OK_FOR_BASE_P (REGNO) -#endif - -#ifndef REG_MODE_OK_FOR_BASE_P -#define REG_MODE_OK_FOR_BASE_P(REGNO, MODE) REG_OK_FOR_BASE_P (REGNO) -#endif - /* True if X is a constant that can be forced into the constant pool. */ #define CONST_POOL_OK_P(X) \ (CONSTANT_P (X) \ @@ -5227,7 +5219,8 @@ update_auto_inc_notes (rtx insn ATTRIBUTE_UNUSED, int regno ATTRIBUTE_UNUSED, is strictly valid.) CONTEXT = 1 means we are considering regs as index regs, - = 0 means we are considering them as base regs. + = 0 means we are considering them as base regs, = 2 means we + are considering them as base regs for REG + REG. OPNUM and TYPE specify the purpose of any reloads made. @@ -5250,8 +5243,23 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, rtx *loc, int opnum, enum reload_type type, int ind_levels, rtx insn) { +#define REG_OK_FOR_CONTEXT(CONTEXT, REGNO, MODE) \ + ((CONTEXT) == 2 \ + ? REGNO_MODE_OK_FOR_REG_BASE_P (REGNO, MODE) \ + : (CONTEXT) == 1 \ + ? REGNO_OK_FOR_INDEX_P (REGNO) \ + : REGNO_MODE_OK_FOR_BASE_P (REGNO, MODE)) + + enum reg_class context_reg_class; RTX_CODE code = GET_CODE (x); + if (context == 2) + context_reg_class = MODE_BASE_REG_REG_CLASS (mode); + else if (context == 1) + context_reg_class = INDEX_REG_CLASS; + else + context_reg_class = MODE_BASE_REG_CLASS (mode); + switch (code) { case PLUS: @@ -5294,12 +5302,12 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, register remateralization for expression like &localvar*4. Reload it. It may be possible to combine the displacement on the outer level, but it is probably not worthwhile to do so. */ - if (context) + if (context == 1) { find_reloads_address (GET_MODE (x), loc, XEXP (x, 0), &XEXP (x, 0), opnum, ADDR_TYPE (type), ind_levels, insn); push_reload (*loc, NULL_RTX, loc, (rtx*) 0, - (context ? INDEX_REG_CLASS : MODE_BASE_REG_CLASS (mode)), + context_reg_class, GET_MODE (x), VOIDmode, 0, 0, opnum, type); return 1; } @@ -5335,22 +5343,22 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, else if (code0 == REG && code1 == REG) { if (REG_OK_FOR_INDEX_P (op0) - && REG_MODE_OK_FOR_BASE_P (op1, mode)) + && REG_MODE_OK_FOR_REG_BASE_P (op1, mode)) return 0; else if (REG_OK_FOR_INDEX_P (op1) - && REG_MODE_OK_FOR_BASE_P (op0, mode)) + && REG_MODE_OK_FOR_REG_BASE_P (op0, mode)) return 0; - else if (REG_MODE_OK_FOR_BASE_P (op1, mode)) + else if (REG_MODE_OK_FOR_REG_BASE_P (op1, mode)) find_reloads_address_1 (mode, orig_op0, 1, &XEXP (x, 0), opnum, type, ind_levels, insn); - else if (REG_MODE_OK_FOR_BASE_P (op0, mode)) + else if (REG_MODE_OK_FOR_REG_BASE_P (op0, mode)) find_reloads_address_1 (mode, orig_op1, 1, &XEXP (x, 1), opnum, type, ind_levels, insn); else if (REG_OK_FOR_INDEX_P (op1)) - find_reloads_address_1 (mode, orig_op0, 0, &XEXP (x, 0), opnum, + find_reloads_address_1 (mode, orig_op0, 2, &XEXP (x, 0), opnum, type, ind_levels, insn); else if (REG_OK_FOR_INDEX_P (op0)) - find_reloads_address_1 (mode, orig_op1, 0, &XEXP (x, 1), opnum, + find_reloads_address_1 (mode, orig_op1, 2, &XEXP (x, 1), opnum, type, ind_levels, insn); else { @@ -5514,9 +5522,8 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, if (reg_renumber[regno] >= 0) regno = reg_renumber[regno]; - if ((regno >= FIRST_PSEUDO_REGISTER - || !(context ? REGNO_OK_FOR_INDEX_P (regno) - : REGNO_MODE_OK_FOR_BASE_P (regno, mode)))) + if (regno >= FIRST_PSEUDO_REGISTER + || !REG_OK_FOR_CONTEXT (context, regno, mode)) { int reloadnum; @@ -5552,8 +5559,7 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, x = XEXP (x, 0); reloadnum = push_reload (x, x, loc, loc, - (context ? INDEX_REG_CLASS : - MODE_BASE_REG_CLASS (mode)), + context_reg_class, GET_MODE (x), GET_MODE (x), 0, 0, opnum, RELOAD_OTHER); } @@ -5561,8 +5567,7 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, { reloadnum = push_reload (x, NULL_RTX, loc, (rtx*) 0, - (context ? INDEX_REG_CLASS : - MODE_BASE_REG_CLASS (mode)), + context_reg_class, GET_MODE (x), GET_MODE (x), 0, 0, opnum, type); rld[reloadnum].inc @@ -5602,8 +5607,7 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, opnum, type, ind_levels, insn); reloadnum = push_reload (x, NULL_RTX, loc, (rtx*) 0, - (context ? INDEX_REG_CLASS : - MODE_BASE_REG_CLASS (mode)), + context_reg_class, GET_MODE (x), VOIDmode, 0, 0, opnum, type); rld[reloadnum].inc = find_inc_amount (PATTERN (this_insn), XEXP (x, 0)); @@ -5632,7 +5636,7 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, find_reloads_address (GET_MODE (x), loc, XEXP (x, 0), &XEXP (x, 0), opnum, ADDR_TYPE (type), ind_levels, insn); push_reload (*loc, NULL_RTX, loc, (rtx*) 0, - (context ? INDEX_REG_CLASS : MODE_BASE_REG_CLASS (mode)), + context_reg_class, GET_MODE (x), VOIDmode, 0, 0, opnum, type); return 1; @@ -5643,8 +5647,7 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, if (reg_equiv_constant[regno] != 0) { find_reloads_address_part (reg_equiv_constant[regno], loc, - (context ? INDEX_REG_CLASS : - MODE_BASE_REG_CLASS (mode)), + context_reg_class, GET_MODE (x), opnum, type, ind_levels); return 1; } @@ -5654,8 +5657,7 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, if (reg_equiv_mem[regno] != 0) { push_reload (reg_equiv_mem[regno], NULL_RTX, loc, (rtx*) 0, - (context ? INDEX_REG_CLASS : - MODE_BASE_REG_CLASS (mode)), + context_reg_class, GET_MODE (x), VOIDmode, 0, 0, opnum, type); return 1; } @@ -5678,12 +5680,11 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, if (reg_renumber[regno] >= 0) regno = reg_renumber[regno]; - if ((regno >= FIRST_PSEUDO_REGISTER - || !(context ? REGNO_OK_FOR_INDEX_P (regno) - : REGNO_MODE_OK_FOR_BASE_P (regno, mode)))) + if (regno >= FIRST_PSEUDO_REGISTER + || !REG_OK_FOR_CONTEXT (context, regno, mode)) { push_reload (x, NULL_RTX, loc, (rtx*) 0, - (context ? INDEX_REG_CLASS : MODE_BASE_REG_CLASS (mode)), + context_reg_class, GET_MODE (x), VOIDmode, 0, 0, opnum, type); return 1; } @@ -5695,7 +5696,7 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, if (regno_clobbered_p (regno, this_insn, GET_MODE (x), 0)) { push_reload (x, NULL_RTX, loc, (rtx*) 0, - (context ? INDEX_REG_CLASS : MODE_BASE_REG_CLASS (mode)), + context_reg_class, GET_MODE (x), VOIDmode, 0, 0, opnum, type); return 1; } @@ -5712,12 +5713,10 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, { int regno ATTRIBUTE_UNUSED = subreg_regno (x); - if (! (context ? REGNO_OK_FOR_INDEX_P (regno) - : REGNO_MODE_OK_FOR_BASE_P (regno, mode))) + if (! REG_OK_FOR_CONTEXT (context, regno, mode)) { push_reload (x, NULL_RTX, loc, (rtx*) 0, - (context ? INDEX_REG_CLASS : - MODE_BASE_REG_CLASS (mode)), + context_reg_class, GET_MODE (x), VOIDmode, 0, 0, opnum, type); return 1; } @@ -5726,8 +5725,7 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, is larger than the class size, then reload the whole SUBREG. */ else { - enum reg_class class = (context ? INDEX_REG_CLASS - : MODE_BASE_REG_CLASS (mode)); + enum reg_class class = context_reg_class; if ((unsigned) CLASS_MAX_NREGS (class, GET_MODE (SUBREG_REG (x))) > reg_class_size[class]) { @@ -5757,6 +5755,7 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, } } +#undef REG_OK_FOR_CONTEXT return 0; } |