xref: /llvm-project/llvm/unittests/tools/llvm-exegesis/Mips/TestBase.h (revision 7053e863a159c35b57efab1aba844231077c526e)
131458a9fSMiloš Stojanović //===-- TestBase.h ----------------------------------------------*- C++ -*-===//
231458a9fSMiloš Stojanović //
331458a9fSMiloš Stojanović // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
431458a9fSMiloš Stojanović // See https://llvm.org/LICENSE.txt for license information.
531458a9fSMiloš Stojanović // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
631458a9fSMiloš Stojanović //
731458a9fSMiloš Stojanović //===----------------------------------------------------------------------===//
831458a9fSMiloš Stojanović // Test fixture common to all Mips tests.
931458a9fSMiloš Stojanović //===----------------------------------------------------------------------===//
1031458a9fSMiloš Stojanović 
1131458a9fSMiloš Stojanović #ifndef LLVM_UNITTESTS_TOOLS_LLVMEXEGESIS_MIPS_TESTBASE_H
1231458a9fSMiloš Stojanović #define LLVM_UNITTESTS_TOOLS_LLVMEXEGESIS_MIPS_TESTBASE_H
1331458a9fSMiloš Stojanović 
1431458a9fSMiloš Stojanović #include "LlvmState.h"
1589b57061SReid Kleckner #include "llvm/MC/TargetRegistry.h"
1631458a9fSMiloš Stojanović #include "llvm/Support/TargetSelect.h"
1731458a9fSMiloš Stojanović #include "gmock/gmock.h"
1831458a9fSMiloš Stojanović #include "gtest/gtest.h"
1931458a9fSMiloš Stojanović 
2031458a9fSMiloš Stojanović namespace llvm {
2131458a9fSMiloš Stojanović namespace exegesis {
2231458a9fSMiloš Stojanović 
2331458a9fSMiloš Stojanović void InitializeMipsExegesisTarget();
2431458a9fSMiloš Stojanović 
2531458a9fSMiloš Stojanović class MipsTestBase : public ::testing::Test {
2631458a9fSMiloš Stojanović protected:
MipsTestBase()27*7053e863SClement Courbet   MipsTestBase()
28*7053e863SClement Courbet       : State(cantFail(LLVMState::Create("mips-unknown-linux", "mips32"))) {}
2931458a9fSMiloš Stojanović 
SetUpTestCase()3031458a9fSMiloš Stojanović   static void SetUpTestCase() {
3131458a9fSMiloš Stojanović     LLVMInitializeMipsTargetInfo();
3231458a9fSMiloš Stojanović     LLVMInitializeMipsTargetMC();
3331458a9fSMiloš Stojanović     LLVMInitializeMipsTarget();
3431458a9fSMiloš Stojanović     InitializeMipsExegesisTarget();
3531458a9fSMiloš Stojanović   }
3631458a9fSMiloš Stojanović 
3731458a9fSMiloš Stojanović   const LLVMState State;
3831458a9fSMiloš Stojanović };
3931458a9fSMiloš Stojanović 
4031458a9fSMiloš Stojanović } // namespace exegesis
4131458a9fSMiloš Stojanović } // namespace llvm
4231458a9fSMiloš Stojanović 
4331458a9fSMiloš Stojanović #endif
44