[llvm] r210839 - Move PPCInstrInfo off of the target machine and onto the subtarget.

Eric Christopher echristo at gmail.com
Thu Jun 12 15:05:47 PDT 2014


Author: echristo
Date: Thu Jun 12 17:05:46 2014
New Revision: 210839

URL: http://llvm.org/viewvc/llvm-project?rev=210839&view=rev
Log:
Move PPCInstrInfo off of the target machine and onto the subtarget.

Modified:
    llvm/trunk/lib/Target/PowerPC/PPCSubtarget.cpp
    llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h
    llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp
    llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h

Modified: llvm/trunk/lib/Target/PowerPC/PPCSubtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCSubtarget.cpp?rev=210839&r1=210838&r2=210839&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCSubtarget.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCSubtarget.cpp Thu Jun 12 17:05:46 2014
@@ -80,7 +80,7 @@ PPCSubtarget::PPCSubtarget(const std::st
     : PPCGenSubtargetInfo(TT, CPU, FS), IsPPC64(is64Bit), TargetTriple(TT),
       OptLevel(OptLevel),
       FrameLowering(initializeSubtargetDependencies(CPU, FS)),
-      DL(getDataLayoutString(*this)) {}
+      DL(getDataLayoutString(*this)), InstrInfo(*this) {}
 
 /// SetJITMode - This is called to inform the subtarget info that we are
 /// producing code for the JIT.

Modified: llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h?rev=210839&r1=210838&r2=210839&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h Thu Jun 12 17:05:46 2014
@@ -15,6 +15,7 @@
 #define POWERPCSUBTARGET_H
 
 #include "PPCFrameLowering.h"
+#include "PPCInstrInfo.h"
 #include "llvm/ADT/Triple.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/MC/MCInstrItineraries.h"
@@ -106,6 +107,7 @@ protected:
 
   PPCFrameLowering    FrameLowering;
   const DataLayout DL;
+  PPCInstrInfo InstrInfo;
 
 public:
   /// This constructor initializes the data members to match that
@@ -138,6 +140,7 @@ public:
 
   const PPCFrameLowering *getFrameLowering() const { return &FrameLowering; }
   const DataLayout *getDataLayout() const { return &DL; }
+  const PPCInstrInfo *getInstrInfo() const { return &InstrInfo; }
 
   /// initializeSubtargetDependencies - Initializes using a CPU and feature string
   /// so that we can use initializer lists for subtarget initialization.

Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp?rev=210839&r1=210838&r2=210839&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp Thu Jun 12 17:05:46 2014
@@ -42,8 +42,8 @@ PPCTargetMachine::PPCTargetMachine(const
                                    Reloc::Model RM, CodeModel::Model CM,
                                    CodeGenOpt::Level OL, bool is64Bit)
     : LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
-      Subtarget(TT, CPU, FS, is64Bit, OL), InstrInfo(Subtarget),
-      JITInfo(*this, is64Bit), TLInfo(*this), TSInfo(*this) {
+      Subtarget(TT, CPU, FS, is64Bit, OL), JITInfo(*this, is64Bit),
+      TLInfo(*this), TSInfo(*this) {
   initAsmInfo();
 }
 

Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h?rev=210839&r1=210838&r2=210839&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h Thu Jun 12 17:05:46 2014
@@ -29,7 +29,6 @@ namespace llvm {
 ///
 class PPCTargetMachine : public LLVMTargetMachine {
   PPCSubtarget        Subtarget;
-  PPCInstrInfo        InstrInfo;
   PPCJITInfo          JITInfo;
   PPCTargetLowering   TLInfo;
   PPCSelectionDAGInfo TSInfo;
@@ -40,7 +39,9 @@ public:
                    Reloc::Model RM, CodeModel::Model CM,
                    CodeGenOpt::Level OL, bool is64Bit);
 
-  const PPCInstrInfo      *getInstrInfo() const override { return &InstrInfo; }
+  const PPCInstrInfo *getInstrInfo() const override {
+    return getSubtargetImpl()->getInstrInfo();
+  }
   const PPCFrameLowering *getFrameLowering() const override {
     return getSubtargetImpl()->getFrameLowering();
   }
@@ -51,8 +52,8 @@ public:
   const PPCSelectionDAGInfo* getSelectionDAGInfo() const override {
     return &TSInfo;
   }
-  const PPCRegisterInfo   *getRegisterInfo() const override {
-    return &InstrInfo.getRegisterInfo();
+  const PPCRegisterInfo *getRegisterInfo() const override {
+    return &getInstrInfo()->getRegisterInfo();
   }
 
   const DataLayout *getDataLayout() const override {





More information about the llvm-commits mailing list