LLVM 20.0.0git
|
#include "llvm/CodeGen/SwitchLoweringUtils.h"
Classes | |
struct | SplitWorkItemInfo |
Public Attributes | |
std::vector< CaseBlock > | SwitchCases |
Vector of CaseBlock structures used to communicate SwitchInst code generation information. | |
std::vector< JumpTableBlock > | JTCases |
Vector of JumpTable structures used to communicate SwitchInst code generation information. | |
std::vector< BitTestBlock > | BitTestCases |
Vector of BitTestBlock structures used to communicate SwitchInst code generation information. | |
Definition at line 258 of file SwitchLoweringUtils.h.
|
inline |
Definition at line 260 of file SwitchLoweringUtils.h.
|
virtualdefault |
References DL.
|
pure virtual |
Implemented in llvm::SelectionDAGBuilder::SDAGSwitchLowering.
bool SwitchCG::SwitchLowering::buildBitTests | ( | CaseClusterVector & | Clusters, |
unsigned | First, | ||
unsigned | Last, | ||
const SwitchInst * | SI, | ||
CaseCluster & | BTCluster | ||
) |
Build a bit test cluster from Clusters[First..Last].
Returns false if it decides it's not a good idea.
Definition at line 367 of file SwitchLoweringUtils.cpp.
References assert(), llvm::SwitchCG::CaseBits::Bits, llvm::SwitchCG::CaseCluster::bitTests(), llvm::BitWidth, llvm::SwitchCG::CC_Range, llvm::BitVector::count(), DL, llvm::SwitchCG::CaseBits::ExtraProb, llvm::First, llvm::MachineBasicBlock::getNumber(), llvm::BranchProbability::getZero(), llvm::APInt::getZero(), llvm::Hi, High, I, if(), llvm::Last, llvm::Lo, llvm::Low, llvm::SwitchCG::CaseBits::Mask, MBB, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::BitVector::set(), and llvm::sort().
bool SwitchCG::SwitchLowering::buildJumpTable | ( | const CaseClusterVector & | Clusters, |
unsigned | First, | ||
unsigned | Last, | ||
const SwitchInst * | SI, | ||
const std::optional< SDLoc > & | SL, | ||
MachineBasicBlock * | DefaultMBB, | ||
CaseCluster & | JTCluster | ||
) |
Definition at line 192 of file SwitchLoweringUtils.cpp.
References assert(), llvm::SwitchCG::CC_Range, llvm::MachineJumpTableInfo::createJumpTableIndex(), llvm::MachineFunction::CreateMachineBasicBlock(), DL, llvm::Done, llvm::First, llvm::MachineFunction::getOrCreateJumpTableInfo(), llvm::BranchProbability::getZero(), High, I, llvm::SwitchCG::CaseCluster::jumpTable(), llvm::Last, llvm::Low, MBB, llvm::MachineBasicBlock::normalizeSuccProbs(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::size(), and llvm::APInt::slt().
Referenced by findJumpTables().
unsigned SwitchCG::SwitchLowering::caseClusterRank | ( | const CaseCluster & | CC, |
CaseClusterIt | First, | ||
CaseClusterIt | Last | ||
) |
Determine the rank by weight of CC in [First,Last].
If CC has more weight than each cluster in the range, its rank is 0.
Definition at line 499 of file SwitchLoweringUtils.cpp.
References CC, llvm::First, llvm::Last, and X.
llvm::SwitchCG::SwitchLowering::SplitWorkItemInfo SwitchCG::SwitchLowering::computeSplitWorkItemInfo | ( | const SwitchWorkListItem & | W | ) |
Compute information to balance the tree based on branch probabilities to create a near-optimal (in terms of search time given key frequency) binary search tree.
See e.g. Kurt Mehlhorn "Nearly Optimal Binary Search Trees" (1975).
Definition at line 512 of file SwitchLoweringUtils.cpp.
void SwitchCG::SwitchLowering::findBitTestClusters | ( | CaseClusterVector & | Clusters, |
const SwitchInst * | SI | ||
) |
Definition at line 268 of file SwitchLoweringUtils.cpp.
References assert(), llvm::BitWidth, llvm::CallingConv::C, llvm::SwitchCG::CC_JumpTable, llvm::SwitchCG::CC_Range, llvm::BitVector::count(), DL, llvm::First, llvm::MachineBasicBlock::getNumber(), llvm::EVT::getSizeInBits(), High, llvm::Last, MBB, N, llvm::None, llvm::BitVector::set(), and llvm::ISD::SHL.
void SwitchCG::SwitchLowering::findJumpTables | ( | CaseClusterVector & | Clusters, |
const SwitchInst * | SI, | ||
std::optional< SDLoc > | SL, | ||
MachineBasicBlock * | DefaultMBB, | ||
ProfileSummaryInfo * | PSI, | ||
BlockFrequencyInfo * | BFI | ||
) |
Definition at line 46 of file SwitchLoweringUtils.cpp.
References llvm::TargetLoweringBase::areJTsAllowed(), assert(), buildJumpTable(), llvm::CallingConv::C, llvm::SwitchCG::CC_Range, llvm::First, llvm::SwitchCG::getJumpTableNumCases(), llvm::SwitchCG::getJumpTableRange(), llvm::TargetLoweringBase::getMinimumJumpTableEntries(), llvm::TargetMachine::getOptLevel(), llvm::Hi, High, I, llvm::TargetLoweringBase::isSuitableForJumpTable(), llvm::Last, llvm::Lo, N, llvm::None, Range, and UINT64_MAX.
|
inline |
Definition at line 262 of file SwitchLoweringUtils.h.
References DL.
std::vector<BitTestBlock> llvm::SwitchCG::SwitchLowering::BitTestCases |
Vector of BitTestBlock structures used to communicate SwitchInst code generation information.
Definition at line 279 of file SwitchLoweringUtils.h.
std::vector<JumpTableBlock> llvm::SwitchCG::SwitchLowering::JTCases |
Vector of JumpTable structures used to communicate SwitchInst code generation information.
Definition at line 275 of file SwitchLoweringUtils.h.
std::vector<CaseBlock> llvm::SwitchCG::SwitchLowering::SwitchCases |
Vector of CaseBlock structures used to communicate SwitchInst code generation information.
Definition at line 271 of file SwitchLoweringUtils.h.