[llvm] r266348 - [GlobalISel] Move GISelAccessor class into public headers

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 14 10:45:38 PDT 2016


Author: tstellar
Date: Thu Apr 14 12:45:38 2016
New Revision: 266348

URL: http://llvm.org/viewvc/llvm-project?rev=266348&view=rev
Log:
[GlobalISel] Move GISelAccessor class into public headers

Reviewers: qcolombet

Subscribers: joker.eph, vkalintiris, llvm-commits

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

Added:
    llvm/trunk/include/llvm/CodeGen/GlobalISel/GISelAccessor.h
      - copied, changed from r266342, llvm/trunk/lib/Target/AArch64/AArch64GISelAccessor.h
Removed:
    llvm/trunk/lib/Target/AArch64/AArch64GISelAccessor.h
Modified:
    llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp
    llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h
    llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp

Copied: llvm/trunk/include/llvm/CodeGen/GlobalISel/GISelAccessor.h (from r266342, llvm/trunk/lib/Target/AArch64/AArch64GISelAccessor.h)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/GlobalISel/GISelAccessor.h?p2=llvm/trunk/include/llvm/CodeGen/GlobalISel/GISelAccessor.h&p1=llvm/trunk/lib/Target/AArch64/AArch64GISelAccessor.h&r1=266342&r2=266348&rev=266348&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64GISelAccessor.h (original)
+++ llvm/trunk/include/llvm/CodeGen/GlobalISel/GISelAccessor.h Thu Apr 14 12:45:38 2016
@@ -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;}
 };

Removed: llvm/trunk/lib/Target/AArch64/AArch64GISelAccessor.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64GISelAccessor.h?rev=266347&view=auto
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64GISelAccessor.h (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64GISelAccessor.h (removed)
@@ -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

Modified: llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp?rev=266348&r1=266347&r2=266348&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp Thu Apr 14 12:45:38 2016
@@ -57,16 +57,16 @@ AArch64Subtarget::AArch64Subtarget(const
       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

Modified: llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h?rev=266348&r1=266347&r2=266348&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h Thu Apr 14 12:45:38 2016
@@ -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 {

Modified: llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp?rev=266348&r1=266347&r2=266348&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp Thu Apr 14 12:45:38 2016
@@ -157,7 +157,7 @@ AArch64TargetMachine::~AArch64TargetMach
 
 #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(c
     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();
 }




More information about the llvm-commits mailing list