projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clarify the doxygen comment for AsmPrinter::EmitDwarfRegOpPiece and add
[oota-llvm.git]
/
lib
/
CodeGen
/
PHIElimination.cpp
diff --git
a/lib/CodeGen/PHIElimination.cpp
b/lib/CodeGen/PHIElimination.cpp
index dcd907229528c8be6b3e077147e4dbe1fde851c7..37a7c71f0fcba4fbf225bc7103b9cb504555f901 100644
(file)
--- a/
lib/CodeGen/PHIElimination.cpp
+++ b/
lib/CodeGen/PHIElimination.cpp
@@
-13,7
+13,6
@@
//
//===----------------------------------------------------------------------===//
//
//===----------------------------------------------------------------------===//
-#define DEBUG_TYPE "phielim"
#include "llvm/CodeGen/Passes.h"
#include "PHIEliminationUtils.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/CodeGen/Passes.h"
#include "PHIEliminationUtils.h"
#include "llvm/ADT/STLExtras.h"
@@
-35,6
+34,8
@@
#include <algorithm>
using namespace llvm;
#include <algorithm>
using namespace llvm;
+#define DEBUG_TYPE "phielim"
+
static cl::opt<bool>
DisableEdgeSplitting("disable-phi-elim-edge-splitting", cl::init(false),
cl::Hidden, cl::desc("Disable critical edge splitting "
static cl::opt<bool>
DisableEdgeSplitting("disable-phi-elim-edge-splitting", cl::init(false),
cl::Hidden, cl::desc("Disable critical edge splitting "
@@
-57,8
+58,8
@@
namespace {
initializePHIEliminationPass(*PassRegistry::getPassRegistry());
}
initializePHIEliminationPass(*PassRegistry::getPassRegistry());
}
-
virtual bool runOnMachineFunction(MachineFunction &Fn)
;
- v
irtual void getAnalysisUsage(AnalysisUsage &AU) const
;
+
bool runOnMachineFunction(MachineFunction &Fn) override
;
+ v
oid getAnalysisUsage(AnalysisUsage &AU) const override
;
private:
/// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions
private:
/// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions
@@
-186,7
+187,7
@@
bool PHIElimination::EliminatePHINodes(MachineFunction &MF,
// Get an iterator to the first instruction after the last PHI node (this may
// also be the end of the basic block).
MachineBasicBlock::iterator LastPHIIt =
// Get an iterator to the first instruction after the last PHI node (this may
// also be the end of the basic block).
MachineBasicBlock::iterator LastPHIIt =
-
prior
(MBB.SkipPHIsAndLabels(MBB.begin()));
+
std::prev
(MBB.SkipPHIsAndLabels(MBB.begin()));
while (MBB.front().isPHI())
LowerPHINode(MBB, LastPHIIt);
while (MBB.front().isPHI())
LowerPHINode(MBB, LastPHIIt);
@@
-198,9
+199,8
@@
bool PHIElimination::EliminatePHINodes(MachineFunction &MF,
/// This includes registers with no defs.
static bool isImplicitlyDefined(unsigned VirtReg,
const MachineRegisterInfo *MRI) {
/// This includes registers with no defs.
static bool isImplicitlyDefined(unsigned VirtReg,
const MachineRegisterInfo *MRI) {
- for (MachineRegisterInfo::def_iterator DI = MRI->def_begin(VirtReg),
- DE = MRI->def_end(); DI != DE; ++DI)
- if (!DI->isImplicitDef())
+ for (MachineInstr &DI : MRI->def_instructions(VirtReg))
+ if (!DI.isImplicitDef())
return false;
return true;
}
return false;
return true;
}
@@
-222,7
+222,7
@@
void PHIElimination::LowerPHINode(MachineBasicBlock &MBB,
MachineBasicBlock::iterator LastPHIIt) {
++NumLowered;
MachineBasicBlock::iterator LastPHIIt) {
++NumLowered;
- MachineBasicBlock::iterator AfterPHIsIt =
llvm
::next(LastPHIIt);
+ MachineBasicBlock::iterator AfterPHIsIt =
std
::next(LastPHIIt);
// Unlink the PHI node from the basic block, but don't delete the PHI yet.
MachineInstr *MPhi = MBB.remove(MBB.begin());
// Unlink the PHI node from the basic block, but don't delete the PHI yet.
MachineInstr *MPhi = MBB.remove(MBB.begin());
@@
-267,7
+267,7
@@
void PHIElimination::LowerPHINode(MachineBasicBlock &MBB,
// Update live variable information if there is any.
if (LV) {
// Update live variable information if there is any.
if (LV) {
- MachineInstr *PHICopy =
prior
(AfterPHIsIt);
+ MachineInstr *PHICopy =
std::prev
(AfterPHIsIt);
if (IncomingReg) {
LiveVariables::VarInfo &VI = LV->getVarInfo(IncomingReg);
if (IncomingReg) {
LiveVariables::VarInfo &VI = LV->getVarInfo(IncomingReg);
@@
-306,7
+306,7
@@
void PHIElimination::LowerPHINode(MachineBasicBlock &MBB,
// Update LiveIntervals for the new copy or implicit def.
if (LIS) {
// Update LiveIntervals for the new copy or implicit def.
if (LIS) {
- MachineInstr *NewInstr =
prior
(AfterPHIsIt);
+ MachineInstr *NewInstr =
std::prev
(AfterPHIsIt);
SlotIndex DestCopyIndex = LIS->InsertMachineInstrInMaps(NewInstr);
SlotIndex MBBStartIndex = LIS->getMBBStartIdx(&MBB);
SlotIndex DestCopyIndex = LIS->InsertMachineInstrInMaps(NewInstr);
SlotIndex MBBStartIndex = LIS->getMBBStartIdx(&MBB);
@@
-378,7
+378,7
@@
void PHIElimination::LowerPHINode(MachineBasicBlock &MBB,
findPHICopyInsertPoint(&opBlock, &MBB, SrcReg);
// Insert the copy.
findPHICopyInsertPoint(&opBlock, &MBB, SrcReg);
// Insert the copy.
- MachineInstr *NewSrcInstr =
0
;
+ MachineInstr *NewSrcInstr =
nullptr
;
if (!reusedIncoming && IncomingReg) {
if (SrcUndef) {
// The source register is undefined, so there is no need for a real
if (!reusedIncoming && IncomingReg) {
if (SrcUndef) {
// The source register is undefined, so there is no need for a real
@@
-444,7
+444,7
@@
void PHIElimination::LowerPHINode(MachineBasicBlock &MBB,
}
} else {
// We just inserted this copy.
}
} else {
// We just inserted this copy.
- KillInst =
prior
(InsertPos);
+ KillInst =
std::prev
(InsertPos);
}
}
assert(KillInst->readsRegister(SrcReg) && "Cannot find kill instruction");
}
}
assert(KillInst->readsRegister(SrcReg) && "Cannot find kill instruction");
@@
-504,7
+504,7
@@
void PHIElimination::LowerPHINode(MachineBasicBlock &MBB,
}
} else {
// We just inserted this copy.
}
} else {
// We just inserted this copy.
- KillInst =
prior
(InsertPos);
+ KillInst =
std::prev
(InsertPos);
}
}
assert(KillInst->readsRegister(SrcReg) &&
}
}
assert(KillInst->readsRegister(SrcReg) &&
@@
-547,7
+547,7
@@
bool PHIElimination::SplitPHIEdges(MachineFunction &MF,
if (MBB.empty() || !MBB.front().isPHI() || MBB.isLandingPad())
return false; // Quick exit for basic blocks without PHIs.
if (MBB.empty() || !MBB.front().isPHI() || MBB.isLandingPad())
return false; // Quick exit for basic blocks without PHIs.
- const MachineLoop *CurLoop = MLI ? MLI->getLoopFor(&MBB) :
0
;
+ const MachineLoop *CurLoop = MLI ? MLI->getLoopFor(&MBB) :
nullptr
;
bool IsLoopHeader = CurLoop && &MBB == CurLoop->getHeader();
bool Changed = false;
bool IsLoopHeader = CurLoop && &MBB == CurLoop->getHeader();
bool Changed = false;
@@
-564,7
+564,7
@@
bool PHIElimination::SplitPHIEdges(MachineFunction &MF,
// out-of-line blocks into the loop which is very bad for code placement.
if (PreMBB == &MBB && !SplitAllCriticalEdges)
continue;
// out-of-line blocks into the loop which is very bad for code placement.
if (PreMBB == &MBB && !SplitAllCriticalEdges)
continue;
- const MachineLoop *PreLoop = MLI ? MLI->getLoopFor(PreMBB) :
0
;
+ const MachineLoop *PreLoop = MLI ? MLI->getLoopFor(PreMBB) :
nullptr
;
if (IsLoopHeader && PreLoop == CurLoop && !SplitAllCriticalEdges)
continue;
if (IsLoopHeader && PreLoop == CurLoop && !SplitAllCriticalEdges)
continue;
@@
-607,7
+607,7
@@
bool PHIElimination::SplitPHIEdges(MachineFunction &MF,
if (!ShouldSplit)
continue;
if (!PreMBB->SplitCriticalEdge(&MBB, this)) {
if (!ShouldSplit)
continue;
if (!PreMBB->SplitCriticalEdge(&MBB, this)) {
- DEBUG(dbgs() << "Failed to split c
irit
cal edge.\n");
+ DEBUG(dbgs() << "Failed to split c
riti
cal edge.\n");
continue;
}
Changed = true;
continue;
}
Changed = true;