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]

Re: legitimate address. Please HELP!


HI Choi,

I thought it should be (plus:xx (mem:xx (reg) (const)))

Anyway, did not help.


Choi, Jang-Wook wrote:

>Hi, dimmy.
>How about adding some code like the below?
>But I don't guarantee.
>
>cjw
>
>
>On Wed, 5 Dec 2001, dimmy wrote:
>
>>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;
>>
>
>     /* don't accept plus(plus(reg, imm), imm) */
>     if (GET_CODE (operand) == PLUS
>             && GET_CODE (XEXP (operand, 0)) == PLUS)
>         return 0;
>
>     /* or this? */
>     if (GET_CODE (operand) == MEM
>             && GET_CODE (XEXP (operand, 0)) == PLUS
>             && GET_CODE (XEXP (XEXP (operand, 0), 0)) == MEM
>	     && GET_CODE (XEXP (XEXP (XEXP (operand, 0), 0), 0) == PLUS)
>         return 0;
>
>>    /* 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
>>
>>
>
>
>------
>Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
>Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
>
>
>




------
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]