public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* how to optimize address offset assignment
@ 2009-07-09  9:04 daniel.tian
  0 siblings, 0 replies; only message in thread
From: daniel.tian @ 2009-07-09  9:04 UTC (permalink / raw)
  To: gcc

Hi, everyone:
The address mode in my  my RISC chip is like (BaseReg) + 8bit offset, or (BaseReg) + indexReg.
And there a 16 general register from R0 to R15 which can be used as Base register or Index Regster.

So you can see that if the frame space is larger than 255, there will be a problem.  For a single Load/Store 
Operation, there should be an additional insn to force the immediate into index register. But this will cause some
redundancy code, especially assessing some adjacent area. Like the following code(this is the assemble code generated by my cc1): 

MOVI        #1084 -L ;; Load a immediate to R0 register
ADD         R5   R0   R14 ;; R14 is regarded as frame pointer
STOREH          R4   (R5)  #0  -PRI ;;load a half word from memory at (R5 + 0). R4 = (R5 + 0)
MOVI        #1086 -L 
ADD         R4   R0   R14
STOREH          R5   (R4)  #0  -PRI
MOVI        #1088 -L 
ADD         R5   R0   R14
STOREH          R4   (R5)  #0  -PRI

You can see the offset loaded three times. But they abut. It can be optimized. 

I read a paper named ”Optimal Stack Slot Assignment in GCC”. There is an option to enable the stack reorganization.
But I didn’t find it in Internal Document. (The SH machine seems to use this method, how do I trigger it?)


So I need your guys give me some advices.
Thank you very much.


_______________________________________________
Best Regards
Daniel Tian
Mavrix Technology, Inc.
Address:200 Zhangheng Road, #3501, Building 3, Zhangjiang Hi-tech Park, Shanghai, P.R.China (201204) 
Tel:86(21)51095958 - 8125
Fax:86(21)50277658
Email:daniel.tian@mavrixtech.com.cn
www.mavrixtech.com



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-07-09  9:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-09  9:04 how to optimize address offset assignment daniel.tian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).