Adding a machine code descriptor
The LLVM IR has functions, which have basic blocks. Basic blocks in turn have instructions. The next logical step is to convert those IR abstract blocks into machine-specific blocks. LLVM code is translated into a machine-specific representation formed from the MachineFunction
, MachineBasicBlock
, and MachineInstr
instances. This representation contains instructions in their most abstract form—that is, having an opcode and a series of operands.
How it's done…
Now the LLVM IR instruction has to be represented in the machine instruction. Machine instructions are instances of the MachineInstr
class. This class is an extremely abstract way of representing machine instructions. In particular, it only keeps track of an ...
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.