John Brawn | c4ed600 | 2018-07-03 10:10:29 +0000 | [diff] [blame^] | 1 | #include "Target.h" |
| 2 | |
| 3 | #include <cassert> |
| 4 | #include <memory> |
| 5 | |
| 6 | #include "MCTargetDesc/AArch64MCTargetDesc.h" |
| 7 | #include "gmock/gmock.h" |
| 8 | #include "gtest/gtest.h" |
| 9 | |
| 10 | namespace exegesis { |
| 11 | |
| 12 | void InitializeAArch64ExegesisTarget(); |
| 13 | |
| 14 | namespace { |
| 15 | |
| 16 | using testing::Gt; |
| 17 | using testing::NotNull; |
| 18 | using testing::SizeIs; |
| 19 | |
| 20 | class AArch64TargetTest : public ::testing::Test { |
| 21 | protected: |
| 22 | AArch64TargetTest() |
| 23 | : Target_(ExegesisTarget::lookup(llvm::Triple("aarch64-unknown-linux"))) { |
| 24 | EXPECT_THAT(Target_, NotNull()); |
| 25 | } |
| 26 | static void SetUpTestCase() { InitializeAArch64ExegesisTarget(); } |
| 27 | |
| 28 | const ExegesisTarget *const Target_; |
| 29 | }; |
| 30 | |
| 31 | TEST_F(AArch64TargetTest, SetRegToConstant) { |
| 32 | // The AArch64 target currently doesn't know how to set register values |
| 33 | const auto Insts = Target_->setRegToConstant(llvm::AArch64::X0); |
| 34 | EXPECT_THAT(Insts, SizeIs(0)); |
| 35 | } |
| 36 | |
| 37 | } // namespace |
| 38 | } // namespace exegesis |