diff options
author | Nilanjana Basu <nilanjana.basu87@gmail.com> | 2019-08-05 13:55:21 +0000 |
---|---|---|
committer | Nilanjana Basu <nilanjana.basu87@gmail.com> | 2019-08-05 13:55:21 +0000 |
commit | b5e4d7de17155486f10693d0532f5fca82f41508 (patch) | |
tree | 7bd7396b7a579cd82fa397471604797431a85ec4 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | |
parent | 149aa2f7fc6214e7f340da9011a857d75fe5a652 (diff) | |
download | bcm5719-llvm-b5e4d7de17155486f10693d0532f5fca82f41508.tar.gz bcm5719-llvm-b5e4d7de17155486f10693d0532f5fca82f41508.zip |
Revert "Changing representation of .cv_def_range directives in Codeview debug info assembly format for better readability"
This reverts commit a885afa9fa8cab3b34f1ddf3d21535f88b662881.
llvm-svn: 367861
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index ea836469771..b3dabca0a8a 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -2633,6 +2633,17 @@ void CodeViewDebug::emitLocalVariableList(const FunctionInfo &FI, emitLocalVariable(FI, L); } +/// 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, + SymbolKind SymKind, const T &DefRangeHeader) { + BytePrefix.resize(2 + sizeof(T)); + ulittle16_t SymKindLE = ulittle16_t(SymKind); + memcpy(&BytePrefix[0], &SymKindLE, 2); + memcpy(&BytePrefix[2], &DefRangeHeader, sizeof(T)); +} + void CodeViewDebug::emitLocalVariable(const FunctionInfo &FI, const LocalVariable &Var) { // LocalSym record, see SymbolRecord.h for more info. @@ -2681,9 +2692,8 @@ void CodeViewDebug::emitLocalVariable(const FunctionInfo &FI, (bool(Flags & LocalSymFlags::IsParameter) ? (EncFP == FI.EncodedParamFramePtrReg) : (EncFP == FI.EncodedLocalFramePtrReg))) { - DefRangeFramePointerRelSym::Header DRHdr; - DRHdr.Offset = Offset; - OS.EmitCVDefRangeDirective(DefRange.Ranges, DRHdr); + little32_t FPOffset = little32_t(Offset); + copyBytesForDefRange(BytePrefix, S_DEFRANGE_FRAMEPOINTER_REL, FPOffset); } else { uint16_t RegRelFlags = 0; if (DefRange.IsSubfield) { @@ -2695,7 +2705,7 @@ void CodeViewDebug::emitLocalVariable(const FunctionInfo &FI, DRHdr.Register = Reg; DRHdr.Flags = RegRelFlags; DRHdr.BasePointerOffset = Offset; - OS.EmitCVDefRangeDirective(DefRange.Ranges, DRHdr); + copyBytesForDefRange(BytePrefix, S_DEFRANGE_REGISTER_REL, DRHdr); } } else { assert(DefRange.DataOffset == 0 && "unexpected offset into register"); @@ -2704,14 +2714,15 @@ void CodeViewDebug::emitLocalVariable(const FunctionInfo &FI, DRHdr.Register = DefRange.CVRegister; DRHdr.MayHaveNoName = 0; DRHdr.OffsetInParent = DefRange.StructOffset; - OS.EmitCVDefRangeDirective(DefRange.Ranges, DRHdr); + copyBytesForDefRange(BytePrefix, S_DEFRANGE_SUBFIELD_REGISTER, DRHdr); } else { DefRangeRegisterSym::Header DRHdr; DRHdr.Register = DefRange.CVRegister; DRHdr.MayHaveNoName = 0; - OS.EmitCVDefRangeDirective(DefRange.Ranges, DRHdr); + copyBytesForDefRange(BytePrefix, S_DEFRANGE_REGISTER, DRHdr); } } + OS.EmitCVDefRangeDirective(DefRange.Ranges, BytePrefix); } } |