summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp25
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp16
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp11
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp17
4 files changed, 31 insertions, 38 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp b/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp
index cae3e916cd4..874b8615b94 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp
@@ -36,19 +36,16 @@ void calculateDbgValueHistory(const MachineFunction *MF,
for (MachineFunction::const_iterator I = MF->begin(), E = MF->end(); I != E;
++I) {
bool AtBlockEntry = true;
- for (MachineBasicBlock::const_iterator II = I->begin(), IE = I->end();
- II != IE; ++II) {
- const MachineInstr *MI = II;
-
- if (MI->isDebugValue()) {
- assert(MI->getNumOperands() > 1 && "Invalid machine instruction!");
+ for (const auto &MI : *I) {
+ if (MI.isDebugValue()) {
+ assert(MI.getNumOperands() > 1 && "Invalid machine instruction!");
// Keep track of user variables.
- const MDNode *Var = MI->getDebugVariable();
+ const MDNode *Var = MI.getDebugVariable();
// Variable is in a register, we need to check for clobbers.
- if (isDbgValueInDefinedReg(MI))
- LiveUserVar[MI->getOperand(0).getReg()] = Var;
+ if (isDbgValueInDefinedReg(&MI))
+ LiveUserVar[MI.getOperand(0).getReg()] = Var;
// Check the history of this variable.
SmallVectorImpl<const MachineInstr *> &History = Result[Var];
@@ -84,14 +81,14 @@ void calculateDbgValueHistory(const MachineFunction *MF,
}
}
}
- History.push_back(MI);
+ History.push_back(&MI);
} else {
// Not a DBG_VALUE instruction.
- if (!MI->isPosition())
+ if (!MI.isPosition())
AtBlockEntry = false;
// Check if the instruction clobbers any registers with debug vars.
- for (const MachineOperand &MO : MI->operands()) {
+ for (const MachineOperand &MO : MI.operands()) {
if (!MO.isReg() || !MO.isDef() || !MO.getReg())
continue;
for (MCRegAliasIterator AI(MO.getReg(), TRI, true); AI.isValid();
@@ -113,14 +110,14 @@ void calculateDbgValueHistory(const MachineFunction *MF,
const MachineInstr *Prev = History.back();
// Sanity-check: Register assignments are terminated at the end of
// their block.
- if (!Prev->isDebugValue() || Prev->getParent() != MI->getParent())
+ if (!Prev->isDebugValue() || Prev->getParent() != MI.getParent())
continue;
// Is the variable still in Reg?
if (!isDbgValueInDefinedReg(Prev) ||
Prev->getOperand(0).getReg() != Reg)
continue;
// Var is clobbered. Make sure the next instruction gets a label.
- History.push_back(MI);
+ History.push_back(&MI);
}
}
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 8de084abff1..d3309c1e6e8 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1441,23 +1441,21 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
// Collect user variables, find the end of the prologue.
for (const auto &MBB : *MF) {
- for (MachineBasicBlock::const_iterator II = MBB.begin(), IE = MBB.end();
- II != IE; ++II) {
- const MachineInstr *MI = II;
- if (MI->isDebugValue()) {
- assert(MI->getNumOperands() > 1 && "Invalid machine instruction!");
+ for (const auto &MI : MBB) {
+ if (MI.isDebugValue()) {
+ assert(MI.getNumOperands() > 1 && "Invalid machine instruction!");
// Keep track of user variables in order of appearance. Store the set
// of variables we've already seen as a set of keys in DbgValues.
- const MDNode *Var = MI->getDebugVariable();
+ const MDNode *Var = MI.getDebugVariable();
auto IterPair = DbgValues.insert(
std::make_pair(Var, SmallVector<const MachineInstr *, 4>()));
if (IterPair.second)
UserVariables.push_back(Var);
- } else if (!MI->getFlag(MachineInstr::FrameSetup) &&
- PrologEndLoc.isUnknown() && !MI->getDebugLoc().isUnknown()) {
+ } else if (!MI.getFlag(MachineInstr::FrameSetup) &&
+ PrologEndLoc.isUnknown() && !MI.getDebugLoc().isUnknown()) {
// First known non-DBG_VALUE and non-frame setup location marks
// the beginning of the function body.
- PrologEndLoc = MI->getDebugLoc();
+ PrologEndLoc = MI.getDebugLoc();
}
}
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp
index 6a8aea29e96..3a12c7326f3 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp
@@ -225,16 +225,15 @@ ComputeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites,
// Visit all instructions in order of address.
for (const auto &MBB : *Asm->MF) {
- for (MachineBasicBlock::const_iterator MI = MBB.begin(), E = MBB.end();
- MI != E; ++MI) {
- if (!MI->isEHLabel()) {
- if (MI->isCall())
- SawPotentiallyThrowing |= !CallToNoUnwindFunction(MI);
+ for (const auto &MI : MBB) {
+ if (!MI.isEHLabel()) {
+ if (MI.isCall())
+ SawPotentiallyThrowing |= !CallToNoUnwindFunction(&MI);
continue;
}
// End of the previous try-range?
- MCSymbol *BeginLabel = MI->getOperand(0).getMCSymbol();
+ MCSymbol *BeginLabel = MI.getOperand(0).getMCSymbol();
if (BeginLabel == LastLabel)
SawPotentiallyThrowing = false;
diff --git a/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp b/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
index 1dbfb9b5992..2212941861b 100644
--- a/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
@@ -277,20 +277,19 @@ void WinCodeViewLineTables::beginFunction(const MachineFunction *MF) {
// for the first instruction of the function, not the last of the prolog?
DebugLoc PrologEndLoc;
bool EmptyPrologue = true;
- for (MachineFunction::const_iterator I = MF->begin(), E = MF->end();
- I != E && PrologEndLoc.isUnknown(); ++I) {
- for (MachineBasicBlock::const_iterator II = I->begin(), IE = I->end();
- II != IE; ++II) {
- const MachineInstr *MI = II;
- if (MI->isDebugValue())
+ for (const auto &MBB : *MF) {
+ if (!PrologEndLoc.isUnknown())
+ break;
+ for (const auto &MI : MBB) {
+ if (MI.isDebugValue())
continue;
// First known non-DBG_VALUE and non-frame setup location marks
// the beginning of the function body.
// FIXME: do we need the first subcondition?
- if (!MI->getFlag(MachineInstr::FrameSetup) &&
- (!MI->getDebugLoc().isUnknown())) {
- PrologEndLoc = MI->getDebugLoc();
+ if (!MI.getFlag(MachineInstr::FrameSetup) &&
+ (!MI.getDebugLoc().isUnknown())) {
+ PrologEndLoc = MI.getDebugLoc();
break;
}
EmptyPrologue = false;
OpenPOWER on IntegriCloud