aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCStreamer.cpp
diff options
context:
space:
mode:
authorChen Zheng <czhengsz@cn.ibm.com>2021-02-23 21:18:47 -0500
committerChen Zheng <czhengsz@cn.ibm.com>2021-02-23 21:29:05 -0500
commitbe5d92e37e4fe0b7ba2f5658fa828c1c39988374 (patch)
tree482c31cfb04b167bbfcb94559c4d84cecaf760af /llvm/lib/MC/MCStreamer.cpp
parentc4a91444689455a35db1e7f50bcd876a3eb86126 (diff)
downloadllvm-be5d92e37e4fe0b7ba2f5658fa828c1c39988374.zip
llvm-be5d92e37e4fe0b7ba2f5658fa828c1c39988374.tar.gz
llvm-be5d92e37e4fe0b7ba2f5658fa828c1c39988374.tar.bz2
[Debug-Info][NFC] move emitDwarfUnitLength to MCStreamer class
We may need to do some customization for DWARF unit length in DWARF section headers for some targets for some code generation path. For example, for XCOFF in assembly path, AIX assembler does not require the debug section containing its debug unit length in the header. Move emitDwarfUnitLength to MCStreamer class so that we can do customization in different Streamers Reviewed By: ikudrin Differential Revision: https://reviews.llvm.org/D95932
Diffstat (limited to 'llvm/lib/MC/MCStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCStreamer.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index 4b5ae3c..4f2ec51 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -991,6 +991,29 @@ void MCStreamer::Finish(SMLoc EndLoc) {
finishImpl();
}
+void MCStreamer::maybeEmitDwarf64Mark() {
+ if (Context.getDwarfFormat() != dwarf::DWARF64)
+ return;
+ AddComment("DWARF64 Mark");
+ emitInt32(dwarf::DW_LENGTH_DWARF64);
+}
+
+void MCStreamer::emitDwarfUnitLength(uint64_t Length, const Twine &Comment) {
+ assert(Context.getDwarfFormat() == dwarf::DWARF64 ||
+ Length <= dwarf::DW_LENGTH_lo_reserved);
+ maybeEmitDwarf64Mark();
+ AddComment(Comment);
+ emitIntValue(Length, dwarf::getDwarfOffsetByteSize(Context.getDwarfFormat()));
+}
+
+void MCStreamer::emitDwarfUnitLength(const MCSymbol *Hi, const MCSymbol *Lo,
+ const Twine &Comment) {
+ maybeEmitDwarf64Mark();
+ AddComment(Comment);
+ emitAbsoluteSymbolDiff(
+ Hi, Lo, dwarf::getDwarfOffsetByteSize(Context.getDwarfFormat()));
+}
+
void MCStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
visitUsedExpr(*Value);
Symbol->setVariableValue(Value);