summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index 218f8db9cde..e4084856272 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -860,6 +860,30 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV,
emitInlinedCallSite(FI, InlinedAt, I->second);
}
+ for (auto Annot : FI.Annotations) {
+ MCSymbol *Label = Annot.first;
+ MDTuple *Strs = cast<MDTuple>(Annot.second);
+ MCSymbol *AnnotBegin = MMI->getContext().createTempSymbol(),
+ *AnnotEnd = MMI->getContext().createTempSymbol();
+ OS.AddComment("Record length");
+ OS.emitAbsoluteSymbolDiff(AnnotEnd, AnnotBegin, 2);
+ OS.EmitLabel(AnnotBegin);
+ OS.AddComment("Record kind: S_ANNOTATION");
+ OS.EmitIntValue(SymbolKind::S_ANNOTATION, 2);
+ OS.EmitCOFFSecRel32(Label, /*Offset=*/0);
+ // FIXME: Make sure we don't overflow the max record size.
+ OS.EmitCOFFSectionIndex(Label);
+ OS.EmitIntValue(Strs->getNumOperands(), 2);
+ for (Metadata *MD : Strs->operands()) {
+ // MDStrings are null terminated, so we can do EmitBytes and get the
+ // nice .asciz directive.
+ StringRef Str = cast<MDString>(MD)->getString();
+ assert(Str.data()[Str.size()] == '\0' && "non-nullterminated MDString");
+ OS.EmitBytes(StringRef(Str.data(), Str.size() + 1));
+ }
+ OS.EmitLabel(AnnotEnd);
+ }
+
if (SP != nullptr)
emitDebugInfoForUDTs(LocalUDTs);
@@ -2195,6 +2219,8 @@ void CodeViewDebug::endFunctionImpl(const MachineFunction *MF) {
return;
}
+ CurFn->Annotations = MF->getCodeViewAnnotations();
+
CurFn->End = Asm->getFunctionEnd();
CurFn = nullptr;
OpenPOWER on IntegriCloud