xref: /llvm-project/llvm/unittests/tools/llvm-exegesis/PowerPC/TestBase.h (revision 7053e863a159c35b57efab1aba844231077c526e)
1c8ec685cSJinsong Ji //===-- TestBase.h ----------------------------------------------*- C++ -*-===//
2c8ec685cSJinsong Ji //
3c8ec685cSJinsong Ji // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4c8ec685cSJinsong Ji // See https://llvm.org/LICENSE.txt for license information.
5c8ec685cSJinsong Ji // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6c8ec685cSJinsong Ji //
7c8ec685cSJinsong Ji //===----------------------------------------------------------------------===//
8c8ec685cSJinsong Ji // Test fixture common to all PowerPC tests.
9c8ec685cSJinsong Ji //===----------------------------------------------------------------------===//
10c8ec685cSJinsong Ji 
11c8ec685cSJinsong Ji #ifndef LLVM_UNITTESTS_TOOLS_LLVMEXEGESIS_POWERPC_TESTBASE_H
12c8ec685cSJinsong Ji #define LLVM_UNITTESTS_TOOLS_LLVMEXEGESIS_POWERPC_TESTBASE_H
13c8ec685cSJinsong Ji 
14c8ec685cSJinsong Ji #include "LlvmState.h"
1589b57061SReid Kleckner #include "llvm/MC/TargetRegistry.h"
16c8ec685cSJinsong Ji #include "llvm/Support/TargetSelect.h"
17c8ec685cSJinsong Ji #include "gmock/gmock.h"
18c8ec685cSJinsong Ji #include "gtest/gtest.h"
19c8ec685cSJinsong Ji 
20c8ec685cSJinsong Ji namespace llvm {
21c8ec685cSJinsong Ji namespace exegesis {
22c8ec685cSJinsong Ji 
23c8ec685cSJinsong Ji void InitializePowerPCExegesisTarget();
24c8ec685cSJinsong Ji 
25c8ec685cSJinsong Ji class PPCTestBase : public ::testing::Test {
26c8ec685cSJinsong Ji protected:
PPCTestBase()27*7053e863SClement Courbet   PPCTestBase()
28*7053e863SClement Courbet       : State(cantFail(
29*7053e863SClement Courbet             LLVMState::Create("powerpc64le-unknown-linux", "ppc64le"))) {}
30c8ec685cSJinsong Ji 
SetUpTestCase()31c8ec685cSJinsong Ji   static void SetUpTestCase() {
32c8ec685cSJinsong Ji     LLVMInitializePowerPCTargetInfo();
33c8ec685cSJinsong Ji     LLVMInitializePowerPCTargetMC();
34c8ec685cSJinsong Ji     LLVMInitializePowerPCTarget();
35c8ec685cSJinsong Ji     InitializePowerPCExegesisTarget();
36c8ec685cSJinsong Ji   }
37c8ec685cSJinsong Ji 
38c8ec685cSJinsong Ji   const LLVMState State;
39c8ec685cSJinsong Ji };
40c8ec685cSJinsong Ji 
41c8ec685cSJinsong Ji } // namespace exegesis
42c8ec685cSJinsong Ji } // namespace llvm
43c8ec685cSJinsong Ji 
44c8ec685cSJinsong Ji #endif
45