Skip to content

Commit 453d7b6

Browse files
committed
add comments
1 parent 9436a86 commit 453d7b6

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3372,6 +3372,12 @@ emitRangeList(DwarfDebug &DD, AsmPrinter *Asm, MCSymbol *Sym, const Ranges &R,
33723372
Asm->emitLabelDifference(End, Base, Size);
33733373
}
33743374
} else if (UseDwarf5) {
3375+
// NOTE: We can't use absoluteSymbolDiff here instead of
3376+
// isRangeRelaxable. While isRangeRelaxable only checks that the offset
3377+
// between labels won't change at link time (which is exactly what we
3378+
// need), absoluteSymbolDiff also requires that the offset remain
3379+
// unchanged at assembly time, imposing a much stricter condition.
3380+
// Consequently, this would lead to less optimal debug info emission.
33753381
if (DD.useSplitDwarf() && llvm::isRangeRelaxable(Begin, End)) {
33763382
Asm->OutStreamer->AddComment(StringifyEnum(StartxEndx));
33773383
Asm->emitInt8(StartxEndx);

llvm/lib/MC/MCSymbol.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ void MCSymbol::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
8787
LLVM_DUMP_METHOD void MCSymbol::dump() const { dbgs() << *this; }
8888
#endif
8989

90+
// Determine whether the offset between two labels can change at link time.
91+
// Currently, this function is used only in DWARF info emission logic, where it
92+
// helps generate more optimal debug info when the offset between labels is
93+
// constant at link time.
9094
bool llvm::isRangeRelaxable(const MCSymbol *Begin, const MCSymbol *End) {
9195
assert(Begin && "Range without a begin symbol?");
9296
assert(End && "Range without an end symbol?");

0 commit comments

Comments
 (0)