This is the mail archive of the mailing list for the GCC project.

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: Redundant / wasted stack space and instructions

For small micros such as MSP430 & friends and many of the Renasis
some of which only have 2K or ram on board, this could be a real

Although I reproduced the same behaviour on i386 using a stock
I was wondering if there was something missing in my port that
spilling to stack locations, or a cleanup pass that addresses this
issue ?
The only way to know for sure is to dig through the debugging dumps
understand why any given pseudo register was not assigned to a hard

If you're doing a new port, I would also recommend taking the time
investigate and possibly tune it to utilize LRA. It's been our
experience that LRA, after tuning, produces superior code when
compared to the old reload pass.


Thanks Jeff,

The register spilling isn't the problem, this is a situation where
are more variables than registers so spilling is expected.

The problem is that spilled vregs that correspond to stack
that already have appropriate memory available, are spilling to a new
local spill variable.

I've just built the trunk msp430 and h8300 ports and they both spill
correctly to the stack parameters when compiling the same test code...

so I'll hunt through those ports so see if I can find something I've

I have ported to the LRA, however on this register poor CPU it seems
fail to allocate registers in cases where the old reload pass works
fine... maybe my LRA port also has problems :-)

Cheers, Paul.

Found it ...

I had left the movsi patterns unimplemented because I was told that if I did this then gcc would create expands/splits to use 16 bit moves. So, I removed my movsi patterns and all seemed well.

In comparing the output of the expand pass from the msp430 port and mine I could see the movsi instructions for the msp430 and the movhi subreg instructions in mine.

I wondered if using the subreg:HI to split the SI moves into HI moves was hiding real nature of the moves for reload and future optimizations, so I reverted to my movsi patterns and ... the spills now resolve back to the incoming stack parameter slots as desired !

Oh, and I tried using the LRA on this test case and Jeff, you're correct the generated code is far, far better.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]