summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2018-10-10 14:22:48 +0000
committerGuillaume Chatelet <gchatelet@google.com>2018-10-10 14:22:48 +0000
commitee9c2a17b823fe9c375002b4bec9ce989f5c66f5 (patch)
treeed700f70d8ea65a7b4fc90d34d9b5e406a3e5cbd /llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp
parent07acc992dc39edfccc5a4b773c3dcf8a5bf6d893 (diff)
downloadbcm5719-llvm-ee9c2a17b823fe9c375002b4bec9ce989f5c66f5.tar.gz
bcm5719-llvm-ee9c2a17b823fe9c375002b4bec9ce989f5c66f5.zip
[llvm-exegesis][NFC] Code simplification
Summary: Simplify code by having LLVMState hold the RegisterAliasingTrackerCache. Reviewers: courbet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D53078 llvm-svn: 344143
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp')
-rw-r--r--llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp b/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp
index 3765776f724..16dbd214e95 100644
--- a/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp
+++ b/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp
@@ -25,9 +25,7 @@ namespace exegesis {
SnippetGeneratorFailure::SnippetGeneratorFailure(const llvm::Twine &S)
: llvm::StringError(S, llvm::inconvertibleErrorCode()) {}
-SnippetGenerator::SnippetGenerator(const LLVMState &State)
- : State(State), RATC(State.getRegInfo(),
- getFunctionReservedRegs(State.getTargetMachine())) {}
+SnippetGenerator::SnippetGenerator(const LLVMState &State) : State(State) {}
SnippetGenerator::~SnippetGenerator() = default;
@@ -35,6 +33,7 @@ llvm::Expected<std::vector<BenchmarkCode>>
SnippetGenerator::generateConfigurations(unsigned Opcode) const {
if (auto E = generateCodeTemplate(Opcode)) {
CodeTemplate &CT = E.get();
+ const auto &RATC = State.getRATC();
const llvm::BitVector &ForbiddenRegs =
CT.ScratchSpacePointerInReg
? RATC.getRegister(CT.ScratchSpacePointerInReg).aliasedBits()
@@ -64,7 +63,7 @@ std::vector<RegisterValue> SnippetGenerator::computeRegisterInitialValues(
// Ignore memory operands which are handled separately.
// Loop invariant: DefinedRegs[i] is true iif it has been set at least once
// before the current instruction.
- llvm::BitVector DefinedRegs = RATC.emptyRegisters();
+ llvm::BitVector DefinedRegs = State.getRATC().emptyRegisters();
std::vector<RegisterValue> RIV;
for (const InstructionTemplate &IT : Instructions) {
// Returns the register that this Operand sets or uses, or 0 if this is not
OpenPOWER on IntegriCloud