This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

legitimate address. Please HELP!


Fellows,

Sorry bothering you.

I am writing msp430 support for gcc-3.0 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 as shown 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 an invalid code,
when I run 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))


Thanks in advance,
Dmitry.







------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]