diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-09-18 15:35:49 +0000 |
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-09-18 15:35:49 +0000 |
| commit | 0242689725acffb69d58837b721c9cc6898f0327 (patch) | |
| tree | 7fbf5734bcf16ba63820c0851bf96ba82a1e6b15 /llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h | |
| parent | 68f73c12067573c01e6e1351d346776d0373570d (diff) | |
| download | bcm5719-llvm-0242689725acffb69d58837b721c9cc6898f0327.tar.gz bcm5719-llvm-0242689725acffb69d58837b721c9cc6898f0327.zip | |
Revert rL342466: [llvm-exegesis] Improve Register Setup.
rL342465 is breaking the MSVC buildbots, but I need to revert this dependent revision as well.
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: mgorny, tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D51856
llvm-svn: 342489
Diffstat (limited to 'llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h')
| -rw-r--r-- | llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h b/llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h index cc00cee58e3..9265e3e5be9 100644 --- a/llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h +++ b/llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h @@ -32,9 +32,7 @@ protected: const std::string &CpuName) : TT(TT), CpuName(CpuName), CanExecute(llvm::Triple(TT).getArch() == - llvm::Triple(llvm::sys::getProcessTriple()).getArch()), - ET(ExegesisTarget::lookup(llvm::Triple(TT))) { - assert(ET); + llvm::Triple(llvm::sys::getProcessTriple()).getArch()) { if (!CanExecute) { llvm::outs() << "Skipping execution, host:" << llvm::sys::getProcessTriple() << ", target:" << TT @@ -43,12 +41,12 @@ protected: } template <class... Bs> - inline void Check(llvm::ArrayRef<RegisterValue> RegisterInitialValues, - llvm::MCInst MCInst, Bs... Bytes) { + inline void Check(const ExegesisTarget &ET, + llvm::ArrayRef<unsigned> RegsToDef, llvm::MCInst MCInst, + Bs... Bytes) { ExecutableFunction Function = - (MCInst.getOpcode() == 0) - ? assembleToFunction(RegisterInitialValues, {}) - : assembleToFunction(RegisterInitialValues, {MCInst}); + (MCInst.getOpcode() == 0) ? assembleToFunction(ET, RegsToDef, {}) + : assembleToFunction(ET, RegsToDef, {MCInst}); ASSERT_THAT(Function.getFunctionBytes().str(), testing::ElementsAre(Bytes...)); if (CanExecute) { @@ -72,12 +70,14 @@ private: } ExecutableFunction - assembleToFunction(llvm::ArrayRef<RegisterValue> RegisterInitialValues, + assembleToFunction(const ExegesisTarget &ET, + llvm::ArrayRef<unsigned> RegsToDef, llvm::ArrayRef<llvm::MCInst> Instructions) { llvm::SmallString<256> Buffer; llvm::raw_svector_ostream AsmStream(Buffer); - assembleToStream(*ET, createTargetMachine(), /*LiveIns=*/{}, - RegisterInitialValues, Instructions, AsmStream); + assembleToStream(ET, createTargetMachine(), /*LiveIns=*/{}, + RegsToDef, Instructions, + AsmStream); return ExecutableFunction(createTargetMachine(), getObjectFromBuffer(AsmStream.str())); } @@ -85,7 +85,6 @@ private: const std::string TT; const std::string CpuName; const bool CanExecute; - const ExegesisTarget *const ET; }; } // namespace exegesis |

