[llvm] r182108 - [Sparc] Implements hasReservedCallFrame and hasFP.

Jakob Stoklund Olesen stoklund at 2pi.dk
Sat May 18 12:26:30 PDT 2013


On May 17, 2013, at 7:52 PM, Venkatraman Govindaraju <venkatra at cs.wisc.edu> wrote:

> On Fri, May 17, 2013 at 3:11 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
>> 
>> Are you planning to support leaf functions without a frame? That would be neat.
> 
> Yes, I am working on a leaf procedure optimization pass, which I
> implemented as a MachineFunctionPass similar to delay slot filler.
> See the attachment for the patch. It works for simple test cases, but
> I have not thoroughly tested it yet. Also, there may be a better way
> to do the leaf procedure optimization. Any suggestions are welcome. In
> the coming weeks, I plan to work on it and commit it to the trunk.

- In analyzeLeafProc(), instead of scanning the whole function, you could use MRI.isPhysregUsed() to determine if any L or O-registers have been clobbered. This would also detect calls.

- You could place the I- and G-registers at the beginning of the register classes. That would cause the register allocator to use them first, and you won't have to remap any register assignments.

- MRI.replaceRegWith() may be an easier way of rewriting I-registers to O-registers.

- Remember to rewrite the MBB live-in lists. Running llc -verify-machineinstrs should remind you.

- Perhaps the whole thing could run from processFunctionBeforeCalleeSavedScan() instead of a pass? Then you could avoid inserting save/restore in the first place.

/jakob





More information about the llvm-commits mailing list