This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Legitimize address, Please HELP!
- From: dimmy <diwil at mail dot ru>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 05 Dec 2001 15:33:37 +0300
- Subject: Legitimize address, Please HELP!
Fellows,
Sorry bothering you.
I am writing msp430 support and got a question:
How to get rid of operands like:
(mem/s:HI (plus:HI (mem:HI (plus:HI (reg/f:HI 1 r1)
(const_int 18 [0x12])) 0)
(const_int 2 [0x2])) 3))
The CPU core does support (mem:xx (plus reg:xx const_int)), but not the
operand above.
I define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR)
as:
------------------------
#ifdef REG_OK_STRICT
# define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR) \
{ \
if (legitimate_address_p (mode, operand, 1)) \
goto ADDR; \
}
# else
# define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR) \
{ \
if (legitimate_address_p (mode, operand, 0)) \
goto ADDR; \
}
#endif
--------------------------
where legitimate_address_p is defined as follows:
--------------------------
int
legitimate_address_p (mode, operand, strict)
enum machine_mode mode;
rtx operand;
int strict;
{
rtx x = operand;
/* accept @Rn */
if (GET_CODE (operand) == REG
&&(strict ? REG_OK_FOR_BASE_STRICT_P (x)
: REG_OK_FOR_BASE_NOSTRICT_P (x)))
return 1;
/* accept address */
if (CONSTANT_ADDRESS_P (operand))
return 1;
/* accept X(Rn) */
if (GET_CODE (operand) == PLUS
&& GET_CODE (XEXP (operand, 0)) == REG
&& REG_OK_FOR_BASE_P (XEXP (operand, 0))
&& CONSTANT_ADDRESS_P (XEXP (operand, 1)))
return 1;
}
--------------------------
Shall I define something else to prevent invalid address generation or what?
By now I cannot compile only 'unwind-dw2-fde.c' in gcc-3.0/gcc
Everything else seems to be fine!!!
by the way, when I run xgcc, it produces invalid code,
when cc1, it does not want to compile and says:
unwind-dw2-fde.c: In function `search_object':
unwind-dw2-fde.c:930: Unrecognizable insn:
(insn 1212 29 30 (set (reg:HI 14 r14 [49])
(mem/s:HI (plus:HI (mem:HI (plus:HI (reg/f:HI 1 r1)
(const_int 12 [0xc])) 0)
(const_int 10 [0xa])) 13)) -1 (nil)
(nil))
Tricks like if (GET_CODE (operand) == PLUS && GET_CODE (XEXP (operand,
0)) == MEM) return 0; do not help at all.
Thanks in advance,
Dmitry.