Instruction Selection

Reference

InstructionSelect pass transforms generic machine instructions into equivalent target-specifc instructions. It traverses the MachineFunction bottom-up, selecting uses before definitions, enabling trivial dead code elimination.

The target implements InstructionSelector class, containing target-specific selection logic.

InstructionSelector::select

virtual bool select(MachineInstr &MI)

This method is responsible for

  • mutating (or replacing) a possibly-generic MI into a fully target-specific equivalent.
  • doing the necessary constraining of gvregs into the appropriate register classes
  • passing through COPY instructions to the register allocator.
  • fold other instructions into the selected MI, by walking the use-def chain of the vreg operands. The folding can occur across basic blocks as GlobalISel is Global.

TableGen imports SelectionDAG rules

TableGen will import SelectDAG rules and provide the following function to execute them:

bool selectImpl(MachineInstr &MI)
Created Jul 19, 2020 // Last Updated Jul 22, 2020

If you could revise
the fundmental principles of
computer system design
to improve security...

... what would you change?