Go to the documentation of this file.
9 #ifndef LLVM_CODEGEN_SWITCHLOWERINGUTILS_H
10 #define LLVM_CODEGEN_SWITCHLOWERINGUTILS_H
21 class BlockFrequencyInfo;
23 class FunctionLoweringInfo;
24 class MachineBasicBlock;
25 class ProfileSummaryInfo;
237 unsigned First,
unsigned Last);
304 #endif // LLVM_CODEGEN_SWITCHLOWERINGUTILS_H
JumpTable(unsigned R, unsigned J, MachineBasicBlock *M, MachineBasicBlock *D)
void sortAndRangeify(CaseClusterVector &Clusters)
Sort Clusters and merge adjacent cases.
This is an optimization pass for GlobalISel generic memory operations.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
A parsed version of the target data layout string in and methods for querying it.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
MachineBasicBlock * MBB
The MBB into which to emit the code for the indirect jump.
SwitchLowering(FunctionLoweringInfo &funcinfo)
This structure is used to communicate between SelectionDAGBuilder and SDISel for the code generation ...
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
@ CC_JumpTable
A cluster of cases suitable for jump table lowering.
void init(const TargetLowering &tli, const TargetMachine &tm, const DataLayout &dl)
CaseClusterVector::iterator CaseClusterIt
uint64_t getJumpTableNumCases(const SmallVectorImpl< unsigned > &TotalCases, unsigned First, unsigned Last)
Return the number of cases within a range.
bool FallthroughUnreachable
bool buildJumpTable(const CaseClusterVector &Clusters, unsigned First, unsigned Last, const SwitchInst *SI, MachineBasicBlock *DefaultMBB, CaseCluster &JTCluster)
MachineBasicBlock * Default
MachineBasicBlock * ThisBB
BranchProbability DefaultProb
This is the shared class of boolean and integer constants.
< i1 > br i1 label label bb bb
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
MachineBasicBlock * FalseBB
virtual ~SwitchLowering()=default
BitTestBlock(APInt F, APInt R, const Value *SV, unsigned Rg, MVT RgVT, bool E, bool CR, MachineBasicBlock *P, MachineBasicBlock *D, BitTestInfo C, BranchProbability Pr)
std::vector< BitTestBlock > BitTestCases
Vector of BitTestBlock structures used to communicate SwitchInst code generation information.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
(vector float) vec_cmpeq(*A, *B) C
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
std::vector< CaseBits > CaseBitsVector
CaseBlock(ISD::CondCode cc, const Value *cmplhs, const Value *cmprhs, const Value *cmpmiddle, MachineBasicBlock *truebb, MachineBasicBlock *falsebb, MachineBasicBlock *me, SDLoc dl, BranchProbability trueprob=BranchProbability::getUnknown(), BranchProbability falseprob=BranchProbability::getUnknown())
uint64_t getJumpTableRange(const CaseClusterVector &Clusters, unsigned First, unsigned Last)
Return the range of values within a range.
BranchProbability DefaultProb
BranchProbability FalseProb
static BranchProbability getUnknown()
std::pair< JumpTableHeader, JumpTable > JumpTableBlock
Analysis providing profile information.
SDLoc DL
The debug location of the instruction this CaseBlock was produced from.
BranchProbability ExtraProb
bool buildBitTests(CaseClusterVector &Clusters, unsigned First, unsigned Last, const SwitchInst *SI, CaseCluster &BTCluster)
Build a bit test cluster from Clusters[First..Last].
std::vector< JumpTableBlock > JTCases
Vector of JumpTable structures used to communicate SwitchInst code generation information.
MachineBasicBlock * Parent
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
struct PredInfoPair PredInfo
BranchProbability TrueProb
static CaseCluster jumpTable(const ConstantInt *Low, const ConstantInt *High, unsigned JTCasesIndex, BranchProbability Prob)
CaseBlock(CmpInst::Predicate pred, bool nocmp, const Value *cmplhs, const Value *cmprhs, const Value *cmpmiddle, MachineBasicBlock *truebb, MachineBasicBlock *falsebb, MachineBasicBlock *me, DebugLoc dl, BranchProbability trueprob=BranchProbability::getUnknown(), BranchProbability falseprob=BranchProbability::getUnknown())
unsigned Reg
The virtual register containing the index of the jump table entry to jump to.
MachineBasicBlock * ThisBB
Primary interface to the complete machine description for the target machine.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
StandardInstrumentations SI(Debug, VerifyEach)
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
std::vector< CaseBlock > SwitchCases
Vector of CaseBlock structures used to communicate SwitchInst code generation information.
@ CC_Range
A cluster of adjacent case labels with the same destination, or just one case.
Class for arbitrary precision integers.
BitTestCase(uint64_t M, MachineBasicBlock *T, MachineBasicBlock *Tr, BranchProbability Prob)
std::vector< CaseCluster > CaseClusterVector
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
void findJumpTables(CaseClusterVector &Clusters, const SwitchInst *SI, MachineBasicBlock *DefaultMBB, ProfileSummaryInfo *PSI, BlockFrequencyInfo *BFI)
void findBitTestClusters(CaseClusterVector &Clusters, const SwitchInst *SI)
CaseClusterIt LastCluster
CaseBits(uint64_t mask, MachineBasicBlock *bb, unsigned bits, BranchProbability Prob)
MachineBasicBlock * TrueBB
unsigned JTI
The JumpTableIndex for this jump table in the function.
static CaseCluster bitTests(const ConstantInt *Low, const ConstantInt *High, unsigned BTCasesIndex, BranchProbability Prob)
@ CC_BitTests
A cluster of cases suitable for bit test lowering.
MachineBasicBlock * TargetBB
static CaseCluster range(const ConstantInt *Low, const ConstantInt *High, MachineBasicBlock *MBB, BranchProbability Prob)
MachineBasicBlock * Default
The MBB of the default bb, which is a successor of the range check MBB.
LLVM Value Representation.
virtual void addSuccessorWithProb(MachineBasicBlock *Src, MachineBasicBlock *Dst, BranchProbability Prob=BranchProbability::getUnknown())=0
CaseClusterIt FirstCluster
BranchProbability ExtraProb
A cluster of case labels.