diff options
author | Ahmed Charles <ahmedcharles@gmail.com> | 2014-03-06 05:51:42 +0000 |
---|---|---|
committer | Ahmed Charles <ahmedcharles@gmail.com> | 2014-03-06 05:51:42 +0000 |
commit | 56440fd8203f581b9aded68db3631ea11a72ccf2 (patch) | |
tree | 7f80c03b91a2d762573379b2624e3f1de93e6ab6 /llvm/lib/CodeGen | |
parent | 47c254beb732a4434f814c4415cbc60503dd331a (diff) | |
download | bcm5719-llvm-56440fd8203f581b9aded68db3631ea11a72ccf2.tar.gz bcm5719-llvm-56440fd8203f581b9aded68db3631ea11a72ccf2.zip |
Replace OwningPtr<T> with std::unique_ptr<T>.
This compiles with no changes to clang/lld/lldb with MSVC and includes
overloads to various functions which are used by those projects and llvm
which have OwningPtr's as parameters. This should allow out of tree
projects some time to move. There are also no changes to libs/Target,
which should help out of tree targets have time to move, if necessary.
llvm-svn: 203083
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h | 3 | ||||
-rw-r--r-- | llvm/lib/CodeGen/LLVMTargetMachine.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/CodeGen/LiveRegMatrix.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/MachineScheduler.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/CodeGen/RegAllocBase.h | 1 | ||||
-rw-r--r-- | llvm/lib/CodeGen/RegAllocBasic.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/RegAllocGreedy.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/CodeGen/RegAllocPBQP.cpp | 24 | ||||
-rw-r--r-- | llvm/lib/CodeGen/RegisterCoalescer.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/CodeGen/TailDuplication.cpp | 3 |
11 files changed, 27 insertions, 37 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index 27f009915e6..567b6e3b18e 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -13,7 +13,6 @@ #define DEBUG_TYPE "asm-printer" #include "llvm/CodeGen/AsmPrinter.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/Twine.h" #include "llvm/CodeGen/MachineBasicBlock.h" @@ -118,16 +117,15 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, const MDNode *LocMDNode, // Tell SrcMgr about this buffer, it takes ownership of the buffer. SrcMgr.AddNewSourceBuffer(Buffer, SMLoc()); - OwningPtr<MCAsmParser> Parser(createMCAsmParser(SrcMgr, - OutContext, OutStreamer, - *MAI)); + std::unique_ptr<MCAsmParser> Parser( + createMCAsmParser(SrcMgr, OutContext, OutStreamer, *MAI)); // Initialize the parser with a fresh subtarget info. It is better to use a // new STI here because the parser may modify it and we do not want those // modifications to persist after parsing the inlineasm. The modifications // made by the parser will be seen by the code emitters because it passes // the current STI down to the EncodeInstruction() method. - OwningPtr<MCSubtargetInfo> STI(TM.getTarget().createMCSubtargetInfo( + std::unique_ptr<MCSubtargetInfo> STI(TM.getTarget().createMCSubtargetInfo( TM.getTargetTriple(), TM.getTargetCPU(), TM.getTargetFeatureString())); // Preserve a copy of the original STI because the parser may modify it. For @@ -136,8 +134,8 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, const MDNode *LocMDNode, // emitInlineAsmEnd(). MCSubtargetInfo STIOrig = *STI; - OwningPtr<MCTargetAsmParser> - TAP(TM.getTarget().createMCAsmParser(*STI, *Parser, *MII)); + std::unique_ptr<MCTargetAsmParser> TAP( + TM.getTarget().createMCAsmParser(*STI, *Parser, *MII)); if (!TAP) report_fatal_error("Inline asm not supported by this streamer because" " we don't have an asm parser for this target\n"); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h index 3a3f1660c93..937a607fa88 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h @@ -18,7 +18,6 @@ #include "DwarfDebug.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/Optional.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/StringMap.h" #include "llvm/IR/DIBuilder.h" #include "llvm/IR/DebugInfo.h" @@ -71,7 +70,7 @@ protected: DICompileUnit CUNode; /// Unit debug information entry. - const OwningPtr<DIE> UnitDie; + const std::unique_ptr<DIE> UnitDie; /// Offset of the UnitDie from beginning of debug info section. unsigned DebugInfoOffset; diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp index e77acce74f4..77f8377d9be 100644 --- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp +++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "llvm/Target/TargetMachine.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/MachineFunctionAnalysis.h" #include "llvm/CodeGen/MachineModuleInfo.h" @@ -174,7 +173,7 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM, const MCRegisterInfo &MRI = *getRegisterInfo(); const MCInstrInfo &MII = *getInstrInfo(); const MCSubtargetInfo &STI = getSubtarget<MCSubtargetInfo>(); - OwningPtr<MCStreamer> AsmStreamer; + std::unique_ptr<MCStreamer> AsmStreamer; switch (FileType) { case CGFT_AssemblyFile: { @@ -281,7 +280,7 @@ bool LLVMTargetMachine::addPassesToEmitMC(PassManagerBase &PM, if (MCE == 0 || MAB == 0) return true; - OwningPtr<MCStreamer> AsmStreamer; + std::unique_ptr<MCStreamer> AsmStreamer; AsmStreamer.reset(getTarget().createMCObjectStreamer( getTargetTriple(), *Ctx, *MAB, Out, MCE, STI, hasMCRelaxAll(), hasMCNoExecStack())); diff --git a/llvm/lib/CodeGen/LiveRegMatrix.cpp b/llvm/lib/CodeGen/LiveRegMatrix.cpp index 7c943786635..7f797beec8e 100644 --- a/llvm/lib/CodeGen/LiveRegMatrix.cpp +++ b/llvm/lib/CodeGen/LiveRegMatrix.cpp @@ -67,7 +67,7 @@ void LiveRegMatrix::releaseMemory() { Matrix[i].clear(); // No need to clear Queries here, since LiveIntervalUnion::Query doesn't // have anything important to clear and LiveRegMatrix's runOnFunction() - // does a OwningPtr::reset anyways. + // does a std::unique_ptr::reset anyways. } } diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp index e8b8713d1e4..06b64e2b72a 100644 --- a/llvm/lib/CodeGen/MachineScheduler.cpp +++ b/llvm/lib/CodeGen/MachineScheduler.cpp @@ -15,7 +15,6 @@ #define DEBUG_TYPE "misched" #include "llvm/CodeGen/MachineScheduler.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/PriorityQueue.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/CodeGen/LiveIntervalAnalysis.h" @@ -321,7 +320,7 @@ bool MachineScheduler::runOnMachineFunction(MachineFunction &mf) { // Instantiate the selected scheduler for this target, function, and // optimization level. - OwningPtr<ScheduleDAGInstrs> Scheduler(createMachineScheduler()); + std::unique_ptr<ScheduleDAGInstrs> Scheduler(createMachineScheduler()); scheduleRegions(*Scheduler); DEBUG(LIS->dump()); @@ -342,7 +341,7 @@ bool PostMachineScheduler::runOnMachineFunction(MachineFunction &mf) { // Instantiate the selected scheduler for this target, function, and // optimization level. - OwningPtr<ScheduleDAGInstrs> Scheduler(createPostMachineScheduler()); + std::unique_ptr<ScheduleDAGInstrs> Scheduler(createPostMachineScheduler()); scheduleRegions(*Scheduler); if (VerifyScheduling) diff --git a/llvm/lib/CodeGen/RegAllocBase.h b/llvm/lib/CodeGen/RegAllocBase.h index c17a8d96ef6..68bd4b5b631 100644 --- a/llvm/lib/CodeGen/RegAllocBase.h +++ b/llvm/lib/CodeGen/RegAllocBase.h @@ -37,7 +37,6 @@ #ifndef LLVM_CODEGEN_REGALLOCBASE #define LLVM_CODEGEN_REGALLOCBASE -#include "llvm/ADT/OwningPtr.h" #include "llvm/CodeGen/LiveInterval.h" #include "llvm/CodeGen/RegisterClassInfo.h" diff --git a/llvm/lib/CodeGen/RegAllocBasic.cpp b/llvm/lib/CodeGen/RegAllocBasic.cpp index 6768e45c6cd..fbb9b69cffd 100644 --- a/llvm/lib/CodeGen/RegAllocBasic.cpp +++ b/llvm/lib/CodeGen/RegAllocBasic.cpp @@ -64,7 +64,7 @@ class RABasic : public MachineFunctionPass, public RegAllocBase MachineFunction *MF; // state - OwningPtr<Spiller> SpillerInstance; + std::unique_ptr<Spiller> SpillerInstance; std::priority_queue<LiveInterval*, std::vector<LiveInterval*>, CompSpillWeight> Queue; diff --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp index b9cc2fec8dc..1621faad977 100644 --- a/llvm/lib/CodeGen/RegAllocGreedy.cpp +++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp @@ -101,7 +101,7 @@ class RAGreedy : public MachineFunctionPass, LiveDebugVariables *DebugVars; // state - OwningPtr<Spiller> SpillerInstance; + std::unique_ptr<Spiller> SpillerInstance; PQueue Queue; unsigned NextCascade; @@ -196,8 +196,8 @@ class RAGreedy : public MachineFunctionPass, }; // splitting state. - OwningPtr<SplitAnalysis> SA; - OwningPtr<SplitEditor> SE; + std::unique_ptr<SplitAnalysis> SA; + std::unique_ptr<SplitEditor> SE; /// Cached per-block interference maps InterferenceCache IntfCache; diff --git a/llvm/lib/CodeGen/RegAllocPBQP.cpp b/llvm/lib/CodeGen/RegAllocPBQP.cpp index c9588db738c..0273ad09d21 100644 --- a/llvm/lib/CodeGen/RegAllocPBQP.cpp +++ b/llvm/lib/CodeGen/RegAllocPBQP.cpp @@ -34,7 +34,6 @@ #include "llvm/CodeGen/RegAllocPBQP.h" #include "RegisterCoalescer.h" #include "Spiller.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/CodeGen/CalcSpillWeights.h" #include "llvm/CodeGen/LiveIntervalAnalysis.h" @@ -88,7 +87,7 @@ public: static char ID; /// Construct a PBQP register allocator. - RegAllocPBQP(OwningPtr<PBQPBuilder> &b, char *cPassID=0) + RegAllocPBQP(std::unique_ptr<PBQPBuilder> &b, char *cPassID=0) : MachineFunctionPass(ID), builder(b.release()), customPassID(cPassID) { initializeSlotIndexesPass(*PassRegistry::getPassRegistry()); initializeLiveIntervalsPass(*PassRegistry::getPassRegistry()); @@ -117,8 +116,7 @@ private: typedef std::map<RegPair, PBQP::PBQPNum> CoalesceMap; typedef std::set<unsigned> RegSet; - - OwningPtr<PBQPBuilder> builder; + std::unique_ptr<PBQPBuilder> builder; char *customPassID; @@ -129,7 +127,7 @@ private: MachineRegisterInfo *mri; const MachineBlockFrequencyInfo *mbfi; - OwningPtr<Spiller> spiller; + std::unique_ptr<Spiller> spiller; LiveIntervals *lis; LiveStacks *lss; VirtRegMap *vrm; @@ -191,7 +189,7 @@ PBQPRAProblem *PBQPBuilder::build(MachineFunction *mf, const LiveIntervals *lis, MachineRegisterInfo *mri = &mf->getRegInfo(); const TargetRegisterInfo *tri = mf->getTarget().getRegisterInfo(); - OwningPtr<PBQPRAProblem> p(new PBQPRAProblem()); + std::unique_ptr<PBQPRAProblem> p(new PBQPRAProblem()); PBQPRAGraph &g = p->getGraph(); RegSet pregs; @@ -314,7 +312,7 @@ PBQPRAProblem *PBQPBuilderWithCoalescing::build(MachineFunction *mf, const MachineBlockFrequencyInfo *mbfi, const RegSet &vregs) { - OwningPtr<PBQPRAProblem> p(PBQPBuilder::build(mf, lis, mbfi, vregs)); + std::unique_ptr<PBQPRAProblem> p(PBQPBuilder::build(mf, lis, mbfi, vregs)); PBQPRAGraph &g = p->getGraph(); const TargetMachine &tm = mf->getTarget(); @@ -587,8 +585,8 @@ bool RegAllocPBQP::runOnMachineFunction(MachineFunction &MF) { while (!pbqpAllocComplete) { DEBUG(dbgs() << " PBQP Regalloc round " << round << ":\n"); - OwningPtr<PBQPRAProblem> problem( - builder->build(mf, lis, mbfi, vregsToAlloc)); + std::unique_ptr<PBQPRAProblem> problem( + builder->build(mf, lis, mbfi, vregsToAlloc)); #ifndef NDEBUG if (pbqpDumpGraphs) { @@ -622,14 +620,14 @@ bool RegAllocPBQP::runOnMachineFunction(MachineFunction &MF) { return true; } -FunctionPass* llvm::createPBQPRegisterAllocator( - OwningPtr<PBQPBuilder> &builder, - char *customPassID) { +FunctionPass * +llvm::createPBQPRegisterAllocator(std::unique_ptr<PBQPBuilder> &builder, + char *customPassID) { return new RegAllocPBQP(builder, customPassID); } FunctionPass* llvm::createDefaultPBQPRegisterAllocator() { - OwningPtr<PBQPBuilder> Builder; + std::unique_ptr<PBQPBuilder> Builder; if (pbqpCoalescing) Builder.reset(new PBQPBuilderWithCoalescing()); else diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp index cbec9422735..43a841ad696 100644 --- a/llvm/lib/CodeGen/RegisterCoalescer.cpp +++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp @@ -15,7 +15,6 @@ #define DEBUG_TYPE "regalloc" #include "RegisterCoalescer.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/Statistic.h" diff --git a/llvm/lib/CodeGen/TailDuplication.cpp b/llvm/lib/CodeGen/TailDuplication.cpp index c493171a8cc..df0e52926cc 100644 --- a/llvm/lib/CodeGen/TailDuplication.cpp +++ b/llvm/lib/CodeGen/TailDuplication.cpp @@ -15,7 +15,6 @@ #define DEBUG_TYPE "tailduplication" #include "llvm/CodeGen/Passes.h" #include "llvm/ADT/DenseSet.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/Statistic.h" @@ -65,7 +64,7 @@ namespace { const MachineBranchProbabilityInfo *MBPI; MachineModuleInfo *MMI; MachineRegisterInfo *MRI; - OwningPtr<RegScavenger> RS; + std::unique_ptr<RegScavenger> RS; bool PreRegAlloc; // SSAUpdateVRs - A list of virtual registers for which to update SSA form. |