[llvm] r210616 - Move to a private function to initialize the subtarget dependencies

Eric Christopher echristo at gmail.com
Tue Jun 10 17:46:34 PDT 2014


Author: echristo
Date: Tue Jun 10 19:46:34 2014
New Revision: 210616

URL: http://llvm.org/viewvc/llvm-project?rev=210616&view=rev
Log:
Move to a private function to initialize the subtarget dependencies
so that we can use initializer lists for the AArch64 Subtarget.

Modified:
    llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp
    llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h

Modified: llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp?rev=210616&r1=210615&r2=210616&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp Tue Jun 10 19:46:34 2014
@@ -30,6 +30,17 @@ static cl::opt<bool>
 EnableEarlyIfConvert("aarch64-early-ifcvt", cl::desc("Enable the early if "
                      "converter pass"), cl::init(true), cl::Hidden);
 
+AArch64Subtarget &
+AArch64Subtarget::initializeSubtargetDependencies(StringRef FS) {
+  // Determine default and user-specified characteristics
+
+  if (CPUString.empty())
+    CPUString = "generic";
+
+  ParseSubtargetFeatures(CPUString, FS);
+  return *this;
+}
+
 AArch64Subtarget::AArch64Subtarget(const std::string &TT,
                                    const std::string &CPU,
                                    const std::string &FS, TargetMachine &TM,
@@ -45,15 +56,8 @@ AArch64Subtarget::AArch64Subtarget(const
              ? "e-m:o-i64:64-i128:128-n32:64-S128"
              : (LittleEndian ? "e-m:e-i64:64-i128:128-n32:64-S128"
                              : "E-m:e-i64:64-i128:128-n32:64-S128")),
-      FrameLowering(), InstrInfo(*this), TSInfo(&DL) {
-  // Determine default and user-specified characteristics
-
-  if (CPUString.empty())
-    CPUString = "generic";
-
-  ParseSubtargetFeatures(CPUString, FS);
-  TLInfo = make_unique<AArch64TargetLowering>(TM);
-}
+      FrameLowering(), InstrInfo(initializeSubtargetDependencies(FS)),
+      TSInfo(&DL), TLInfo(TM) {}
 
 /// ClassifyGlobalReference - Find the target operand flags that describe
 /// how a global value should be referenced for the current subtarget.

Modified: llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h?rev=210616&r1=210615&r2=210616&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h Tue Jun 10 19:46:34 2014
@@ -58,7 +58,12 @@ protected:
   AArch64FrameLowering FrameLowering;
   AArch64InstrInfo InstrInfo;
   AArch64SelectionDAGInfo TSInfo;
-  std::unique_ptr<AArch64TargetLowering> TLInfo;
+  AArch64TargetLowering TLInfo;
+private:
+  /// initializeSubtargetDependencies - Initializes using CPUString and the
+  /// passed in feature string so that we can use initializer lists for
+  /// subtarget initialization.
+  AArch64Subtarget &initializeSubtargetDependencies(StringRef FS);
 
 public:
   /// This constructor initializes the data members to match that
@@ -71,7 +76,7 @@ public:
     return &FrameLowering;
   }
   const AArch64TargetLowering *getTargetLowering() const {
-    return TLInfo.get();
+    return &TLInfo;
   }
   const AArch64InstrInfo *getInstrInfo() const { return &InstrInfo; }
   const DataLayout *getDataLayout() const { return &DL; }





More information about the llvm-commits mailing list