Index: llvm/trunk/include/llvm/CodeGen/GlobalISel/GISelAccessor.h =================================================================== --- llvm/trunk/include/llvm/CodeGen/GlobalISel/GISelAccessor.h +++ llvm/trunk/include/llvm/CodeGen/GlobalISel/GISelAccessor.h @@ -0,0 +1,33 @@ +//===-- GISelAccessor.h - GISel Accessor ------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +/// This file declares the API to access the various APIs related +/// to GlobalISel. +// +//===----------------------------------------------------------------------===/ + +#ifndef LLVM_CODEGEN_GLOBALISEL_GISELACCESSOR_H +#define LLVM_CODEGEN_GLOBALISEL_GISELACCESSOR_H + +namespace llvm { +class CallLowering; +class RegisterBankInfo; + +/// The goal of this helper class is to gather the accessor to all +/// the APIs related to GlobalISel. +/// 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 GISelAccessor { + virtual ~GISelAccessor() {} + virtual const CallLowering *getCallLowering() const { return nullptr;} + virtual const RegisterBankInfo *getRegBankInfo() const { return nullptr;} +}; +} // End namespace llvm; +#endif Index: llvm/trunk/lib/Target/AArch64/AArch64GISelAccessor.h =================================================================== --- llvm/trunk/lib/Target/AArch64/AArch64GISelAccessor.h +++ llvm/trunk/lib/Target/AArch64/AArch64GISelAccessor.h @@ -1,33 +0,0 @@ -//===-- AArch64GISelAccessor.h - AArch64 GISel Accessor ---------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -/// This file declares the API to access the various APIs related -/// to GlobalISel. -// -//===----------------------------------------------------------------------===/ - -#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64GISELACCESSOR_H -#define LLVM_LIB_TARGET_AARCH64_AARCH64GISELACCESSOR_H - -namespace llvm { -class CallLowering; -class RegisterBankInfo; - -/// The goal of this helper class is to gather the accessor to all -/// the APIs related to GlobalISel. -/// 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() {} - virtual const CallLowering *getCallLowering() const { return nullptr;} - virtual const RegisterBankInfo *getRegBankInfo() const { return nullptr;} -}; -} // End namespace llvm; -#endif Index: llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h =================================================================== --- llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h +++ llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h @@ -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 @@ -85,7 +85,7 @@ /// 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 GISelAccessor; + std::unique_ptr GISel; private: /// initializeSubtargetDependencies - Initializes using CPUString and the @@ -101,8 +101,8 @@ 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 { Index: llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp =================================================================== --- llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp +++ llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp @@ -57,16 +57,16 @@ 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 Index: llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp =================================================================== --- llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp +++ llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp @@ -157,7 +157,7 @@ #ifdef LLVM_BUILD_GLOBAL_ISEL namespace { -struct AArch64GISelActualAccessor : public AArch64GISelAccessor { +struct AArch64GISelActualAccessor : public GISelAccessor { std::unique_ptr CallLoweringInfo; std::unique_ptr RegBankInfo; const CallLowering *getCallLowering() const override { @@ -191,16 +191,16 @@ I = llvm::make_unique(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(); }