开发者

LLVM - Can I access variables in my instruction format from e.g. the delay slot filler?

I'm working on an llvm back-end and I'm cur开发者_如何学JAVArently trying to get delay slots working correctly. The number of slots varies for 0-3, and the easiest - and for me most logical - way to specify this is adding a variable numDelaySlots to the instruction format class. Then when I'm specifying my instructions in TargetInstrInfo.td, I would just use { let numDelaySlots = 2; } for example. However, I'm not sure I can access this information later.

Can user-defined instruction format variables be accessed via for example a MachineBasicBlock (which is what the delayslotfiller works with)? If not, does anyone have any experience with LLVM and variable delay slot sizes?


You'll have to teach TableGen how to parse this information and then what to do with it. The files you're looking for are in utils/TableGen/:
CodeGenDAGPatterns.[h|cpp]
CodeGenInstruction.[h|cpp]
InstrInfoEmitter.[h|cpp]

Once you've added that support, you'll need to then make use of the data from within a MachineFunctionPass like DelaySlotFiller.cpp from the Sparc target or MipsDelaySlotFiller.cpp from the Mips target. Yu'll might even take on the effort of unifying these passes up into CodeGen somewhere since the only difference in them is the NOP they use.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜