Code emission
The code emission phase lowers the code from code generator abstractions (such as MachineFunction
class, MachineInstr
class, and so on) to machine code layer abstractions (MCInst
class, MCStreamer
class, and so on). The important classes in this phase are the target-independent AsmPrinter
class, target-specific subclasses of AsmPrinter
, and the TargetLoweringObjectFile
class.
The MC layer is responsible for emitting object files, which consist of labels, directives, and instructions; while the CodeGen
layer consists of MachineFunctions
, MachineBasicBlock
and MachineInstructions
. A key class used at this point in time is the MCStreamer
class, which consists of assembler APIs. The MCStreamer
class has functions such as EmitLabel
,
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.