mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-23 11:38:38 +00:00
DebugInfo: Gut DILocation
This is along the same lines as r234832, but for `DILocation`. Clean out all accessors from `DILocation`. Any callers should be using `MDLocation` directly (e.g., via `operator->()`). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234835 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1624f35f2b
commit
d59e30dfb7
@ -663,28 +663,15 @@ public:
|
|||||||
MDExpression &operator*() const { return *N; }
|
MDExpression &operator*() const { return *N; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief This object holds location information.
|
class DILocation {
|
||||||
///
|
MDLocation *N;
|
||||||
/// This object is not associated with any DWARF tag.
|
|
||||||
class DILocation : public DIDescriptor {
|
|
||||||
public:
|
public:
|
||||||
DILocation() = default;
|
DILocation(const MDLocation *N = nullptr) : N(const_cast<MDLocation *>(N)) {}
|
||||||
DILocation(const MDLocation *N) : DIDescriptor(N) {}
|
|
||||||
|
|
||||||
MDLocation *get() const {
|
operator MDLocation *() const { return N; }
|
||||||
return cast_or_null<MDLocation>(DIDescriptor::get());
|
MDLocation *operator->() const { return N; }
|
||||||
}
|
MDLocation &operator*() const { return *N; }
|
||||||
operator MDLocation *() const { return get(); }
|
|
||||||
MDLocation *operator->() const { return get(); }
|
|
||||||
MDLocation &operator*() const { return *get(); }
|
|
||||||
|
|
||||||
unsigned getLineNumber() const { return get()->getLine(); }
|
|
||||||
unsigned getColumnNumber() const { return get()->getColumn(); }
|
|
||||||
DIScope getScope() const { return DIScope(get()->getScope()); }
|
|
||||||
DILocation getOrigLocation() const { return get()->getInlinedAt(); }
|
|
||||||
StringRef getFilename() const { return get()->getFilename(); }
|
|
||||||
StringRef getDirectory() const { return get()->getDirectory(); }
|
|
||||||
unsigned getDiscriminator() const { return get()->getDiscriminator(); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DIObjCProperty : public DIDescriptor {
|
class DIObjCProperty : public DIDescriptor {
|
||||||
|
@ -430,10 +430,10 @@ DwarfCompileUnit::constructInlinedScopeDIE(LexicalScope *Scope) {
|
|||||||
attachRangesOrLowHighPC(*ScopeDIE, Scope->getRanges());
|
attachRangesOrLowHighPC(*ScopeDIE, Scope->getRanges());
|
||||||
|
|
||||||
// Add the call site information to the DIE.
|
// Add the call site information to the DIE.
|
||||||
DILocation DL(Scope->getInlinedAt());
|
const MDLocation *IA = Scope->getInlinedAt();
|
||||||
addUInt(*ScopeDIE, dwarf::DW_AT_call_file, None,
|
addUInt(*ScopeDIE, dwarf::DW_AT_call_file, None,
|
||||||
getOrCreateSourceID(DL.getFilename(), DL.getDirectory()));
|
getOrCreateSourceID(IA->getFilename(), IA->getDirectory()));
|
||||||
addUInt(*ScopeDIE, dwarf::DW_AT_call_line, None, DL.getLineNumber());
|
addUInt(*ScopeDIE, dwarf::DW_AT_call_line, None, IA->getLine());
|
||||||
|
|
||||||
// Add name to the name table, we do this here because we're guaranteed
|
// Add name to the name table, we do this here because we're guaranteed
|
||||||
// to have concrete versions of our DW_TAG_inlined_subprogram nodes.
|
// to have concrete versions of our DW_TAG_inlined_subprogram nodes.
|
||||||
|
@ -179,8 +179,8 @@ void DebugInfoFinder::processLocation(const Module &M, DILocation Loc) {
|
|||||||
if (!Loc)
|
if (!Loc)
|
||||||
return;
|
return;
|
||||||
InitializeTypeMap(M);
|
InitializeTypeMap(M);
|
||||||
processScope(Loc.getScope());
|
processScope(Loc->getScope());
|
||||||
processLocation(M, Loc.getOrigLocation());
|
processLocation(M, Loc->getInlinedAt());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugInfoFinder::processType(DIType DT) {
|
void DebugInfoFinder::processType(DIType DT) {
|
||||||
|
@ -136,10 +136,9 @@ void DiagnosticInfoOptimizationBase::getLocation(StringRef *Filename,
|
|||||||
unsigned *Line,
|
unsigned *Line,
|
||||||
unsigned *Column) const {
|
unsigned *Column) const {
|
||||||
MDLocation *L = getDebugLoc();
|
MDLocation *L = getDebugLoc();
|
||||||
DILocation DIL = L;
|
*Filename = L->getFilename();
|
||||||
*Filename = DIL.getFilename();
|
*Line = L->getLine();
|
||||||
*Line = DIL.getLineNumber();
|
*Column = L->getColumn();
|
||||||
*Column = DIL.getColumnNumber();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string DiagnosticInfoOptimizationBase::getLocationStr() const {
|
const std::string DiagnosticInfoOptimizationBase::getLocationStr() const {
|
||||||
|
@ -226,7 +226,7 @@ unsigned SampleProfileLoader::getInstWeight(Instruction &Inst) {
|
|||||||
|
|
||||||
DILocation DIL = DLoc.get();
|
DILocation DIL = DLoc.get();
|
||||||
int LOffset = Lineno - HeaderLineno;
|
int LOffset = Lineno - HeaderLineno;
|
||||||
unsigned Discriminator = DIL.getDiscriminator();
|
unsigned Discriminator = DIL->getDiscriminator();
|
||||||
unsigned Weight = Samples->samplesAt(LOffset, Discriminator);
|
unsigned Weight = Samples->samplesAt(LOffset, Discriminator);
|
||||||
DEBUG(dbgs() << " " << Lineno << "." << Discriminator << ":" << Inst
|
DEBUG(dbgs() << " " << Lineno << "." << Discriminator << ":" << Inst
|
||||||
<< " (line offset: " << LOffset << "." << Discriminator
|
<< " (line offset: " << LOffset << "." << Discriminator
|
||||||
|
@ -192,8 +192,8 @@ bool AddDiscriminators::runOnFunction(Function &F) {
|
|||||||
if (!FirstDIL->canDiscriminate(*LastDIL)) {
|
if (!FirstDIL->canDiscriminate(*LastDIL)) {
|
||||||
// Create a new lexical scope and compute a new discriminator
|
// Create a new lexical scope and compute a new discriminator
|
||||||
// number for it.
|
// number for it.
|
||||||
StringRef Filename = FirstDIL.getFilename();
|
StringRef Filename = FirstDIL->getFilename();
|
||||||
DIScope Scope = FirstDIL.getScope();
|
DIScope Scope = FirstDIL->getScope();
|
||||||
DIFile File = Builder.createFile(Filename, Scope.getDirectory());
|
DIFile File = Builder.createFile(Filename, Scope.getDirectory());
|
||||||
|
|
||||||
// FIXME: Calculate the discriminator here, based on local information,
|
// FIXME: Calculate the discriminator here, based on local information,
|
||||||
@ -204,10 +204,10 @@ bool AddDiscriminators::runOnFunction(Function &F) {
|
|||||||
unsigned Discriminator = FirstDIL->computeNewDiscriminator();
|
unsigned Discriminator = FirstDIL->computeNewDiscriminator();
|
||||||
DILexicalBlockFile NewScope =
|
DILexicalBlockFile NewScope =
|
||||||
Builder.createLexicalBlockFile(Scope, File, Discriminator);
|
Builder.createLexicalBlockFile(Scope, File, Discriminator);
|
||||||
DILocation NewDIL =
|
auto *NewDIL =
|
||||||
MDLocation::get(Ctx, FirstDIL->getLine(), FirstDIL->getColumn(),
|
MDLocation::get(Ctx, FirstDIL->getLine(), FirstDIL->getColumn(),
|
||||||
NewScope, FirstDIL->getInlinedAt());
|
NewScope, FirstDIL->getInlinedAt());
|
||||||
DebugLoc newDebugLoc = NewDIL.get();
|
DebugLoc newDebugLoc = NewDIL;
|
||||||
|
|
||||||
// Attach this new debug location to First and every
|
// Attach this new debug location to First and every
|
||||||
// instruction following First that shares the same location.
|
// instruction following First that shares the same location.
|
||||||
@ -216,9 +216,9 @@ bool AddDiscriminators::runOnFunction(Function &F) {
|
|||||||
if (I1->getDebugLoc().get() != FirstDIL)
|
if (I1->getDebugLoc().get() != FirstDIL)
|
||||||
break;
|
break;
|
||||||
I1->setDebugLoc(newDebugLoc);
|
I1->setDebugLoc(newDebugLoc);
|
||||||
DEBUG(dbgs() << NewDIL.getFilename() << ":" << NewDIL.getLineNumber()
|
DEBUG(dbgs() << NewDIL->getFilename() << ":" << NewDIL->getLine()
|
||||||
<< ":" << NewDIL.getColumnNumber() << ":"
|
<< ":" << NewDIL->getColumn() << ":"
|
||||||
<< NewDIL.getDiscriminator() << *I1 << "\n");
|
<< NewDIL->getDiscriminator() << *I1 << "\n");
|
||||||
}
|
}
|
||||||
DEBUG(dbgs() << "\n");
|
DEBUG(dbgs() << "\n");
|
||||||
Changed = true;
|
Changed = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user