From ee9c2a17b823fe9c375002b4bec9ce989f5c66f5 Mon Sep 17 00:00:00 2001 From: Guillaume Chatelet Date: Wed, 10 Oct 2018 14:22:48 +0000 Subject: [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 --- llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp') 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> 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 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 RIV; for (const InstructionTemplate &IT : Instructions) { // Returns the register that this Operand sets or uses, or 0 if this is not -- cgit v1.2.3