aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCStreamer.cpp
diff options
context:
space:
mode:
authorNilanjana Basu <nilanjana.basu87@gmail.com>2019-08-02 18:44:39 +0000
committerNilanjana Basu <nilanjana.basu87@gmail.com>2019-08-02 18:44:39 +0000
commit1c67521591a7b63bcba11fa0c45f8465cb6d2e82 (patch)
treede7c93804559d020d9a7b8e75db38b75b585f420 /llvm/lib/MC/MCStreamer.cpp
parent9f057853580ff3853a789daea2b3df7d7bd09851 (diff)
downloadllvm-1c67521591a7b63bcba11fa0c45f8465cb6d2e82.zip
llvm-1c67521591a7b63bcba11fa0c45f8465cb6d2e82.tar.gz
llvm-1c67521591a7b63bcba11fa0c45f8465cb6d2e82.tar.bz2
Changing representation of cv_def_range directives in Codeview debug info assembly format for better readability
llvm-svn: 367704
Diffstat (limited to 'llvm/lib/MC/MCStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCStreamer.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index decbb96..254eb2c 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -327,10 +327,56 @@ void MCStreamer::EmitCVInlineLinetableDirective(unsigned PrimaryFunctionId,
const MCSymbol *FnStartSym,
const MCSymbol *FnEndSym) {}
+/// Only call this on endian-specific types like ulittle16_t and little32_t, or
+/// structs composed of them.
+template <typename T>
+static void copyBytesForDefRange(SmallString<20> &BytePrefix,
+ codeview::SymbolKind SymKind,
+ const T &DefRangeHeader) {
+ BytePrefix.resize(2 + sizeof(T));
+ codeview::ulittle16_t SymKindLE = codeview::ulittle16_t(SymKind);
+ memcpy(&BytePrefix[0], &SymKindLE, 2);
+ memcpy(&BytePrefix[2], &DefRangeHeader, sizeof(T));
+}
+
void MCStreamer::EmitCVDefRangeDirective(
ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
StringRef FixedSizePortion) {}
+void MCStreamer::EmitCVDefRangeDirective(
+ ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
+ codeview::DefRangeRegisterRelSym::Header DRHdr) {
+ SmallString<20> BytePrefix;
+ copyBytesForDefRange(BytePrefix, codeview::S_DEFRANGE_REGISTER_REL, DRHdr);
+ EmitCVDefRangeDirective(Ranges, BytePrefix);
+}
+
+void MCStreamer::EmitCVDefRangeDirective(
+ ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
+ codeview::DefRangeSubfieldRegisterSym::Header DRHdr) {
+ SmallString<20> BytePrefix;
+ copyBytesForDefRange(BytePrefix, codeview::S_DEFRANGE_SUBFIELD_REGISTER,
+ DRHdr);
+ EmitCVDefRangeDirective(Ranges, BytePrefix);
+}
+
+void MCStreamer::EmitCVDefRangeDirective(
+ ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
+ codeview::DefRangeRegisterSym::Header DRHdr) {
+ SmallString<20> BytePrefix;
+ copyBytesForDefRange(BytePrefix, codeview::S_DEFRANGE_REGISTER, DRHdr);
+ EmitCVDefRangeDirective(Ranges, BytePrefix);
+}
+
+void MCStreamer::EmitCVDefRangeDirective(
+ ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
+ codeview::DefRangeFramePointerRelSym::Header DRHdr) {
+ SmallString<20> BytePrefix;
+ copyBytesForDefRange(BytePrefix, codeview::S_DEFRANGE_FRAMEPOINTER_REL,
+ DRHdr);
+ EmitCVDefRangeDirective(Ranges, BytePrefix);
+}
+
void MCStreamer::EmitEHSymAttributes(const MCSymbol *Symbol,
MCSymbol *EHSymbol) {
}