Implementing the MachineFunction class

Similar to the LLVM IR FunctionBlock class, a MachineFunction class contains a series of MachineBasicBlocks classes. These MachineFunction classes map to LLVM IR functions that are given as input to the instruction selector. In addition to a list of basic blocks, the MachineFunction class contains the MachineConstantPool, MachineFrameInfo, MachineFunctionInfo, and MachineRegisterInfo classes.

How to do it…

Many functions are defined in the MachineFunction class, which does specific tasks. There are also many class member objects that keep information, such as the following:

  • RegInfo keeps information about each register that is in use in the function:
    MachineRegisterInfo *RegInfo;
  • MachineFrameInfo keeps track of ...

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.