mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-31 10:34:17 +00:00
CodeGen: Use the new DebugLoc API, NFC
Update lib/CodeGen (and lib/Target) to use the new `DebugLoc` API. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233582 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9039fc77c3
commit
3637babc4c
@ -972,7 +972,7 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) {
|
||||
if (!MI->isDebugValue()) {
|
||||
DebugLoc DL = MI->getDebugLoc();
|
||||
if (DL != PrevInstLoc) {
|
||||
if (!DL.isUnknown()) {
|
||||
if (DL) {
|
||||
unsigned Flags = 0;
|
||||
PrevInstLoc = DL;
|
||||
if (DL == PrologEndLoc) {
|
||||
@ -984,7 +984,7 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) {
|
||||
Asm->OutStreamer.getContext().getCurrentDwarfLoc().getLine())
|
||||
Flags |= DWARF2_FLAG_IS_STMT;
|
||||
|
||||
const MDNode *Scope = DL.getScope(Asm->MF->getFunction()->getContext());
|
||||
const MDNode *Scope = DL.getScope();
|
||||
recordSourceLine(DL.getLine(), DL.getCol(), Scope, Flags);
|
||||
} else if (UnknownLocations) {
|
||||
PrevInstLoc = DL;
|
||||
@ -1072,7 +1072,7 @@ static DebugLoc findPrologueEndLoc(const MachineFunction *MF) {
|
||||
for (const auto &MBB : *MF)
|
||||
for (const auto &MI : MBB)
|
||||
if (!MI.isDebugValue() && !MI.getFlag(MachineInstr::FrameSetup) &&
|
||||
!MI.getDebugLoc().isUnknown()) {
|
||||
MI.getDebugLoc()) {
|
||||
// Did the target forget to set the FrameSetup flag for CFI insns?
|
||||
assert(!MI.isCFIInstruction() &&
|
||||
"First non-frame-setup instruction is a CFI instruction.");
|
||||
@ -1168,15 +1168,13 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
|
||||
|
||||
// Record beginning of function.
|
||||
PrologEndLoc = findPrologueEndLoc(MF);
|
||||
if (!PrologEndLoc.isUnknown()) {
|
||||
DebugLoc FnStartDL =
|
||||
PrologEndLoc.getFnDebugLoc(MF->getFunction()->getContext());
|
||||
if (PrologEndLoc) {
|
||||
DebugLoc FnStartDL = PrologEndLoc.getFnDebugLoc();
|
||||
|
||||
// We'd like to list the prologue as "not statements" but GDB behaves
|
||||
// poorly if we do that. Revisit this with caution/GDB (7.5+) testing.
|
||||
recordSourceLine(FnStartDL.getLine(), FnStartDL.getCol(),
|
||||
FnStartDL.getScope(MF->getFunction()->getContext()),
|
||||
DWARF2_FLAG_IS_STMT);
|
||||
FnStartDL.getScope(), DWARF2_FLAG_IS_STMT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ StringRef WinCodeViewLineTables::getFullFilepath(const MDNode *S) {
|
||||
|
||||
void WinCodeViewLineTables::maybeRecordLocation(DebugLoc DL,
|
||||
const MachineFunction *MF) {
|
||||
const MDNode *Scope = DL.getScope(MF->getFunction()->getContext());
|
||||
const MDNode *Scope = DL.getScope();
|
||||
if (!Scope)
|
||||
return;
|
||||
StringRef Filename = getFullFilepath(Scope);
|
||||
@ -330,7 +330,7 @@ void WinCodeViewLineTables::beginFunction(const MachineFunction *MF) {
|
||||
DebugLoc PrologEndLoc;
|
||||
bool EmptyPrologue = true;
|
||||
for (const auto &MBB : *MF) {
|
||||
if (!PrologEndLoc.isUnknown())
|
||||
if (PrologEndLoc)
|
||||
break;
|
||||
for (const auto &MI : MBB) {
|
||||
if (MI.isDebugValue())
|
||||
@ -339,8 +339,7 @@ void WinCodeViewLineTables::beginFunction(const MachineFunction *MF) {
|
||||
// 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())) {
|
||||
if (!MI.getFlag(MachineInstr::FrameSetup) && MI.getDebugLoc()) {
|
||||
PrologEndLoc = MI.getDebugLoc();
|
||||
break;
|
||||
}
|
||||
@ -348,9 +347,8 @@ void WinCodeViewLineTables::beginFunction(const MachineFunction *MF) {
|
||||
}
|
||||
}
|
||||
// Record beginning of function if we have a non-empty prologue.
|
||||
if (!PrologEndLoc.isUnknown() && !EmptyPrologue) {
|
||||
DebugLoc FnStartDL =
|
||||
PrologEndLoc.getFnDebugLoc(MF->getFunction()->getContext());
|
||||
if (PrologEndLoc && !EmptyPrologue) {
|
||||
DebugLoc FnStartDL = PrologEndLoc.getFnDebugLoc();
|
||||
maybeRecordLocation(FnStartDL, MF);
|
||||
}
|
||||
}
|
||||
@ -377,7 +375,7 @@ void WinCodeViewLineTables::beginInstruction(const MachineInstr *MI) {
|
||||
if (!Asm || MI->isDebugValue() || MI->getFlag(MachineInstr::FrameSetup))
|
||||
return;
|
||||
DebugLoc DL = MI->getDebugLoc();
|
||||
if (DL == PrevInstLoc || DL.isUnknown())
|
||||
if (DL == PrevInstLoc || !DL)
|
||||
return;
|
||||
maybeRecordLocation(DL, Asm->MF);
|
||||
}
|
||||
|
@ -62,8 +62,8 @@ void LexicalScopes::extractLexicalScopes(
|
||||
DebugLoc PrevDL;
|
||||
for (const auto &MInsn : MBB) {
|
||||
// Check if instruction has valid location information.
|
||||
const DebugLoc MIDL = MInsn.getDebugLoc();
|
||||
if (MIDL.isUnknown()) {
|
||||
const DebugLoc &MIDL = MInsn.getDebugLoc();
|
||||
if (!MIDL) {
|
||||
PrevMI = &MInsn;
|
||||
continue;
|
||||
}
|
||||
@ -96,7 +96,7 @@ void LexicalScopes::extractLexicalScopes(
|
||||
}
|
||||
|
||||
// Create last instruction range.
|
||||
if (RangeBeginMI && PrevMI && !PrevDL.isUnknown()) {
|
||||
if (RangeBeginMI && PrevMI && PrevDL) {
|
||||
InsnRange R(RangeBeginMI, PrevMI);
|
||||
MIRanges.push_back(R);
|
||||
MI2ScopeMap[RangeBeginMI] = getOrCreateLexicalScope(PrevDL);
|
||||
@ -107,9 +107,7 @@ void LexicalScopes::extractLexicalScopes(
|
||||
/// findLexicalScope - Find lexical scope, either regular or inlined, for the
|
||||
/// given DebugLoc. Return NULL if not found.
|
||||
LexicalScope *LexicalScopes::findLexicalScope(DebugLoc DL) {
|
||||
MDNode *Scope = nullptr;
|
||||
MDNode *IA = nullptr;
|
||||
DL.getScopeAndInlinedAt(Scope, IA, MF->getFunction()->getContext());
|
||||
auto *Scope = DL.getScope();
|
||||
if (!Scope)
|
||||
return nullptr;
|
||||
|
||||
@ -119,7 +117,7 @@ LexicalScope *LexicalScopes::findLexicalScope(DebugLoc DL) {
|
||||
if (D.isLexicalBlockFile())
|
||||
Scope = DILexicalBlockFile(Scope).getScope();
|
||||
|
||||
if (IA) {
|
||||
if (auto *IA = DL.getInlinedAt()) {
|
||||
auto I = InlinedLexicalScopeMap.find(std::make_pair(Scope, IA));
|
||||
return I != InlinedLexicalScopeMap.end() ? &I->second : nullptr;
|
||||
}
|
||||
@ -129,13 +127,11 @@ LexicalScope *LexicalScopes::findLexicalScope(DebugLoc DL) {
|
||||
/// getOrCreateLexicalScope - Find lexical scope for the given DebugLoc. If
|
||||
/// not available then create new lexical scope.
|
||||
LexicalScope *LexicalScopes::getOrCreateLexicalScope(DebugLoc DL) {
|
||||
if (DL.isUnknown())
|
||||
if (!DL)
|
||||
return nullptr;
|
||||
MDNode *Scope = nullptr;
|
||||
MDNode *InlinedAt = nullptr;
|
||||
DL.getScopeAndInlinedAt(Scope, InlinedAt, MF->getFunction()->getContext());
|
||||
|
||||
if (InlinedAt) {
|
||||
MDNode *Scope = DL.getScope();
|
||||
if (auto *InlinedAt = DL.getInlinedAt()) {
|
||||
// Create an abstract scope for inlined function.
|
||||
getOrCreateAbstractScope(Scope);
|
||||
// Create an inlined scope for inlined function.
|
||||
@ -186,7 +182,7 @@ LexicalScope *LexicalScopes::getOrCreateInlinedScope(MDNode *ScopeNode,
|
||||
LexicalScope *Parent;
|
||||
DILexicalBlock Scope(ScopeNode);
|
||||
if (Scope.isSubprogram())
|
||||
Parent = getOrCreateLexicalScope(DebugLoc::getFromDILocation(InlinedAt));
|
||||
Parent = getOrCreateLexicalScope(DebugLoc(InlinedAt));
|
||||
else
|
||||
Parent = getOrCreateInlinedScope(Scope.getContext(), InlinedAt);
|
||||
|
||||
@ -316,7 +312,7 @@ bool LexicalScopes::dominates(DebugLoc DL, MachineBasicBlock *MBB) {
|
||||
for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end(); I != E;
|
||||
++I) {
|
||||
DebugLoc IDL = I->getDebugLoc();
|
||||
if (IDL.isUnknown())
|
||||
if (!IDL)
|
||||
continue;
|
||||
if (LexicalScope *IScope = getOrCreateLexicalScope(IDL))
|
||||
if (Scope->dominates(IScope))
|
||||
|
@ -881,8 +881,8 @@ bool MachineInstr::isIdenticalTo(const MachineInstr *Other,
|
||||
}
|
||||
// If DebugLoc does not match then two dbg.values are not identical.
|
||||
if (isDebugValue())
|
||||
if (!getDebugLoc().isUnknown() && !Other->getDebugLoc().isUnknown()
|
||||
&& getDebugLoc() != Other->getDebugLoc())
|
||||
if (getDebugLoc() && Other->getDebugLoc() &&
|
||||
getDebugLoc() != Other->getDebugLoc())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@ -1715,9 +1715,9 @@ void MachineInstr::print(raw_ostream &OS, bool SkipOpers) const {
|
||||
if (!HaveSemi) OS << ";";
|
||||
DIVariable DV(getOperand(e - 1).getMetadata());
|
||||
OS << " line no:" << DV.getLineNumber();
|
||||
if (MDNode *InlinedAt = DV.getInlinedAt()) {
|
||||
DebugLoc InlinedAtDL = DebugLoc::getFromDILocation(InlinedAt);
|
||||
if (!InlinedAtDL.isUnknown() && MF) {
|
||||
if (auto *InlinedAt = DV.getInlinedAt()) {
|
||||
DebugLoc InlinedAtDL(InlinedAt);
|
||||
if (InlinedAtDL && MF) {
|
||||
OS << " inlined @[ ";
|
||||
InlinedAtDL.print(OS);
|
||||
OS << " ]";
|
||||
@ -1725,7 +1725,7 @@ void MachineInstr::print(raw_ostream &OS, bool SkipOpers) const {
|
||||
}
|
||||
if (isIndirectDebugValue())
|
||||
OS << " indirect";
|
||||
} else if (!debugLoc.isUnknown() && MF) {
|
||||
} else if (debugLoc && MF) {
|
||||
if (!HaveSemi) OS << ";";
|
||||
OS << " dbg:";
|
||||
debugLoc.print(OS);
|
||||
|
@ -182,9 +182,7 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
|
||||
DIVariable DIVar(DI->getVariable());
|
||||
assert((!DIVar || DIVar.isVariable()) &&
|
||||
"Variable in DbgDeclareInst should be either null or a DIVariable.");
|
||||
if (MMI.hasDebugInfo() &&
|
||||
DIVar &&
|
||||
!DI->getDebugLoc().isUnknown()) {
|
||||
if (MMI.hasDebugInfo() && DIVar && DI->getDebugLoc()) {
|
||||
// Don't handle byval struct arguments or VLAs, for example.
|
||||
// Non-byval arguments are handled here (they refer to the stack
|
||||
// temporary alloca at this point).
|
||||
|
@ -5574,8 +5574,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
|
||||
/// For IROrder, we keep the smaller of the two
|
||||
SDNode *SelectionDAG::UpdadeSDLocOnMergedSDNode(SDNode *N, SDLoc OLoc) {
|
||||
DebugLoc NLoc = N->getDebugLoc();
|
||||
if (!(NLoc.isUnknown()) && (OptLevel == CodeGenOpt::None) &&
|
||||
(OLoc.getDebugLoc() != NLoc)) {
|
||||
if (NLoc && OptLevel == CodeGenOpt::None && OLoc.getDebugLoc() != NLoc) {
|
||||
N->setDebugLoc(DebugLoc());
|
||||
}
|
||||
unsigned Order = std::min(N->getIROrder(), OLoc.getIROrder());
|
||||
|
@ -523,22 +523,16 @@ void SDNode::print_details(raw_ostream &OS, const SelectionDAG *G) const {
|
||||
if (!G)
|
||||
return;
|
||||
|
||||
DebugLoc dl = getDebugLoc();
|
||||
if (dl.isUnknown())
|
||||
MDLocation *L = getDebugLoc();
|
||||
if (!L)
|
||||
return;
|
||||
|
||||
DIScope Scope(
|
||||
dl.getScope(G->getMachineFunction().getFunction()->getContext()));
|
||||
OS << " dbg:";
|
||||
assert((!Scope || Scope.isScope()) &&
|
||||
"Scope of a DebugLoc should be null or a DIScope.");
|
||||
// Omit the directory, since it's usually long and uninteresting.
|
||||
if (Scope)
|
||||
if (DIScope Scope = L->getScope())
|
||||
OS << Scope.getFilename();
|
||||
else
|
||||
OS << "<unknown>";
|
||||
OS << ':' << dl.getLine();
|
||||
if (unsigned C = dl.getCol())
|
||||
OS << ':' << L->getLine();
|
||||
if (unsigned C = L->getColumn())
|
||||
OS << ':' << C;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ void NVPTXAsmPrinter::emitLineNumberAsDotLoc(const MachineInstr &MI) {
|
||||
|
||||
DebugLoc curLoc = MI.getDebugLoc();
|
||||
|
||||
if (prevDebugLoc.isUnknown() && curLoc.isUnknown())
|
||||
if (!prevDebugLoc && !curLoc)
|
||||
return;
|
||||
|
||||
if (prevDebugLoc == curLoc)
|
||||
@ -126,14 +126,10 @@ void NVPTXAsmPrinter::emitLineNumberAsDotLoc(const MachineInstr &MI) {
|
||||
|
||||
prevDebugLoc = curLoc;
|
||||
|
||||
if (curLoc.isUnknown())
|
||||
if (!curLoc)
|
||||
return;
|
||||
|
||||
const MachineFunction *MF = MI.getParent()->getParent();
|
||||
//const TargetMachine &TM = MF->getTarget();
|
||||
|
||||
const LLVMContext &ctx = MF->getFunction()->getContext();
|
||||
DIScope Scope(curLoc.getScope(ctx));
|
||||
DIScope Scope(curLoc.getScope());
|
||||
|
||||
assert((!Scope || Scope.isScope()) &&
|
||||
"Scope of a DebugLoc should be null or a DIScope.");
|
||||
|
@ -623,7 +623,7 @@ DebugLoc AMDGPUCFGStructurizer::getLastDebugLocInBB(MachineBasicBlock *MBB) {
|
||||
for (MachineBasicBlock::iterator It = MBB->begin(); It != MBB->end();
|
||||
++It) {
|
||||
MachineInstr *instr = &(*It);
|
||||
if (!instr->getDebugLoc().isUnknown())
|
||||
if (instr->getDebugLoc())
|
||||
DL = instr->getDebugLoc();
|
||||
}
|
||||
return DL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user