48 lines · c
1//===-- TestBase.h ----------------------------------------------*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8// Test fixture common to all X86 tests.9//===----------------------------------------------------------------------===//10 11#ifndef LLVM_UNITTESTS_TOOLS_LLVMEXEGESIS_X86_TESTBASE_H12#define LLVM_UNITTESTS_TOOLS_LLVMEXEGESIS_X86_TESTBASE_H13 14#include "LlvmState.h"15#include "llvm/MC/TargetRegistry.h"16#include "llvm/Support/TargetSelect.h"17#include "gmock/gmock.h"18#include "gtest/gtest.h"19 20namespace llvm {21namespace exegesis {22 23void InitializeX86ExegesisTarget();24 25constexpr char kTriple[] = "x86_64-unknown-linux";26 27class X86TestBase : public ::testing::Test {28protected:29 X86TestBase(std::string CPUName = "haswell", const char *Features = "")30 : State(cantFail(LLVMState::Create(kTriple, CPUName, Features))) {}31 32 static void SetUpTestCase() {33 LLVMInitializeX86TargetInfo();34 LLVMInitializeX86TargetMC();35 LLVMInitializeX86Target();36 LLVMInitializeX86AsmPrinter();37 LLVMInitializeX86AsmParser();38 InitializeX86ExegesisTarget();39 }40 41 const LLVMState State;42};43 44} // namespace exegesis45} // namespace llvm46 47#endif48