diff options
author | Chen Zheng <czhengsz@cn.ibm.com> | 2021-02-25 20:39:45 -0500 |
---|---|---|
committer | Chen Zheng <czhengsz@cn.ibm.com> | 2021-02-25 21:00:25 -0500 |
commit | d39bc36b1be72a16dcc4087dce547714ded324a9 (patch) | |
tree | 56be6198eaf19cd87d53b96d60330800f9aa5f8a /llvm/lib/MC/MCStreamer.cpp | |
parent | c90dac27e94ec354a3e8919556ac5bc89b62c731 (diff) | |
download | llvm-d39bc36b1be72a16dcc4087dce547714ded324a9.zip llvm-d39bc36b1be72a16dcc4087dce547714ded324a9.tar.gz llvm-d39bc36b1be72a16dcc4087dce547714ded324a9.tar.bz2 |
[debug-info] refactor emitDwarfUnitLength
remove `Hi` `Lo` argument from `emitDwarfUnitLength`, so we
can make caller of emitDwarfUnitLength easier.
Reviewed By: MaskRay, dblaikie, ikudrin
Differential Revision: https://reviews.llvm.org/D96409
Diffstat (limited to 'llvm/lib/MC/MCStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCStreamer.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index 4f2ec51..9b9e5b9 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -1006,12 +1006,19 @@ void MCStreamer::emitDwarfUnitLength(uint64_t Length, const Twine &Comment) { emitIntValue(Length, dwarf::getDwarfOffsetByteSize(Context.getDwarfFormat())); } -void MCStreamer::emitDwarfUnitLength(const MCSymbol *Hi, const MCSymbol *Lo, - const Twine &Comment) { +MCSymbol *MCStreamer::emitDwarfUnitLength(const Twine &Prefix, + const Twine &Comment) { maybeEmitDwarf64Mark(); AddComment(Comment); + MCSymbol *Lo = Context.createTempSymbol(Prefix + "_start"); + MCSymbol *Hi = Context.createTempSymbol(Prefix + "_end"); + emitAbsoluteSymbolDiff( Hi, Lo, dwarf::getDwarfOffsetByteSize(Context.getDwarfFormat())); + // emit the begin symbol after we generate the length field. + emitLabel(Lo); + // Return the Hi symbol to the caller. + return Hi; } void MCStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) { |