LLVM 19.0.0git
Classes | Typedefs | Enumerations | Functions
llvm::SwitchCG Namespace Reference

Classes

struct  BitTestBlock
 
struct  BitTestCase
 
struct  CaseBits
 
struct  CaseBlock
 This structure is used to communicate between SelectionDAGBuilder and SDISel for the code generation of additional basic blocks needed by multi-case switch statements. More...
 
struct  CaseCluster
 A cluster of case labels. More...
 
struct  JumpTable
 
struct  JumpTableHeader
 
class  SwitchLowering
 
struct  SwitchWorkListItem
 

Typedefs

using CaseClusterVector = std::vector< CaseCluster >
 
using CaseClusterIt = CaseClusterVector::iterator
 
using CaseBitsVector = std::vector< CaseBits >
 
using JumpTableBlock = std::pair< JumpTableHeader, JumpTable >
 
using BitTestInfo = SmallVector< BitTestCase, 3 >
 
using SwitchWorkList = SmallVector< SwitchWorkListItem, 4 >
 

Enumerations

enum  CaseClusterKind { CC_Range , CC_JumpTable , CC_BitTests }
 

Functions

void sortAndRangeify (CaseClusterVector &Clusters)
 Sort Clusters and merge adjacent cases.
 
uint64_t getJumpTableRange (const CaseClusterVector &Clusters, unsigned First, unsigned Last)
 Return the range of values within a range.
 
uint64_t getJumpTableNumCases (const SmallVectorImpl< unsigned > &TotalCases, unsigned First, unsigned Last)
 Return the number of cases within a range.
 

Typedef Documentation

◆ BitTestInfo

Definition at line 210 of file SwitchLoweringUtils.h.

◆ CaseBitsVector

using llvm::SwitchCG::CaseBitsVector = typedef std::vector<CaseBits>

Definition at line 104 of file SwitchLoweringUtils.h.

◆ CaseClusterIt

using llvm::SwitchCG::CaseClusterIt = typedef CaseClusterVector::iterator

Definition at line 87 of file SwitchLoweringUtils.h.

◆ CaseClusterVector

using llvm::SwitchCG::CaseClusterVector = typedef std::vector<CaseCluster>

Definition at line 86 of file SwitchLoweringUtils.h.

◆ JumpTableBlock

Definition at line 197 of file SwitchLoweringUtils.h.

◆ SwitchWorkList

Definition at line 251 of file SwitchLoweringUtils.h.

Enumeration Type Documentation

◆ CaseClusterKind

Enumerator
CC_Range 

A cluster of adjacent case labels with the same destination, or just one case.

CC_JumpTable 

A cluster of cases suitable for jump table lowering.

CC_BitTests 

A cluster of cases suitable for bit test lowering.

Definition at line 31 of file SwitchLoweringUtils.h.

Function Documentation

◆ getJumpTableNumCases()

uint64_t llvm::SwitchCG::getJumpTableNumCases ( const SmallVectorImpl< unsigned > &  TotalCases,
unsigned  First,
unsigned  Last 
)

Return the number of cases within a range.

Definition at line 37 of file SwitchLoweringUtils.cpp.

References assert(), llvm::First, and llvm::Last.

Referenced by llvm::SwitchCG::SwitchLowering::findJumpTables().

◆ getJumpTableRange()

uint64_t llvm::SwitchCG::getJumpTableRange ( const CaseClusterVector Clusters,
unsigned  First,
unsigned  Last 
)

Return the range of values within a range.

Definition at line 23 of file SwitchLoweringUtils.cpp.

References assert(), llvm::First, llvm::APInt::getBitWidth(), llvm::Last, and UINT64_MAX.

Referenced by llvm::SwitchCG::SwitchLowering::findJumpTables().

◆ sortAndRangeify()

void llvm::SwitchCG::sortAndRangeify ( CaseClusterVector Clusters)

Sort Clusters and merge adjacent cases.

Definition at line 466 of file SwitchLoweringUtils.cpp.

References assert(), CC, llvm::ConstantInt::getValue(), llvm::SwitchCG::CaseCluster::Low, MBB, N, and llvm::sort().