LLVM 22.0.0git
llvm::InstructionSelect::MIIteratorMaintainer Class Reference

This class observes instruction insertions/removals. More...

Inheritance diagram for llvm::InstructionSelect::MIIteratorMaintainer:
[legend]

Public Member Functions

void changingInstr (MachineInstr &MI) override
 This instruction is about to be mutated in some way.
void changedInstr (MachineInstr &MI) override
 This instruction was mutated in some way.
void createdInstr (MachineInstr &MI) override
 An instruction has been created and inserted into the function.
void erasingInstr (MachineInstr &MI) override
 An instruction is about to be erased.
void reportFullyCreatedInstrs ()
Public Member Functions inherited from llvm::GISelChangeObserver
virtual ~GISelChangeObserver ()=default
LLVM_ABI void changingAllUsesOfReg (const MachineRegisterInfo &MRI, Register Reg)
 All the instructions using the given register are being changed.
LLVM_ABI void finishedChangingAllUsesOfReg ()
 All instructions reported as changing by changingAllUsesOfReg() have finished being changed.

Public Attributes

MachineBasicBlock::reverse_iterator MII

Detailed Description

This class observes instruction insertions/removals.

InstructionSelect stores an iterator of the instruction prior to the one that is currently being selected to determine which instruction to select next. Previously this meant that selecting multiple instructions at once was illegal behavior due to potential invalidation of this iterator. This is a non-obvious limitation for selector implementers. Therefore, to allow deletion of arbitrary instructions, we detect this case and continue selection with the predecessor of the deleted instruction.

Definition at line 77 of file InstructionSelect.cpp.

Member Function Documentation

◆ changedInstr()

void llvm::InstructionSelect::MIIteratorMaintainer::changedInstr ( MachineInstr & MI)
inlineoverridevirtual

This instruction was mutated in some way.

Implements llvm::GISelChangeObserver.

Definition at line 87 of file InstructionSelect.cpp.

References llvm_unreachable, and MI.

◆ changingInstr()

void llvm::InstructionSelect::MIIteratorMaintainer::changingInstr ( MachineInstr & MI)
inlineoverridevirtual

This instruction is about to be mutated in some way.

Implements llvm::GISelChangeObserver.

Definition at line 84 of file InstructionSelect.cpp.

References llvm_unreachable, and MI.

◆ createdInstr()

void llvm::InstructionSelect::MIIteratorMaintainer::createdInstr ( MachineInstr & MI)
inlineoverridevirtual

An instruction has been created and inserted into the function.

Note that the instruction might not be a fully fledged instruction at this point and won't be if the MachineFunction::Delegate is calling it. This is because the delegate only sees the construction of the MachineInstr before operands have been added.

Implements llvm::GISelChangeObserver.

Definition at line 91 of file InstructionSelect.cpp.

References llvm::dbgs(), LLVM_DEBUG, and MI.

◆ erasingInstr()

void llvm::InstructionSelect::MIIteratorMaintainer::erasingInstr ( MachineInstr & MI)
inlineoverridevirtual

An instruction is about to be erased.

Implements llvm::GISelChangeObserver.

Definition at line 95 of file InstructionSelect.cpp.

References llvm::dbgs(), LLVM_DEBUG, MI, and MII.

◆ reportFullyCreatedInstrs()

void llvm::InstructionSelect::MIIteratorMaintainer::reportFullyCreatedInstrs ( )
inline

Definition at line 106 of file InstructionSelect.cpp.

References llvm::dbgs(), LLVM_DEBUG, and MI.

Referenced by llvm::InstructionSelect::selectMachineFunction().

Member Data Documentation

◆ MII

MachineBasicBlock::reverse_iterator llvm::InstructionSelect::MIIteratorMaintainer::MII

The documentation for this class was generated from the following file: