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,
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access