LLVM 20.0.0git
Public Types | Public Member Functions | List of all members
llvm::RegBankSelect::RepairingPlacement Class Reference

Struct used to represent the placement of a repairing point for a given operand. More...

#include "llvm/CodeGen/GlobalISel/RegBankSelect.h"

Public Types

enum  RepairingKind { None , Insert , Reassign , Impossible }
 Define the kind of action this repairing needs. More...
 
Convenient types for a list of insertion points.
using InsertionPoints = SmallVector< std::unique_ptr< InsertPoint >, 2 >
 
using insertpt_iterator = InsertionPoints::iterator
 
using const_insertpt_iterator = InsertionPoints::const_iterator
 

Public Member Functions

 RepairingPlacement (MachineInstr &MI, unsigned OpIdx, const TargetRegisterInfo &TRI, Pass &P, RepairingKind Kind=RepairingKind::Insert)
 Create a repairing placement for the OpIdx-th operand of MI.
 
void switchTo (RepairingKind NewKind)
 Change the type of this repairing placement to NewKind.
 
Getters.
RepairingKind getKind () const
 
unsigned getOpIdx () const
 
bool canMaterialize () const
 
bool hasSplit ()
 
Overloaded methods to add an insertion point.

Add a MBBInsertionPoint to the list of InsertPoints.

void addInsertPoint (MachineBasicBlock &MBB, bool Beginning)
 
void addInsertPoint (MachineInstr &MI, bool Before)
 Add a InstrInsertionPoint to the list of InsertPoints.
 
void addInsertPoint (MachineBasicBlock &Src, MachineBasicBlock &Dst)
 Add an EdgeInsertionPoint (Src, Dst) to the list of InsertPoints.
 
void addInsertPoint (InsertPoint &Point)
 Add an InsertPoint to the list of insert points.
 
Accessors related to the insertion points.
insertpt_iterator begin ()
 
insertpt_iterator end ()
 
const_insertpt_iterator begin () const
 
const_insertpt_iterator end () const
 
unsigned getNumInsertPoints () const
 

Detailed Description

Struct used to represent the placement of a repairing point for a given operand.

Definition at line 314 of file RegBankSelect.h.

Member Typedef Documentation

◆ const_insertpt_iterator

Definition at line 332 of file RegBankSelect.h.

◆ InsertionPoints

Definition at line 330 of file RegBankSelect.h.

◆ insertpt_iterator

Definition at line 331 of file RegBankSelect.h.

Member Enumeration Documentation

◆ RepairingKind

Define the kind of action this repairing needs.

Enumerator
None 

Nothing to repair, just drop this action.

Insert 

Reparing code needs to happen before InsertPoints.

Reassign 

(Re)assign the register bank of the operand.

Impossible 

Mark this repairing placement as impossible.

Definition at line 317 of file RegBankSelect.h.

Constructor & Destructor Documentation

◆ RepairingPlacement()

RegBankSelect::RepairingPlacement::RepairingPlacement ( MachineInstr MI,
unsigned  OpIdx,
const TargetRegisterInfo TRI,
Pass P,
RepairingPlacement::RepairingKind  Kind = RepairingKind::Insert 
)

Create a repairing placement for the OpIdx-th operand of MI.

TRI is used to make some checks on the register aliases if the machine operand is a physical register. P is used to to update liveness information and such when materializing the points.

Definition at line 761 of file RegBankSelect.cpp.

References addInsertPoint(), assert(), Before, llvm::MachineBasicBlock::begin(), llvm::MachineBasicBlock::end(), End, llvm::MachineBasicBlock::getLastNonDebugInstr(), llvm::MachineOperand::getReg(), Insert, llvm::MachineOperand::isDef(), llvm::MachineOperand::isReg(), MI, and llvm::RegBankSelect::TRI.

Member Function Documentation

◆ addInsertPoint() [1/4]

void RegBankSelect::RepairingPlacement::addInsertPoint ( RegBankSelect::InsertPoint Point)

Add an InsertPoint to the list of insert points.

This method takes the ownership of &Point.

Definition at line 870 of file RegBankSelect.cpp.

References llvm::RegBankSelect::InsertPoint::canMaterialize(), and llvm::RegBankSelect::InsertPoint::isSplit().

◆ addInsertPoint() [2/4]

void RegBankSelect::RepairingPlacement::addInsertPoint ( MachineBasicBlock MBB,
bool  Beginning 
)

Definition at line 860 of file RegBankSelect.cpp.

References MBB.

Referenced by RepairingPlacement().

◆ addInsertPoint() [3/4]

void RegBankSelect::RepairingPlacement::addInsertPoint ( MachineBasicBlock Src,
MachineBasicBlock Dst 
)

Add an EdgeInsertionPoint (Src, Dst) to the list of InsertPoints.

Definition at line 865 of file RegBankSelect.cpp.

References P.

◆ addInsertPoint() [4/4]

void RegBankSelect::RepairingPlacement::addInsertPoint ( MachineInstr MI,
bool  Before 
)

Add a InstrInsertionPoint to the list of InsertPoints.

Definition at line 855 of file RegBankSelect.cpp.

References Before, and MI.

◆ begin() [1/2]

insertpt_iterator llvm::RegBankSelect::RepairingPlacement::begin ( )
inline

◆ begin() [2/2]

const_insertpt_iterator llvm::RegBankSelect::RepairingPlacement::begin ( ) const
inline

◆ canMaterialize()

bool llvm::RegBankSelect::RepairingPlacement::canMaterialize ( ) const
inline

Definition at line 364 of file RegBankSelect.h.

Referenced by llvm::RegBankSelect::computeMapping().

◆ end() [1/2]

insertpt_iterator llvm::RegBankSelect::RepairingPlacement::end ( )
inline

◆ end() [2/2]

const_insertpt_iterator llvm::RegBankSelect::RepairingPlacement::end ( ) const
inline

◆ getKind()

RepairingKind llvm::RegBankSelect::RepairingPlacement::getKind ( ) const
inline

Definition at line 362 of file RegBankSelect.h.

◆ getNumInsertPoints()

unsigned llvm::RegBankSelect::RepairingPlacement::getNumInsertPoints ( ) const
inline

Definition at line 389 of file RegBankSelect.h.

References llvm::SmallVectorBase< Size_T >::size().

Referenced by llvm::RegBankSelect::repairReg().

◆ getOpIdx()

unsigned llvm::RegBankSelect::RepairingPlacement::getOpIdx ( ) const
inline

Definition at line 363 of file RegBankSelect.h.

Referenced by llvm::RegBankSelect::tryAvoidingSplit().

◆ hasSplit()

bool llvm::RegBankSelect::RepairingPlacement::hasSplit ( )
inline

◆ switchTo()

void llvm::RegBankSelect::RepairingPlacement::switchTo ( RepairingKind  NewKind)
inline

Change the type of this repairing placement to NewKind.

It is not possible to switch a repairing placement to the RepairingKind::Insert. There is no fundamental problem with that, but no uses as well, so do not support it for now.

Precondition
NewKind != RepairingKind::Insert
Postcondition
getKind() == NewKind

Definition at line 399 of file RegBankSelect.h.

References assert(), llvm::SmallVectorImpl< T >::clear(), Impossible, and Insert.

Referenced by llvm::RegBankSelect::tryAvoidingSplit().


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