aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorGeorg-Johann Lay <avr@gjlay.de>2011-11-25 15:00:39 +0000
committerGeorg-Johann Lay <gjl@gcc.gnu.org>2011-11-25 15:00:39 +0000
commit2cc11a884fb7ce01b3fd3884048d4cc7df0b4651 (patch)
tree5ee3ab6fb2628b0dc0e9e205e419cb00d56fd3f0 /gcc/config
parent0c1e7e423a9072db79fb1ce5d99d4355ae3ed258 (diff)
downloadgcc-2cc11a884fb7ce01b3fd3884048d4cc7df0b4651.zip
gcc-2cc11a884fb7ce01b3fd3884048d4cc7df0b4651.tar.gz
gcc-2cc11a884fb7ce01b3fd3884048d4cc7df0b4651.tar.bz2
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
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/avr/avr.c49
-rw-r--r--gcc/config/avr/avr.md4
2 files changed, 33 insertions, 20 deletions
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 543bb9c..9fd8b8e 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -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 */
diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md
index f19e6f9..d59488e 100644
--- a/gcc/config/avr/avr.md
+++ b/gcc/config/avr/avr.md
@@ -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)