[LLVMdev] How to check for "SPARC code generation" in MachineBasicBlock.cpp?

Chris Lattner clattner at apple.com
Wed Feb 17 10:58:42 PST 2010


On Feb 9, 2010, at 3:31 PM, Nathan Keynes wrote:
>>> So I guess the question I have is, are MBBs like BB#7 above legal,
>> 
>> Funny question :).  When I was working on the sparc backend, it was unclear how best to represent delay slots.  The approach I took was to pretend that they didn't exist for most of the compiler backend, then have DelaySlotFiller create them right before the asmprinter ran. The idea was to eventually extend DelaySlotFiller to put something better than a nop in them :)
>> 
>> This all works as long as the asmprinter is a simple pass through that doesn't look at the code, which isOnlyReachableByFallthrough violates.
>> 
>> As far as a proposed solution, since asmprinter is the only user of isOnlyReachableByFallthrough, I'd recommend moving isOnlyReachableByFallthrough to be AsmPrinter::IsBlockOnlyReachableByFallthrough.  Then you can make it virtual, and have the sparc backend provide its own implementation of it (which might as well just return false all the time).
> 
> Sounds reasonable to me. The attached llvm-sparc-asmprinter1.patch implements what you've described above, with SparcAsmPrinter::isBlockOnlyReachableByFallthrough looking for the last terminator rather than the last instruction. 
> 
> I've also included llvm-sparc-asmprinter2.patch which fixes a different issue in SparcAsmPrinter where multiple identical .LLGETPCHn symbols could be emitted in the same file (it was uniqued by block number, but not by function number). 
> 
> These fix the symbol issues when bootstrapping gcc (and don't break any tests this time that I can see), although unfortunately there still appear to be other SPARC codegen issues that are blocking the bootstrap.

Thanks Nathan, I applied these as r96492 / r96493. Sorry for the delay, do you have commit access?  If not, please contact me offline.

-Chris



More information about the llvm-dev mailing list