Move to a private function to initialize the subtarget dependencies

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
This commit is contained in:
Eric Christopher 2014-06-11 00:46:34 +00:00
parent 0166af890c
commit e290e4abc3
2 changed files with 20 additions and 11 deletions

View 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.

View 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; }