diff options
| author | Guillaume Chatelet <gchatelet@google.com> | 2018-09-20 12:22:18 +0000 |
|---|---|---|
| committer | Guillaume Chatelet <gchatelet@google.com> | 2018-09-20 12:22:18 +0000 |
| commit | c96a97bac7296b11800866b1ccbadadfe0e6bd4b (patch) | |
| tree | 95199ea352a3c7d3a68b90a16a3734af31157405 /llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp | |
| parent | b00e0714e621fcf1cc56a46624f90cf15507a8db (diff) | |
| download | bcm5719-llvm-c96a97bac7296b11800866b1ccbadadfe0e6bd4b.tar.gz bcm5719-llvm-c96a97bac7296b11800866b1ccbadadfe0e6bd4b.zip | |
[llvm-exegesis] Improve Register Setup (roll forward of D51856).
Summary:
Added function to set a register to a particular value + tests.
Add EFLAGS test, use new setRegTo instead of setRegToConstant.
Reviewers: courbet, javed.absar
Subscribers: llvm-commits, tschuett, mgorny
Differential Revision: https://reviews.llvm.org/D52297
llvm-svn: 342644
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp')
| -rw-r--r-- | llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp b/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp index 5b51a09923a..cb58b2dfc4b 100644 --- a/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp +++ b/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp @@ -49,7 +49,7 @@ SnippetGenerator::generateConfigurations(unsigned Opcode) const { } if (CT.ScratchSpacePointerInReg) BC.LiveIns.push_back(CT.ScratchSpacePointerInReg); - BC.RegsToDef = computeRegsToDef(CT.Instructions); + BC.RegisterInitialValues = computeRegisterInitialValues(CT.Instructions); Output.push_back(std::move(BC)); } return Output; @@ -57,14 +57,14 @@ SnippetGenerator::generateConfigurations(unsigned Opcode) const { return E.takeError(); } -std::vector<unsigned> SnippetGenerator::computeRegsToDef( +std::vector<RegisterValue> SnippetGenerator::computeRegisterInitialValues( const std::vector<InstructionBuilder> &Instructions) const { // Collect all register uses and create an assignment for each of them. // 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(); - std::vector<unsigned> RegsToDef; + std::vector<RegisterValue> RIV; for (const InstructionBuilder &IB : Instructions) { // Returns the register that this Operand sets or uses, or 0 if this is not // a register. @@ -82,7 +82,7 @@ std::vector<unsigned> SnippetGenerator::computeRegsToDef( if (!Op.IsDef) { const unsigned Reg = GetOpReg(Op); if (Reg > 0 && !DefinedRegs.test(Reg)) { - RegsToDef.push_back(Reg); + RIV.push_back(RegisterValue{Reg, llvm::APInt()}); DefinedRegs.set(Reg); } } @@ -96,7 +96,7 @@ std::vector<unsigned> SnippetGenerator::computeRegsToDef( } } } - return RegsToDef; + return RIV; } llvm::Expected<CodeTemplate> SnippetGenerator::generateSelfAliasingCodeTemplate( |

