Implementing the MachineBasicBlock class
Similar to basic blocks in the LLVM IR, a MachineBasicBlock
class has a set of machine instructions in sequential order. Mostly, a MachineBasicBlock
class maps to a single LLVM IR basic block. However, there can be cases where multiple MachineBasicBlocks
classes map to a single LLVM IR basic block. The MachineBasicBlock
class has a method, called getBasicBlock()
, that returns the IR basic block to which it is mapping.
How to do it…
The following steps show how machine basic blocks are added:
- The
getBasicBlock
method will return only the current basic block:const BasicBlock *getBasicBlock() const { return BB; }
- The basic blocks have successor as well as predecessor basic blocks. To keep track of those, vectors ...
Get LLVM Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.