summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-06-10 23:26:47 +0000
committerEric Christopher <echristo@gmail.com>2014-06-10 23:26:47 +0000
commitcd996edec561e2c862aa3398ab9b39de0ef21b35 (patch)
tree42b20185abdc10bdf34326cf6ceff46d8c82c7cb
parent841da851985b88195c04ce0b09448721ecc964a4 (diff)
downloadbcm5719-llvm-cd996edec561e2c862aa3398ab9b39de0ef21b35.tar.gz
bcm5719-llvm-cd996edec561e2c862aa3398ab9b39de0ef21b35.zip
Use unique_ptr for X86Subtarget pointer members.
llvm-svn: 210606
-rw-r--r--llvm/lib/Target/X86/X86Subtarget.cpp19
-rw-r--r--llvm/lib/Target/X86/X86Subtarget.h19
2 files changed, 16 insertions, 22 deletions
diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp
index 29c44adaa29..f0c939c47d8 100644
--- a/llvm/lib/Target/X86/X86Subtarget.cpp
+++ b/llvm/lib/Target/X86/X86Subtarget.cpp
@@ -351,19 +351,12 @@ X86Subtarget::X86Subtarget(const std::string &TT, const std::string &CPU,
resetSubtargetFeatures(CPU, FS);
// Ordering here is important. X86InstrInfo initializes X86RegisterInfo which
// X86TargetLowering needs.
- InstrInfo = new X86InstrInfo(*this);
- TLInfo = new X86TargetLowering(TM);
- FrameLowering = new X86FrameLowering(TargetFrameLowering::StackGrowsDown,
- getStackAlignment(),
- is64Bit() ? -8 : -4);
- JITInfo = new X86JITInfo(hasSSE1());
-}
-
-X86Subtarget::~X86Subtarget() {
- delete TLInfo;
- delete InstrInfo;
- delete FrameLowering;
- delete JITInfo;
+ InstrInfo = make_unique<X86InstrInfo>(*this);
+ TLInfo = make_unique<X86TargetLowering>(TM);
+ FrameLowering =
+ make_unique<X86FrameLowering>(TargetFrameLowering::StackGrowsDown,
+ getStackAlignment(), is64Bit() ? -8 : -4);
+ JITInfo = make_unique<X86JITInfo>(hasSSE1());
}
bool
diff --git a/llvm/lib/Target/X86/X86Subtarget.h b/llvm/lib/Target/X86/X86Subtarget.h
index 9e4200c110a..85da720cbc2 100644
--- a/llvm/lib/Target/X86/X86Subtarget.h
+++ b/llvm/lib/Target/X86/X86Subtarget.h
@@ -229,10 +229,10 @@ private:
// Calculates type size & alignment
const DataLayout DL;
X86SelectionDAGInfo TSInfo;
- X86TargetLowering *TLInfo;
- X86InstrInfo *InstrInfo;
- X86FrameLowering *FrameLowering;
- X86JITInfo *JITInfo;
+ std::unique_ptr<X86TargetLowering> TLInfo;
+ std::unique_ptr<X86InstrInfo> InstrInfo;
+ std::unique_ptr<X86FrameLowering> FrameLowering;
+ std::unique_ptr<X86JITInfo> JITInfo;
public:
/// This constructor initializes the data members to match that
@@ -241,14 +241,15 @@ public:
X86Subtarget(const std::string &TT, const std::string &CPU,
const std::string &FS, X86TargetMachine &TM,
unsigned StackAlignOverride);
- ~X86Subtarget();
- const X86TargetLowering *getTargetLowering() const { return TLInfo; }
- const X86InstrInfo *getInstrInfo() const { return InstrInfo; }
+ const X86TargetLowering *getTargetLowering() const { return TLInfo.get(); }
+ const X86InstrInfo *getInstrInfo() const { return InstrInfo.get(); }
const DataLayout *getDataLayout() const { return &DL; }
- const X86FrameLowering *getFrameLowering() const { return FrameLowering; }
+ const X86FrameLowering *getFrameLowering() const {
+ return FrameLowering.get();
+ }
const X86SelectionDAGInfo *getSelectionDAGInfo() const { return &TSInfo; }
- X86JITInfo *getJITInfo() { return JITInfo; }
+ X86JITInfo *getJITInfo() { return JITInfo.get(); }
/// getStackAlignment - Returns the minimum alignment known to hold of the
/// stack frame on entry to the function and which must be maintained by every
OpenPOWER on IntegriCloud