diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 82f6aad914b..a3619d8ce6d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2002-03-15 Stephane Carrez + + * config/m68hc11/m68hc11.c (m68hc11_small_indexed_indirect_p): Look + for reg_equiv_memory_loc when the operand is a register that does + not get a hard register (stack location). + (tst_operand): After reload, accept all memory operand. + (symbolic_memory_operand): Fix detection of symbolic references. + * config/m68hc11/m68hc11.h (VALID_CONSTANT_OFFSET_P): For 68HC12 + accept symbols and any constant. + 2002-03-15 Stephane Carrez * config/m68hc11/m68hc11.c (emit_move_after_reload): Add a REG_INC diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index e9b1bb9e31b..bcaeae61664 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -551,6 +551,14 @@ m68hc11_small_indexed_indirect_p (operand, mode) { rtx base, offset; + if (GET_CODE (operand) == REG && reload_in_progress + && REGNO (operand) >= FIRST_PSEUDO_REGISTER + && reg_equiv_memory_loc[REGNO (operand)]) + { + operand = reg_equiv_memory_loc[REGNO (operand)]; + operand = eliminate_regs (operand, 0, NULL_RTX); + } + if (GET_CODE (operand) != MEM) return 0; @@ -561,8 +569,7 @@ m68hc11_small_indexed_indirect_p (operand, mode) if (PUSH_POP_ADDRESS_P (operand)) return 1; - if (!register_indirect_p (operand, mode, - (reload_completed | reload_in_progress))) + if (!register_indirect_p (operand, mode, reload_completed)) return 0; if (TARGET_M6812 && GET_CODE (operand) == PLUS @@ -570,6 +577,12 @@ m68hc11_small_indexed_indirect_p (operand, mode) { base = XEXP (operand, 0); offset = XEXP (operand, 1); + + /* The offset can be a symbol address and this is too big + for the operand constraint. */ + if (GET_CODE (base) != CONST_INT && GET_CODE (offset) != CONST_INT) + return 0; + if (GET_CODE (base) == CONST_INT) offset = base; @@ -853,7 +866,7 @@ tst_operand (operand, mode) rtx operand; enum machine_mode mode; { - if (GET_CODE (operand) == MEM) + if (GET_CODE (operand) == MEM && reload_completed == 0) { rtx addr = XEXP (operand, 0); if (m68hc11_auto_inc_p (addr)) @@ -1010,6 +1023,7 @@ symbolic_memory_operand (op, mode) return 1; case CONST: + op = XEXP (op, 0); return ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF || GET_CODE (XEXP (op, 0)) == LABEL_REF) && GET_CODE (XEXP (op, 1)) == CONST_INT); diff --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h index 829e244a51a..ee2a805b2ef 100644 --- a/gcc/config/m68hc11/m68hc11.h +++ b/gcc/config/m68hc11/m68hc11.h @@ -1275,10 +1275,14 @@ extern unsigned char m68hc11_reg_valid_for_index[FIRST_PSEUDO_REGISTER]; a mode offset to access the lowest part of the data. (For example, for an SImode, the last valid offset is 252.) */ #define VALID_CONSTANT_OFFSET_P(X,MODE) \ -((GET_CODE (X) == CONST_INT) && \ - ((INTVAL (X) >= VALID_MIN_OFFSET) \ - && ((INTVAL (X) <= VALID_MAX_OFFSET \ - - (HOST_WIDE_INT) (GET_MODE_SIZE (MODE) + 1))))) +(((GET_CODE (X) == CONST_INT) && \ + ((INTVAL (X) >= VALID_MIN_OFFSET) \ + && ((INTVAL (X) <= VALID_MAX_OFFSET \ + - (HOST_WIDE_INT) (GET_MODE_SIZE (MODE) + 1))))) \ +|| (TARGET_M6812 \ + && ((GET_CODE (X) == SYMBOL_REF) \ + || GET_CODE (X) == LABEL_REF \ + || GET_CODE (X) == CONST))) /* This is included to allow stack push/pop operations. Special hacks in the md and m6811.c files exist to support this. */