64 #ifndef LLVM_CODEGEN_GLOBALISEL_REGBANKSELECT_H 65 #define LLVM_CODEGEN_GLOBALISEL_REGBANKSELECT_H 80 class MachineBlockFrequencyInfo;
81 class MachineBranchProbabilityInfo;
83 class MachineRegisterInfo;
86 class TargetPassConfig;
87 class TargetRegisterInfo;
150 if (!WasMaterialized) {
151 WasMaterialized =
true;
169 if (!WasMaterialized) {
170 WasMaterialized =
true;
188 virtual bool isSplit()
const {
return false; }
249 return Beginning ? MBB.
begin() : MBB.
end();
260 "Invalid beginning point");
264 "Invalid end point");
267 bool isSplit()
const override {
return false; }
295 return DstOrSplit->
begin();
302 :
InsertPoint(), Src(Src), DstOrSplit(&Dst), P(P) {}
343 bool HasSplit =
false;
400 assert(NewKind != Kind &&
"Already of the right Kind");
402 InsertPoints.
clear();
403 CanMaterialize = NewKind != RepairingKind::Impossible;
405 assert(NewKind != RepairingKind::Insert &&
406 "We would need more MI to switch to Insert");
426 uint64_t LocalCost = 0;
429 uint64_t NonLocalCost = 0;
433 MappingCost(uint64_t LocalCost, uint64_t NonLocalCost, uint64_t LocalFreq)
434 : LocalCost(LocalCost), NonLocalCost(NonLocalCost),
435 LocalFreq(LocalFreq) {}
438 bool isSaturated()
const;
447 bool addLocalCost(uint64_t Cost);
452 bool addNonLocalCost(uint64_t Cost);
459 static MappingCost ImpossibleCost();
462 bool operator<(
const MappingCost &Cost)
const;
464 bool operator==(
const MappingCost &Cost)
const;
466 bool operator!=(
const MappingCost &Cost)
const {
return !(*
this == Cost); }
468 bool operator>(
const MappingCost &Cost)
const {
469 return *
this != Cost && Cost < *
this;
505 std::unique_ptr<MachineOptimizationRemarkEmitter>
MORE;
527 bool assignmentMatch(
unsigned Reg,
529 bool &OnlyAssign)
const;
596 const MappingCost *BestCost =
nullptr);
665 #endif // LLVM_CODEGEN_GLOBALISEL_REGBANKSELECT_H Pass interface - Implemented by all 'passes'.
Assign the register banks as fast as possible (default).
virtual ~InsertPoint()=default
typename SuperClass::const_iterator const_iterator
NodeTy * getNextNode()
Get the next node, or nullptr for the list tail.
unsigned getNumInsertPoints() const
virtual MachineBasicBlock & getInsertMBBImpl()=0
Return the materialized insertion basic block.
This class represents lattice values for constants.
class llvm::RegisterBankInfo *void applyMapping(const OperandsMapper &OpdMapper) const
Apply OpdMapper.getInstrMapping() to OpdMapper.getMI().
insertpt_iterator begin()
Helper class that represents how the value of an instruction may be mapped and what is the related co...
iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
bool operator>(int64_t V1, const APSInt &V2)
unsigned getOpIdx() const
Reparing code needs to happen before InsertPoints.
bool isSplit() const override
Does this point involve splitting an edge or block? As soon as ::getPoint is called and thus...
InsertionPoints::const_iterator const_insertpt_iterator
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
unsigned const TargetRegisterInfo * TRI
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Mode
List of the modes supported by the RegBankSelect pass.
void switchTo(RepairingKind NewKind)
Change the type of this repairing placement to NewKind.
MachineBasicBlock::iterator getPoint()
The first call to this method will cause the splitting to happen if need be, then sub sequent calls j...
Holds all the information related to register banks.
bool canMaterialize() const override
Check whether this insertion point can be materialized.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
InsertionPoints::iterator insertpt_iterator
Abstract class used to represent an insertion point in a CFG.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
RepairingKind
Define the kind of action this repairing needs.
const_insertpt_iterator end() const
Target-Independent Code Generator Pass Configuration Options.
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
unsigned const MachineRegisterInfo * MRI
This pass implements the reg bank selector pass used in the GlobalISel pipeline.
Insertion point on an edge.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
bool canMaterialize() const
Helper class to build MachineInstr.
RegBankSelect(Mode RunningMode=Fast)
Create a RegBankSelect pass with the specified RunningMode.
bool isPredecessor(const MachineBasicBlock *MBB) const
Return true if the specified MBB is a predecessor of this block.
Represent the analysis usage information of a pass.
virtual void materialize()=0
Materialize the insertion point.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
virtual MachineBasicBlock::iterator getPointImpl()=0
Return the materialized insertion point.
const_insertpt_iterator begin() const
print lazy value Lazy Value Info Printer Pass
RepairingKind getKind() const
MBBInsertPoint(MachineBasicBlock &MBB, bool Beginning=true)
Struct used to represent the placement of a repairing point for a given operand.
MachineOperand class - Representation of each machine instruction operand.
MachineBasicBlock & getInsertMBB()
The first call to this method will cause the splitting to happen if need be, then sub sequent calls j...
unsigned pred_size() const
Helper struct that represents how a value is mapped through different register banks.
This file declares the MachineIRBuilder class.
A range adaptor for a pair of iterators.
MachineFunctionProperties getSetProperties() const override
typename SuperClass::iterator iterator
virtual bool canMaterialize() const
Check whether this insertion point can be materialized.
unsigned succ_size() const
const MachineBasicBlock * getParent() const
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
MachineFunctionProperties & set(Property P)
bool operator!=(uint64_t V1, const APInt &V2)
Representation of each machine instruction.
bool canMaterialize() const override
Check whether this insertion point can be materialized.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
bool isSplit() const override
Does this point involve splitting an edge or block? As soon as ::getPoint is called and thus...
Insertion point before or after an instruction.
EdgeInsertPoint(MachineBasicBlock &Src, MachineBasicBlock &Dst, Pass &P)
bool WasMaterialized
Tell if the insert point has already been materialized.
virtual void print(raw_ostream &OS, const Module *M) const
print - Print out the internal state of the pass.
iterator getFirstNonPHI()
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
bool runOnMachineFunction(MachineFunction &MF) override
Walk through MF and assign a register bank to every virtual register that are still mapped to nothing...
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
virtual uint64_t frequency(const Pass &P) const
Frequency of the insertion point.
MachineFunctionProperties getRequiredProperties() const override
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool operator<(int64_t V1, const APSInt &V2)
(Re)assign the register bank of the operand.
virtual bool isSplit() const
Does this point involve splitting an edge or block? As soon as ::getPoint is called and thus...
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
bool operator==(uint64_t V1, const APInt &V2)
Greedily minimize the cost of assigning register banks.
Insertion point at the beginning or end of a basic block.
MachineBasicBlock::iterator insert(MachineInstr &MI)
Insert MI in the just before ::getPoint()
Nothing to repair, just drop this action.
Properties which a MachineFunction may have at a given point in time.