LLVM 22.0.0git
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

◆ CaseBitsVector

Definition at line 104 of file SwitchLoweringUtils.h.

◆ CaseClusterIt

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

Definition at line 87 of file SwitchLoweringUtils.h.

◆ CaseClusterVector

Definition at line 86 of file SwitchLoweringUtils.h.

◆ JumpTableBlock

Definition at line 202 of file SwitchLoweringUtils.h.

◆ SwitchWorkList

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)