diff options
| author | John Brawn <john.brawn@arm.com> | 2018-07-03 10:10:29 +0000 |
|---|---|---|
| committer | John Brawn <john.brawn@arm.com> | 2018-07-03 10:10:29 +0000 |
| commit | c4ed60042fa942d1e2c42cd5e0edaff29815f6b7 (patch) | |
| tree | 9bcd8dc30b7103dceb1905a2bf771151569b926b /llvm/unittests/tools | |
| parent | 7fc854320861b4ff2e7bed6387d75b4f030c03c5 (diff) | |
| download | bcm5719-llvm-c4ed60042fa942d1e2c42cd5e0edaff29815f6b7.tar.gz bcm5719-llvm-c4ed60042fa942d1e2c42cd5e0edaff29815f6b7.zip | |
[llvm-exegesis] Add an AArch64 target
The target does just enough to be able to run llvm-exegesis in latency mode for
at least some opcodes.
Differential Revision: https://reviews.llvm.org/D48780
llvm-svn: 336187
Diffstat (limited to 'llvm/unittests/tools')
3 files changed, 62 insertions, 0 deletions
diff --git a/llvm/unittests/tools/llvm-exegesis/AArch64/CMakeLists.txt b/llvm/unittests/tools/llvm-exegesis/AArch64/CMakeLists.txt new file mode 100644 index 00000000000..392efce26c0 --- /dev/null +++ b/llvm/unittests/tools/llvm-exegesis/AArch64/CMakeLists.txt @@ -0,0 +1,21 @@ +include_directories( + ${LLVM_MAIN_SRC_DIR}/lib/Target/AArch64 + ${LLVM_BINARY_DIR}/lib/Target/AArch64 + ${LLVM_MAIN_SRC_DIR}/tools/llvm-exegesis/lib + ) + +set(LLVM_LINK_COMPONENTS + MC + MCParser + Object + Support + Symbolize + AArch64 + ) + +add_llvm_unittest(LLVMExegesisAArch64Tests + TargetTest.cpp + ) +target_link_libraries(LLVMExegesisAArch64Tests PRIVATE + LLVMExegesis + LLVMExegesisAArch64) diff --git a/llvm/unittests/tools/llvm-exegesis/AArch64/TargetTest.cpp b/llvm/unittests/tools/llvm-exegesis/AArch64/TargetTest.cpp new file mode 100644 index 00000000000..7d1f2e4804e --- /dev/null +++ b/llvm/unittests/tools/llvm-exegesis/AArch64/TargetTest.cpp @@ -0,0 +1,38 @@ +#include "Target.h" + +#include <cassert> +#include <memory> + +#include "MCTargetDesc/AArch64MCTargetDesc.h" +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +namespace exegesis { + +void InitializeAArch64ExegesisTarget(); + +namespace { + +using testing::Gt; +using testing::NotNull; +using testing::SizeIs; + +class AArch64TargetTest : public ::testing::Test { +protected: + AArch64TargetTest() + : Target_(ExegesisTarget::lookup(llvm::Triple("aarch64-unknown-linux"))) { + EXPECT_THAT(Target_, NotNull()); + } + static void SetUpTestCase() { InitializeAArch64ExegesisTarget(); } + + const ExegesisTarget *const Target_; +}; + +TEST_F(AArch64TargetTest, SetRegToConstant) { + // The AArch64 target currently doesn't know how to set register values + const auto Insts = Target_->setRegToConstant(llvm::AArch64::X0); + EXPECT_THAT(Insts, SizeIs(0)); +} + +} // namespace +} // namespace exegesis diff --git a/llvm/unittests/tools/llvm-exegesis/CMakeLists.txt b/llvm/unittests/tools/llvm-exegesis/CMakeLists.txt index 867df415b93..9afa17a8e80 100644 --- a/llvm/unittests/tools/llvm-exegesis/CMakeLists.txt +++ b/llvm/unittests/tools/llvm-exegesis/CMakeLists.txt @@ -23,3 +23,6 @@ endif() if(LLVM_TARGETS_TO_BUILD MATCHES "ARM") add_subdirectory(ARM) endif() +if(LLVM_TARGETS_TO_BUILD MATCHES "AArch64") + add_subdirectory(AArch64) +endif() |

