diff options
author | Evandro Menezes <e.menezes@samsung.com> | 2016-09-26 15:32:33 +0000 |
---|---|---|
committer | Evandro Menezes <e.menezes@samsung.com> | 2016-09-26 15:32:33 +0000 |
commit | e45de8a5ec7ad35cb770cd2eed61c56a81982231 (patch) | |
tree | 182e73491cb20615d5abece9d9a5dd54996ef991 /llvm/lib/CodeGen/TargetLoweringBase.cpp | |
parent | 13264ebea47bdd60372af22262d782b6e6898167 (diff) | |
download | bcm5719-llvm-e45de8a5ec7ad35cb770cd2eed61c56a81982231.tar.gz bcm5719-llvm-e45de8a5ec7ad35cb770cd2eed61c56a81982231.zip |
Add support to optionally limit the size of jump tables.
Many high-performance processors have a dedicated branch predictor for
indirect branches, commonly used with jump tables. As sophisticated as such
branch predictors are, they tend to have well defined limits beyond which
their effectiveness is hampered or even nullified. One such limit is the
number of possible destinations for a given indirect branches that such
branch predictors can handle.
This patch considers a limit that a target may set to the number of
destination addresses in a jump table.
Patch by: Evandro Menezes <e.menezes@samsung.com>, Aditya Kumar
<aditya.k7@samsung.com>, Sebastian Pop <s.pop@samsung.com>.
Differential revision: https://reviews.llvm.org/D21940
llvm-svn: 282412
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringBase.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringBase.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp index 4c11f2131f2..be66f7e9e0e 100644 --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -44,6 +44,10 @@ static cl::opt<bool> JumpIsExpensiveOverride( cl::desc("Do not create extra branches to split comparison logic."), cl::Hidden); +static cl::opt<unsigned> MaximumJumpTableSize + ("max-jump-table", cl::init(0), cl::Hidden, + cl::desc("Set maximum number of jump table entries; zero for no limit.")); + // Although this default value is arbitrary, it is not random. It is assumed // that a condition that evaluates the same way by a higher percentage than this // is best represented as control flow. Therefore, the default value N should be @@ -1831,3 +1835,11 @@ Value *TargetLoweringBase::getSDagStackGuard(const Module &M) const { Value *TargetLoweringBase::getSSPStackGuardCheck(const Module &M) const { return nullptr; } + +unsigned TargetLoweringBase::getMaximumJumpTableSize() const { + return MaximumJumpTableSize; +} + +void TargetLoweringBase::setMaximumJumpTableSize(unsigned Val) { + MaximumJumpTableSize = Val; +} |