LLVM  8.0.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::RegBankSelect::InsertPoint Class Referenceabstract

Abstract class used to represent an insertion point in a CFG. More...

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

Inheritance diagram for llvm::RegBankSelect::InsertPoint:
Inheritance graph
[legend]
Collaboration diagram for llvm::RegBankSelect::InsertPoint:
Collaboration graph
[legend]

Public Member Functions

virtual ~InsertPoint ()=default
 
MachineBasicBlock::iterator getPoint ()
 The first call to this method will cause the splitting to happen if need be, then sub sequent calls just return the iterator to that point. More...
 
MachineBasicBlockgetInsertMBB ()
 The first call to this method will cause the splitting to happen if need be, then sub sequent calls just return the basic block that contains the insertion point. More...
 
MachineBasicBlock::iterator insert (MachineInstr &MI)
 Insert MI in the just before ::getPoint() More...
 
virtual bool isSplit () const
 Does this point involve splitting an edge or block? As soon as ::getPoint is called and thus, the point materialized, the point will not require splitting anymore, i.e., this will return false. More...
 
virtual uint64_t frequency (const Pass &P) const
 Frequency of the insertion point. More...
 
virtual bool canMaterialize () const
 Check whether this insertion point can be materialized. More...
 

Protected Member Functions

virtual void materialize ()=0
 Materialize the insertion point. More...
 
virtual MachineBasicBlockgetInsertMBBImpl ()=0
 Return the materialized insertion basic block. More...
 
virtual MachineBasicBlock::iterator getPointImpl ()=0
 Return the materialized insertion point. More...
 

Protected Attributes

bool WasMaterialized = false
 Tell if the insert point has already been materialized. More...
 

Detailed Description

Abstract class used to represent an insertion point in a CFG.

This class records an insertion point and materializes it on demand. It allows to reason about the frequency of this insertion point, without having to logically materialize it (e.g., on an edge), before we actually need to insert something.

Definition at line 111 of file RegBankSelect.h.

Constructor & Destructor Documentation

◆ ~InsertPoint()

virtual llvm::RegBankSelect::InsertPoint::~InsertPoint ( )
virtualdefault

Member Function Documentation

◆ canMaterialize()

virtual bool llvm::RegBankSelect::InsertPoint::canMaterialize ( ) const
inlinevirtual

Check whether this insertion point can be materialized.

As soon as ::getPoint is called and thus, the point materialized calling this method does not make sense.

Reimplemented in llvm::RegBankSelect::EdgeInsertPoint, llvm::RegBankSelect::MBBInsertPoint, and llvm::RegBankSelect::InstrInsertPoint.

Definition at line 200 of file RegBankSelect.h.

Referenced by llvm::RegBankSelect::RepairingPlacement::addInsertPoint(), getInsertMBB(), getPoint(), and llvm::RegBankSelect::EdgeInsertPoint::isSplit().

◆ frequency()

virtual uint64_t llvm::RegBankSelect::InsertPoint::frequency ( const Pass P) const
inlinevirtual

Frequency of the insertion point.

P is used to access the various analysis that will help to get that information, like MachineBlockFrequencyInfo. If P does not contain enough enough to return the actual frequency, this returns 1.

Reimplemented in llvm::RegBankSelect::EdgeInsertPoint, llvm::RegBankSelect::MBBInsertPoint, and llvm::RegBankSelect::InstrInsertPoint.

Definition at line 195 of file RegBankSelect.h.

Referenced by llvm::RegBankSelect::MBBInsertPoint::isSplit(), and llvm::RegBankSelect::EdgeInsertPoint::isSplit().

◆ getInsertMBB()

MachineBasicBlock& llvm::RegBankSelect::InsertPoint::getInsertMBB ( )
inline

The first call to this method will cause the splitting to happen if need be, then sub sequent calls just return the basic block that contains the insertion point.

I.e., no more splitting will occur.

Returns
The basic block should be used with MachineBasicBlock::insert and ::getPoint. The new code should happen before that point.

Definition at line 168 of file RegBankSelect.h.

References assert(), canMaterialize(), getInsertMBBImpl(), isSplit(), and materialize().

Referenced by insert().

◆ getInsertMBBImpl()

virtual MachineBasicBlock& llvm::RegBankSelect::InsertPoint::getInsertMBBImpl ( )
protectedpure virtual

Return the materialized insertion basic block.

Code will be inserted into that basic block.

Precondition
::materialize has been called.

Referenced by getInsertMBB().

◆ getPoint()

MachineBasicBlock::iterator llvm::RegBankSelect::InsertPoint::getPoint ( )
inline

The first call to this method will cause the splitting to happen if need be, then sub sequent calls just return the iterator to that point.

I.e., no more splitting will occur.

Returns
The iterator that should be used with MachineBasicBlock::insert. I.e., additional code happens before that point.

Definition at line 149 of file RegBankSelect.h.

References assert(), canMaterialize(), getPointImpl(), isSplit(), and materialize().

Referenced by insert().

◆ getPointImpl()

virtual MachineBasicBlock::iterator llvm::RegBankSelect::InsertPoint::getPointImpl ( )
protectedpure virtual

Return the materialized insertion point.

Code will be inserted before that point.

Precondition
::materialize has been called.

Referenced by getPoint().

◆ insert()

MachineBasicBlock::iterator llvm::RegBankSelect::InsertPoint::insert ( MachineInstr MI)
inline

Insert MI in the just before ::getPoint()

Definition at line 180 of file RegBankSelect.h.

References getInsertMBB(), getPoint(), and llvm::MachineBasicBlock::insert().

◆ isSplit()

virtual bool llvm::RegBankSelect::InsertPoint::isSplit ( ) const
inlinevirtual

Does this point involve splitting an edge or block? As soon as ::getPoint is called and thus, the point materialized, the point will not require splitting anymore, i.e., this will return false.

Reimplemented in llvm::RegBankSelect::EdgeInsertPoint, llvm::RegBankSelect::MBBInsertPoint, and llvm::RegBankSelect::InstrInsertPoint.

Definition at line 188 of file RegBankSelect.h.

Referenced by llvm::RegBankSelect::RepairingPlacement::addInsertPoint(), getInsertMBB(), and getPoint().

◆ materialize()

virtual void llvm::RegBankSelect::InsertPoint::materialize ( )
protectedpure virtual

Materialize the insertion point.

If isSplit() is true, this involves actually splitting the block or edge.

Postcondition
getPointImpl() returns a valid iterator.
getInsertMBBImpl() returns a valid basic block.
isSplit() == false ; no more splitting should be required.

Referenced by getInsertMBB(), and getPoint().

Member Data Documentation

◆ WasMaterialized

bool llvm::RegBankSelect::InsertPoint::WasMaterialized = false
protected

Tell if the insert point has already been materialized.

Definition at line 114 of file RegBankSelect.h.

Referenced by llvm::RegBankSelect::EdgeInsertPoint::frequency().


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