[PATCH] D25883: Add option to specify lower limit for jump tables

Evandro Menezes via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 21 15:21:22 PDT 2016


evandro created this revision.
evandro added reviewers: hans, t.p.northover.
evandro added a subscriber: llvm-commits.
evandro set the repository for this revision to rL LLVM.

Add an option to allow easier experimentation by target maintainers with the lower limit of cases to create jump tables.


Repository:
  rL LLVM

https://reviews.llvm.org/D25883

Files:
  llvm/include/llvm/Target/TargetLowering.h
  llvm/lib/CodeGen/TargetLoweringBase.cpp


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<unsigned> 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<unsigned> 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;
 }
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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25883.75498.patch
Type: text/x-patch
Size: 2557 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161021/606b58c2/attachment.bin>


More information about the llvm-commits mailing list