Re: symbol_ref constants

2005-03-31 Thread Sanjiv Kumar Gupta
--- James E Wilson <[EMAIL PROTECTED]> wrote: > Sanjiv Kumar Gupta wrote: > > But I don't want to > > allow expressions like (const:SI (plus:SI > > symbol_ref:SI) (const_int)) in the insn. > > How should I do that, do I need to implement > > LEGITIMATE_CONST_P () accordingly? > > Try making CONST

Re: symbol_ref constants

2005-03-31 Thread James E Wilson
Sanjiv Kumar Gupta wrote: But I don't want to allow expressions like (const:SI (plus:SI symbol_ref:SI) (const_int)) in the insn. How should I do that, do I need to implement LEGITIMATE_CONST_P () accordingly? Try making CONSTANT_ADDRESS_P reject the value. Though it still isn't clear why you are ge

RE: symbol_ref constants

2005-03-30 Thread Sanjiv Kumar Gupta
> add1 r1, segment_base, (a - 40) > add2 r1, 40 read this as add2 r1, the value of j > > Since 'a' is at the boundary of segment so 'a - 40' > causes relocation overflow. > > But the same code works without -O2, because that > generates code like > add1 r1, segment_base,

RE: symbol_ref constants

2005-03-30 Thread Sanjiv Kumar Gupta
> Sanjiv Kumar Gupta wrote: > > > > What is stopping the value of 'foo' itself being > > 255? > > Programmer will get an overflow error for that > during linking. > > For my curiosity, what's the background here? Do you > really only have 256 > bytes of storage on this system? > That was just an

Re: symbol_ref constants

2005-03-30 Thread Mike Stump
On Mar 30, 2005, at 3:57 AM, Sanjiv Kumar Gupta wrote: The relocation entry generated for this insn look like symbol + addend. The resultant value is beoyond the relocation size, and results into relocation overflow. Why is this not a bug in your reloc code in the assembler, OMF?

RE: symbol_ref constants

2005-03-30 Thread Rupert Wood
Sanjiv Kumar Gupta wrote: > > What is stopping the value of 'foo' itself being > 255? > Programmer will get an overflow error for that during linking. For my curiosity, what's the background here? Do you really only have 256 bytes of storage on this system? If you've got eight bit registers in a

Re: symbol_ref constants

2005-03-30 Thread Sanjiv Kumar Gupta
Nathan Sidwell wrote: Sanjiv Kumar Gupta wrote: calculated by linker. Now add r1, foo add r1, 10 add r1, -10 are okay but add r1, foo + 10 add r1, -10 are not, since (foo + 10) may overflow during relocation, so the value (foo + 10) && 0xff inserted by linker is not correct. What is st

Re: symbol_ref constants

2005-03-30 Thread Nathan Sidwell
Sanjiv Kumar Gupta wrote: calculated by linker. Now add r1, foo add r1, 10 add r1, -10 are okay but add r1, foo + 10 add r1, -10 are not, since (foo + 10) may overflow during relocation, so the value (foo + 10) && 0xff inserted by linker is not correct. What is stopping the value of

Re: symbol_ref constants

2005-03-30 Thread Sanjiv Kumar Gupta
--- Nathan Sidwell <[EMAIL PROTECTED]> wrote: > Sanjiv Kumar Gupta wrote: > > > > > Thanks for a prompt reply, Nathan. > > The add insn can take a symbol_ref, which is > converted > > to const_int during relocation. But I don't want > to > > allow expressions like (const:SI (plus:SI > > symbol_r

Re: symbol_ref constants

2005-03-30 Thread Nathan Sidwell
Sanjiv Kumar Gupta wrote: Thanks for a prompt reply, Nathan. The add insn can take a symbol_ref, which is converted to const_int during relocation. But I don't want to allow expressions like (const:SI (plus:SI symbol_ref:SI) (const_int)) in the insn. How should I do that, do I need to implement LEG

Re: symbol_ref constants

2005-03-30 Thread Sanjiv Kumar Gupta
--- Nathan Sidwell <[EMAIL PROTECTED]> wrote: > Sanjiv Kumar Gupta wrote: > > > add symbol_ref + const_int, r1 > > > > The relocation entry generated for this insn look > like > > symbol + addend. > > > > The resultant value is beoyond the relocation > size, > > and results into relocation ove

Re: symbol_ref constants

2005-03-30 Thread Nathan Sidwell
Sanjiv Kumar Gupta wrote: add symbol_ref + const_int, r1 The relocation entry generated for this insn look like symbol + addend. The resultant value is beoyond the relocation size, and results into relocation overflow. I guess CSE will not do this if I exclude constants like symobol_ref + const_i