legitimate_address_p query

Daniel Towner dant@picochip.com
Thu Jan 17 12:14:00 GMT 2002


Hi all,
I am currently involved in writing a port of GCC to a new 16-bit embedded
RISC processor. The instruction set has no load/store instructions which
take immediate addresses, and all addresses must be stored in registers
(although they may be indexed by a constant). In order to prevent
symbol_ref's being used to address memory, I made the legitimate_address_p
function reject symbol_ref's as addresses, and for the most part, this has
worked as expected - the compiler generates aan instruction sequence:

LOADC addrReg, symbol_ref_addr
LOAD destDeg, addrReg

However, if I try to generate SI mode comparisons, using the automatic
splitting feature of gcc (i.e., perform comparisons on the upper and lower
16-bit words), the compile tried to generate an instruction like:

LOAD destReg, (longSymbolAddr + 2)

I tried making a (plus (symbol_ref) const_int) RTX an invalid memory address
to prevent this instruction being generated, but it hasn't had the desired
effect - theabove instruction is still generated? I then tried making a
define_expand which detects these cases, and explicitly rewrites them, which
appears to work when the rtl is generated (i.e., the correct sequence shows
up if using -dP switch), but at the instruction level, the above instruction
keeps appearing. What am I doing wrong?

Thanks,

 Dan.

============================================================================
====
Daniel Towner
picoChip Designs Ltd.
Riverside Buildings
108, Walcot Street, BATH, BA1 5BG, UK
+44 (0) 7786 702589




More information about the Gcc mailing list