63 #ifndef LLVM_CODEGEN_GLOBALISEL_REGBANKSELECT_H 64 #define LLVM_CODEGEN_GLOBALISEL_REGBANKSELECT_H 79 class MachineBlockFrequencyInfo;
80 class MachineBranchProbabilityInfo;
82 class MachineRegisterInfo;
85 class TargetPassConfig;
86 class TargetRegisterInfo;
149 if (!WasMaterialized) {
150 WasMaterialized =
true;
168 if (!WasMaterialized) {
169 WasMaterialized =
true;
187 virtual bool isSplit()
const {
return false; }
248 return Beginning ? MBB.
begin() : MBB.
end();
259 "Invalid beginning point");
263 "Invalid end point");
266 bool isSplit()
const override {
return false; }
294 return DstOrSplit->
begin();
301 :
InsertPoint(), Src(Src), DstOrSplit(&Dst), P(P) {}
342 bool HasSplit =
false;
399 assert(NewKind != Kind &&
"Already of the right Kind");
401 InsertPoints.
clear();
402 CanMaterialize = NewKind != RepairingKind::Impossible;
404 assert(NewKind != RepairingKind::Insert &&
405 "We would need more MI to switch to Insert");
425 uint64_t LocalCost = 0;
428 uint64_t NonLocalCost = 0;
432 MappingCost(uint64_t LocalCost, uint64_t NonLocalCost, uint64_t LocalFreq)
433 : LocalCost(LocalCost), NonLocalCost(NonLocalCost),
434 LocalFreq(LocalFreq) {}
437 bool isSaturated()
const;
446 bool addLocalCost(uint64_t Cost);
451 bool addNonLocalCost(uint64_t Cost);
458 static MappingCost ImpossibleCost();
461 bool operator<(
const MappingCost &Cost)
const;
463 bool operator==(
const MappingCost &Cost)
const;
465 bool operator!=(
const MappingCost &Cost)
const {
return !(*
this == Cost); }
467 bool operator>(
const MappingCost &Cost)
const {
468 return *
this != Cost && Cost < *
this;
504 std::unique_ptr<MachineOptimizationRemarkEmitter>
MORE;
528 bool &OnlyAssign)
const;
595 const MappingCost *BestCost =
nullptr);
669 #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.
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.
bool isSplit() const override
Does this point involve splitting an edge or block? As soon as ::getPoint is called and thus...
MachineFunctionProperties getClearedProperties() const override
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.
Wrapper class representing virtual and physical registers.