Re: How to generate a PC- relative load instruction.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi,
does this one(idea) related to program independent code (pic).
Thanks,
Sumanth
Ian Lance Taylor wrote:
sumanth <sumanth.gundapneni@xxxxxxxxxxxxxxxxxx> writes:

  How can I  generate a load instruction with pc-relative accessing of
"global" variables.
   As far as I know I need to modify GO_IF_LEGITIMATE_ADDRESS
   X is an RTX ; 1. GET_CODE (X) == PC     + offset
                          2. GET_CODE (X) == LABEL_REF  or  GET_CODE
(X) == SYMBOL_REF
  and split the label to PC + offset (if possible)  .

 The problem here is how can I keep data in PC + offset and tell my
compiler. The only reference is in arm  as far as I know.
 Its some thing like
  "a = 10 " is a global variable  and i need to load its address it in
to register r0.
 120    ld r0(destination), pc ,#4
 124    0x2345678e
 value 10 is in 0x2345678e

Can any one help me in this regard .

This sort of thing is often done in the LEGITIMIZE_ADDRESS macro.  Your
case looks a bit complicated and probably requires an UNSPEC.  You will
also want to consider a constant pool.  I think the SH has some cases
like yours, but I'm not sure.

Ian





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux