Commit 2cc11a88 by Georg-Johann Lay Committed by Georg-Johann Lay

avr.c (print_operand): Support code = 'i' for CONST_INT.

	* config/avr/avr.c (print_operand): Support code = 'i' for CONST_INT.

From-SVN: r181722
parent 0c1e7e42
2011-11-25 Georg-Johann Lay <avr@gjlay.de>
* config/avr/avr.c (print_operand): Support code = 'i' for CONST_INT.
2011-11-24 Andrew MacLeod <amacleod@redhat.com>
PR other/51011
......@@ -1822,9 +1822,32 @@ print_operand (FILE *file, rtx x, int code)
else
fprintf (file, reg_names[true_regnum (x) + abcd]);
}
else if (GET_CODE (x) == CONST_INT)
fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x) + abcd);
else if (GET_CODE (x) == MEM)
else if (CONST_INT_P (x))
{
HOST_WIDE_INT ival = INTVAL (x);
if ('i' != code)
fprintf (file, HOST_WIDE_INT_PRINT_DEC, ival + abcd);
else if (low_io_address_operand (x, VOIDmode)
|| high_io_address_operand (x, VOIDmode))
{
switch (ival)
{
case RAMPZ_ADDR: fprintf (file, "__RAMPZ__"); break;
case SREG_ADDR: fprintf (file, "__SREG__"); break;
case SP_ADDR: fprintf (file, "__SP_L__"); break;
case SP_ADDR+1: fprintf (file, "__SP_H__"); break;
default:
fprintf (file, HOST_WIDE_INT_PRINT_HEX,
ival - avr_current_arch->sfr_offset);
break;
}
}
else
fatal_insn ("bad address, not an I/O address:", x);
}
else if (MEM_P (x))
{
rtx addr = XEXP (x, 0);
......@@ -1844,21 +1867,7 @@ print_operand (FILE *file, rtx x, int code)
}
else if (code == 'i')
{
if (!io_address_operand (addr, GET_MODE (x)))
fatal_insn ("bad address, not an I/O address:", addr);
switch (INTVAL (addr))
{
case RAMPZ_ADDR: fprintf (file, "__RAMPZ__"); break;
case SREG_ADDR: fprintf (file, "__SREG__"); break;
case SP_ADDR: fprintf (file, "__SP_L__"); break;
case SP_ADDR+1: fprintf (file, "__SP_H__"); break;
default:
fprintf (file, HOST_WIDE_INT_PRINT_HEX,
UINTVAL (addr) - avr_current_arch->sfr_offset);
break;
}
print_operand (file, addr, 'i');
}
else if (code == 'o')
{
......@@ -1889,6 +1898,10 @@ print_operand (FILE *file, rtx x, int code)
else
print_operand_address (file, addr);
}
else if (code == 'i')
{
fatal_insn ("bad address, not an I/O address:", x);
}
else if (code == 'x')
{
/* Constant progmem address - like used in jmp or call */
......
......@@ -28,8 +28,8 @@
;; j Branch condition.
;; k Reverse branch condition.
;;..m..Constant Direct Data memory address.
;; i Print the SFR address quivalent of a CONST_INT RAM address.
;; The resulting addres is suitable to be used in IN/OUT.
;; i Print the SFR address quivalent of a CONST_INT or a CONST_INT
;; RAM address. The resulting addres is suitable to be used in IN/OUT.
;; o Displacement for (mem (plus (reg) (const_int))) operands.
;; p POST_INC or PRE_DEC address as a pointer (X, Y, Z)
;; r POST_INC or PRE_DEC address as a register (r26, r28, r30)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment