mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-03-04 02:18:46 +00:00
Add option to specify minimum number of entries for jump tables
Add an option to allow easier experimentation by target maintainers with the minimum number of entries to create jump tables. Also clarify the name of the other existing option governing the creation of jump tables. Differential revision: https://reviews.llvm.org/D25883 llvm-svn: 285104
This commit is contained in:
parent
6fee2373b2
commit
d32b3c9325
@ -1051,9 +1051,7 @@ public:
|
||||
}
|
||||
|
||||
/// 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.
|
||||
@ -1389,9 +1387,7 @@ protected:
|
||||
}
|
||||
|
||||
/// 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.
|
||||
@ -1958,9 +1954,6 @@ private:
|
||||
/// 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;
|
||||
|
@ -45,9 +45,13 @@ static cl::opt<bool> JumpIsExpensiveOverride(
|
||||
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", cl::init(0), cl::Hidden,
|
||||
cl::desc("Set maximum number of jump table entries; zero for no limit."));
|
||||
("max-jump-table-size", cl::init(0), cl::Hidden,
|
||||
cl::desc("Set maximum size of jump tables; 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
|
||||
@ -826,7 +830,6 @@ TargetLoweringBase::TargetLoweringBase(const TargetMachine &tm) : TM(tm) {
|
||||
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;
|
||||
@ -1868,6 +1871,14 @@ Value *TargetLoweringBase::getSSPStackGuardCheck(const Module &M) const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
unsigned TargetLoweringBase::getMinimumJumpTableEntries() const {
|
||||
return MinimumJumpTableEntries;
|
||||
}
|
||||
|
||||
void TargetLoweringBase::setMinimumJumpTableEntries(unsigned Val) {
|
||||
MinimumJumpTableEntries = Val;
|
||||
}
|
||||
|
||||
unsigned TargetLoweringBase::getMaximumJumpTableSize() const {
|
||||
return MaximumJumpTableSize;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
; RUN: llc %s -O2 -print-machineinstrs -mtriple=aarch64-linux-gnu -jump-table-density=40 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK0 < %t
|
||||
; RUN: llc %s -O2 -print-machineinstrs -mtriple=aarch64-linux-gnu -jump-table-density=40 -max-jump-table=4 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK4 < %t
|
||||
; RUN: llc %s -O2 -print-machineinstrs -mtriple=aarch64-linux-gnu -jump-table-density=40 -max-jump-table=8 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK8 < %t
|
||||
; RUN: llc %s -O2 -print-machineinstrs -mtriple=aarch64-linux-gnu -jump-table-density=40 -mcpu=exynos-m1 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECKM1 < %t
|
||||
; RUN: llc %s -O2 -print-machineinstrs -mtriple=aarch64-linux-gnu -jump-table-density=40 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK0 < %t
|
||||
; RUN: llc %s -O2 -print-machineinstrs -mtriple=aarch64-linux-gnu -jump-table-density=40 -max-jump-table-size=4 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK4 < %t
|
||||
; RUN: llc %s -O2 -print-machineinstrs -mtriple=aarch64-linux-gnu -jump-table-density=40 -max-jump-table-size=8 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK8 < %t
|
||||
; RUN: llc %s -O2 -print-machineinstrs -mtriple=aarch64-linux-gnu -jump-table-density=40 -mcpu=exynos-m1 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECKM1 < %t
|
||||
|
||||
declare void @ext(i32)
|
||||
|
||||
|
79
test/CodeGen/AArch64/min-jump-table.ll
Normal file
79
test/CodeGen/AArch64/min-jump-table.ll
Normal file
@ -0,0 +1,79 @@
|
||||
; RUN: llc %s -O2 -print-machineinstrs -mtriple=aarch64-linux-gnu -jump-table-density=40 -min-jump-table-entries=0 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK0 < %t
|
||||
; RUN: llc %s -O2 -print-machineinstrs -mtriple=aarch64-linux-gnu -jump-table-density=40 -min-jump-table-entries=4 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK4 < %t
|
||||
; RUN: llc %s -O2 -print-machineinstrs -mtriple=aarch64-linux-gnu -jump-table-density=40 -min-jump-table-entries=8 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK8 < %t
|
||||
|
||||
declare void @ext(i32)
|
||||
|
||||
define i32 @jt2(i32 %a, i32 %b) {
|
||||
entry:
|
||||
switch i32 %a, label %return [
|
||||
i32 1, label %bb1
|
||||
i32 2, label %bb2
|
||||
]
|
||||
; CHECK-LABEL: function jt2:
|
||||
; CHECK0-NEXT: Jump Tables:
|
||||
; CHECK0-NEXT: jt#0:
|
||||
; CHECK0-NOT: jt#1:
|
||||
; CHECK4-NOT: Jump Tables:
|
||||
; CHECK8-NOT: Jump Tables:
|
||||
|
||||
bb1: tail call void @ext(i32 0) br label %return
|
||||
bb2: tail call void @ext(i32 2) br label %return
|
||||
|
||||
return: ret i32 %b
|
||||
}
|
||||
|
||||
define i32 @jt4(i32 %a, i32 %b) {
|
||||
entry:
|
||||
switch i32 %a, label %return [
|
||||
i32 1, label %bb1
|
||||
i32 2, label %bb2
|
||||
i32 3, label %bb3
|
||||
i32 4, label %bb4
|
||||
]
|
||||
; CHECK-LABEL: function jt4:
|
||||
; CHECK0-NEXT: Jump Tables:
|
||||
; CHECK0-NEXT: jt#0:
|
||||
; CHECK0-NOT: jt#1:
|
||||
; CHECK4-NEXT: Jump Tables:
|
||||
; CHECK4-NEXT: jt#0:
|
||||
; CHECK4-NOT: jt#1:
|
||||
; CHECK8-NOT: Jump Tables:
|
||||
|
||||
bb1: tail call void @ext(i32 0) br label %return
|
||||
bb2: tail call void @ext(i32 2) br label %return
|
||||
bb3: tail call void @ext(i32 4) br label %return
|
||||
bb4: tail call void @ext(i32 6) br label %return
|
||||
|
||||
return: ret i32 %b
|
||||
}
|
||||
|
||||
define i32 @jt8(i32 %a, i32 %b) {
|
||||
entry:
|
||||
switch i32 %a, label %return [
|
||||
i32 1, label %bb1
|
||||
i32 2, label %bb2
|
||||
i32 3, label %bb3
|
||||
i32 4, label %bb4
|
||||
i32 5, label %bb5
|
||||
i32 6, label %bb6
|
||||
i32 7, label %bb7
|
||||
i32 8, label %bb8
|
||||
]
|
||||
; CHECK-LABEL: function jt8:
|
||||
; CHECK-NEXT: Jump Tables:
|
||||
; CHECK-NEXT: jt#0:
|
||||
; CHECK-NOT: jt#1:
|
||||
|
||||
bb1: tail call void @ext(i32 0) br label %return
|
||||
bb2: tail call void @ext(i32 2) br label %return
|
||||
bb3: tail call void @ext(i32 4) br label %return
|
||||
bb4: tail call void @ext(i32 6) br label %return
|
||||
bb5: tail call void @ext(i32 8) br label %return
|
||||
bb6: tail call void @ext(i32 10) br label %return
|
||||
bb7: tail call void @ext(i32 12) br label %return
|
||||
bb8: tail call void @ext(i32 14) br label %return
|
||||
|
||||
return: ret i32 %b
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user