Index: llvm/include/llvm/Target/TargetLowering.h =================================================================== --- llvm/include/llvm/Target/TargetLowering.h +++ llvm/include/llvm/Target/TargetLowering.h @@ -1027,9 +1027,7 @@ } /// Return lower limit for number of blocks in a jump table. - unsigned getMinimumJumpTableEntries() const { - return MinimumJumpTableEntries; - } + unsigned getMinimumJumpTableEntries() const; /// Return upper limit for number of entries in a jump table. /// Zero if no limit. @@ -1361,9 +1359,7 @@ } /// Indicate the minimum number of blocks to generate jump tables. - void setMinimumJumpTableEntries(unsigned Val) { - MinimumJumpTableEntries = Val; - } + void setMinimumJumpTableEntries(unsigned Val); /// Indicate the maximum number of entries in jump tables. /// Set to zero to generate unlimited jump tables. @@ -1930,9 +1926,6 @@ /// Defaults to false. bool UseUnderscoreLongJmp; - /// Number of blocks threshold to use jump tables. - int MinimumJumpTableEntries; - /// Information about the contents of the high-bits in boolean values held in /// a type wider than i1. See getBooleanContents. BooleanContent BooleanContents; Index: llvm/lib/CodeGen/TargetLoweringBase.cpp =================================================================== --- llvm/lib/CodeGen/TargetLoweringBase.cpp +++ llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -44,6 +44,10 @@ cl::desc("Do not create extra branches to split comparison logic."), cl::Hidden); +static cl::opt MinimumJumpTableEntries + ("min-jump-table-entries", cl::init(4), cl::Hidden, + cl::desc("Set minimum number of entries to use a jump table.")); + static cl::opt MaximumJumpTableSize ("max-jump-table-size", cl::init(0), cl::Hidden, cl::desc("Set maximum size of jump table; zero for no limit.")); @@ -825,7 +829,6 @@ PrefLoopAlignment = 0; GatherAllAliasesMaxDepth = 6; MinStackArgumentAlignment = 1; - MinimumJumpTableEntries = 4; // TODO: the default will be switched to 0 in the next commit, along // with the Target-specific changes necessary. MaxAtomicSizeInBitsSupported = 1024; @@ -1852,6 +1855,14 @@ return nullptr; } +unsigned TargetLoweringBase::getMinimumJumpTableEntries() const { + return MinimumJumpTableEntries; +} + +void TargetLoweringBase::setMinimumJumpTableEntries(unsigned Val) { + MinimumJumpTableEntries = Val; +} + unsigned TargetLoweringBase::getMaximumJumpTableSize() const { return MaximumJumpTableSize; }