Understanding the generic Machine IR
GlobalISel works directly on the Machine IR that you learned about in Chapter 11, except that it has a slightly different flavor, called generic Machine IR. The goal of the whole GlobalISel pipeline is to remove this generic flavor from the Machine IR to reach plain Machine IR at the end of the InstructionSelect
pass.
The generic Machine IR differs from the regular Machine IR in two aspects:
- The virtual registers may not have a register class. Instead, they have a type and, optionally, a register bank. Virtual registers that do not have a register class are called generic virtual registers.
- The opcode of
MachineInstr
instances can use generic Machine IR opcodes easily identifiable by theirG_
prefix. For instance, a generic addition instruction uses theG_ADD
opcode. These opcodes are defined in thellvm/include/llvm/Target/GenericOpcodes.td
file.
Note
The only difference between a regular and a generic...