Move to a private function to initialize the subtarget dependencies
authorEric Christopher <echristo@gmail.com>
Wed, 11 Jun 2014 00:46:34 +0000 (00:46 +0000)
committerEric Christopher <echristo@gmail.com>
Wed, 11 Jun 2014 00:46:34 +0000 (00:46 +0000)
so that we can use initializer lists for the AArch64 Subtarget.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210616 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AArch64/AArch64Subtarget.cpp
lib/Target/AArch64/AArch64Subtarget.h

index a1e8b87ed9c57c738c89624a0963432a3a2b37fc..bb0b72c585b8a81f5ca42fbb6862ef75d75937ca 100644 (file)
@@ -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 std::string &TT,
              ? "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.
index 3eef2488067bddbb96897247be7096e0d45fb967..52124f650c7a297d50fd627ea6cf8cbbd66992a4 100644 (file)
@@ -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; }