1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

[GlobalISel] Move GISelAccessor class into public headers

Reviewers: qcolombet

Subscribers: joker.eph, vkalintiris, llvm-commits

Differential Revision: http://reviews.llvm.org/D19120

llvm-svn: 266348
This commit is contained in:
Tom Stellard 2016-04-14 17:45:38 +00:00
parent bbd04b8c49
commit 63209a899d
4 changed files with 20 additions and 20 deletions

View File

@ -1,4 +1,4 @@
//===-- AArch64GISelAccessor.h - AArch64 GISel Accessor ---------*- C++ -*-===//
//===-- GISelAccessor.h - GISel Accessor ------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -12,8 +12,8 @@
//
//===----------------------------------------------------------------------===/
#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64GISELACCESSOR_H
#define LLVM_LIB_TARGET_AARCH64_AARCH64GISELACCESSOR_H
#ifndef LLVM_CODEGEN_GLOBALISEL_GISELACCESSOR_H
#define LLVM_CODEGEN_GLOBALISEL_GISELACCESSOR_H
namespace llvm {
class CallLowering;
@ -24,8 +24,8 @@ class RegisterBankInfo;
/// It should be derived to feature an actual accessor to the GISel APIs.
/// The reason why this is not simply done into the subtarget is to avoid
/// spreading ifdefs around.
struct AArch64GISelAccessor {
virtual ~AArch64GISelAccessor() {}
struct GISelAccessor {
virtual ~GISelAccessor() {}
virtual const CallLowering *getCallLowering() const { return nullptr;}
virtual const RegisterBankInfo *getRegBankInfo() const { return nullptr;}
};

View File

@ -57,16 +57,16 @@ AArch64Subtarget::AArch64Subtarget(const Triple &TT, const std::string &CPU,
StrictAlign(false), ReserveX18(TT.isOSDarwin()), IsLittle(LittleEndian),
CPUString(CPU), TargetTriple(TT), FrameLowering(),
InstrInfo(initializeSubtargetDependencies(FS)), TSInfo(),
TLInfo(TM, *this), GISelAccessor() {}
TLInfo(TM, *this), GISel() {}
const CallLowering *AArch64Subtarget::getCallLowering() const {
assert(GISelAccessor && "Access to GlobalISel APIs not set");
return GISelAccessor->getCallLowering();
assert(GISel && "Access to GlobalISel APIs not set");
return GISel->getCallLowering();
}
const RegisterBankInfo *AArch64Subtarget::getRegBankInfo() const {
assert(GISelAccessor && "Access to GlobalISel APIs not set");
return GISelAccessor->getRegBankInfo();
assert(GISel && "Access to GlobalISel APIs not set");
return GISel->getRegBankInfo();
}
/// ClassifyGlobalReference - Find the target operand flags that describe

View File

@ -15,11 +15,11 @@
#define LLVM_LIB_TARGET_AARCH64_AARCH64SUBTARGET_H
#include "AArch64FrameLowering.h"
#include "AArch64GISelAccessor.h"
#include "AArch64ISelLowering.h"
#include "AArch64InstrInfo.h"
#include "AArch64RegisterInfo.h"
#include "AArch64SelectionDAGInfo.h"
#include "llvm/CodeGen/GlobalISel/GISelAccessor.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include <string>
@ -85,7 +85,7 @@ protected:
/// Gather the accessor points to GlobalISel-related APIs.
/// This is used to avoid ifndefs spreading around while GISel is
/// an optional library.
std::unique_ptr<AArch64GISelAccessor> GISelAccessor;
std::unique_ptr<GISelAccessor> GISel;
private:
/// initializeSubtargetDependencies - Initializes using CPUString and the
@ -101,8 +101,8 @@ public:
bool LittleEndian);
/// This object will take onwership of \p GISelAccessor.
void setGISelAccessor(AArch64GISelAccessor &GISelAccessor) {
this->GISelAccessor.reset(&GISelAccessor);
void setGISelAccessor(GISelAccessor &GISel) {
this->GISel.reset(&GISel);
}
const AArch64SelectionDAGInfo *getSelectionDAGInfo() const override {

View File

@ -157,7 +157,7 @@ AArch64TargetMachine::~AArch64TargetMachine() {}
#ifdef LLVM_BUILD_GLOBAL_ISEL
namespace {
struct AArch64GISelActualAccessor : public AArch64GISelAccessor {
struct AArch64GISelActualAccessor : public GISelAccessor {
std::unique_ptr<CallLowering> CallLoweringInfo;
std::unique_ptr<RegisterBankInfo> RegBankInfo;
const CallLowering *getCallLowering() const override {
@ -191,16 +191,16 @@ AArch64TargetMachine::getSubtargetImpl(const Function &F) const {
I = llvm::make_unique<AArch64Subtarget>(TargetTriple, CPU, FS, *this,
isLittle);
#ifndef LLVM_BUILD_GLOBAL_ISEL
AArch64GISelAccessor *GISelAccessor = new AArch64GISelAccessor();
GISelAccessor *GISel = new GISelAccessor();
#else
AArch64GISelActualAccessor *GISelAccessor =
AArch64GISelActualAccessor *GISel =
new AArch64GISelActualAccessor();
GISelAccessor->CallLoweringInfo.reset(
GISel->CallLoweringInfo.reset(
new AArch64CallLowering(*I->getTargetLowering()));
GISelAccessor->RegBankInfo.reset(
GISel->RegBankInfo.reset(
new AArch64RegisterBankInfo(*I->getRegisterInfo()));
#endif
I->setGISelAccessor(*GISelAccessor);
I->setGISelAccessor(*GISel);
}
return I.get();
}