diff options
author | Zachary Turner <zturner@google.com> | 2016-05-17 23:50:21 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-05-17 23:50:21 +0000 |
commit | 63a2846e84794b1bd381d5a7d2970e1f0595b6f6 (patch) | |
tree | e744577a5840aefa01213100ff87f1e638a895b8 /llvm/lib | |
parent | bc619cde52348dcaa9ad5d19a1ca1ff68a60e529 (diff) | |
download | bcm5719-llvm-63a2846e84794b1bd381d5a7d2970e1f0595b6f6.tar.gz bcm5719-llvm-63a2846e84794b1bd381d5a7d2970e1f0595b6f6.zip |
[codeview] Some cleanup of Symbol Records.
* Reworks the CVSymbolTypes.def to work similarly to TypeRecords.def.
* Moves some enums from SymbolRecords.h to CodeView.h to maintain
consistency with how we do type records.
* Generalize a few simple things like the record prefix
* Define the leaf enum and the kind enum similar to how we do with tyep
records.
Differential Revision: http://reviews.llvm.org/D20342
Reviewed By: amccarth, rnk
llvm-svn: 269867
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 18 | ||||
-rw-r--r-- | llvm/lib/MC/MCCodeView.cpp | 20 |
2 files changed, 22 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 5f1e6714ba7..b5c796a01bd 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -379,7 +379,7 @@ void CodeViewDebug::emitInlinedCallSite(const FunctionInfo &FI, OS.emitAbsoluteSymbolDiff(InlineEnd, InlineBegin, 2); // RecordLength OS.EmitLabel(InlineBegin); OS.AddComment("Record kind: S_INLINESITE"); - OS.EmitIntValue(SymbolRecordKind::S_INLINESITE, 2); // RecordKind + OS.EmitIntValue(SymbolKind::S_INLINESITE, 2); // RecordKind OS.AddComment("PtrParent"); OS.EmitIntValue(0, 4); @@ -413,7 +413,7 @@ void CodeViewDebug::emitInlinedCallSite(const FunctionInfo &FI, OS.AddComment("Record length"); OS.EmitIntValue(2, 2); // RecordLength OS.AddComment("Record kind: S_INLINESITE_END"); - OS.EmitIntValue(SymbolRecordKind::S_INLINESITE_END, 2); // RecordKind + OS.EmitIntValue(SymbolKind::S_INLINESITE_END, 2); // RecordKind } void CodeViewDebug::emitDebugInfoForFunction(const Function *GV, @@ -447,7 +447,7 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV, OS.EmitLabel(ProcRecordBegin); OS.AddComment("Record kind: S_GPROC32_ID"); - OS.EmitIntValue(unsigned(SymbolRecordKind::S_GPROC32_ID), 2); + OS.EmitIntValue(unsigned(SymbolKind::S_GPROC32_ID), 2); // These fields are filled in by tools like CVPACK which run after the fact. OS.AddComment("PtrParent"); @@ -495,7 +495,7 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV, OS.AddComment("Record length"); OS.EmitIntValue(0x0002, 2); OS.AddComment("Record kind: S_PROC_ID_END"); - OS.EmitIntValue(unsigned(SymbolRecordKind::S_PROC_ID_END), 2); + OS.EmitIntValue(unsigned(SymbolKind::S_PROC_ID_END), 2); } OS.EmitLabel(SymbolsEnd); // Every subsection must be aligned to a 4-byte boundary. @@ -707,18 +707,18 @@ void CodeViewDebug::emitLocalVariable(const LocalVariable &Var) { OS.EmitLabel(LocalBegin); OS.AddComment("Record kind: S_LOCAL"); - OS.EmitIntValue(unsigned(SymbolRecordKind::S_LOCAL), 2); + OS.EmitIntValue(unsigned(SymbolKind::S_LOCAL), 2); - uint16_t Flags = 0; + LocalSymFlags Flags = LocalSymFlags::None; if (Var.DIVar->isParameter()) - Flags |= LocalSym::IsParameter; + Flags |= LocalSymFlags::IsParameter; if (Var.DefRanges.empty()) - Flags |= LocalSym::IsOptimizedOut; + Flags |= LocalSymFlags::IsOptimizedOut; OS.AddComment("TypeIndex"); OS.EmitIntValue(TypeIndex::Int32().getIndex(), 4); OS.AddComment("Flags"); - OS.EmitIntValue(Flags, 2); + OS.EmitIntValue(static_cast<uint16_t>(Flags), 2); // Truncate the name so we won't overflow the record length field. emitNullTerminatedSymbolName(OS, Var.DIVar->getName()); OS.EmitLabel(LocalEnd); diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp index cd19e6aa773..8ae0187237a 100644 --- a/llvm/lib/MC/MCCodeView.cpp +++ b/llvm/lib/MC/MCCodeView.cpp @@ -220,6 +220,11 @@ static bool compressAnnotation(uint32_t Data, SmallVectorImpl<char> &Buffer) { return false; } +static bool compressAnnotation(BinaryAnnotationsOpCode Annotation, + SmallVectorImpl<char> &Buffer) { + return compressAnnotation(static_cast<uint32_t>(Annotation), Buffer); +} + static uint32_t encodeSignedNumber(uint32_t Data) { if (Data >> 31) return ((-Data) << 1) | 1; @@ -302,7 +307,7 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout, if (WithinFunction) { unsigned Length = computeLabelDiff(Layout, LastLoc->getLabel(), Loc.getLabel()); - compressAnnotation(ChangeCodeLength, Buffer); + compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeLength, Buffer); compressAnnotation(Length, Buffer); } WithinFunction = false; @@ -314,7 +319,7 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout, // File ids are 1 based, and each file checksum table entry is 8 bytes // long. See emitFileChecksums above. unsigned FileOffset = 8 * (Loc.getFileNum() - 1); - compressAnnotation(ChangeFile, Buffer); + compressAnnotation(BinaryAnnotationsOpCode::ChangeFile, Buffer); compressAnnotation(FileOffset, Buffer); } @@ -326,20 +331,21 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout, unsigned CodeDelta = computeLabelDiff(Layout, LastLoc->getLabel(), Loc.getLabel()); if (CodeDelta == 0) { - compressAnnotation(ChangeLineOffset, Buffer); + compressAnnotation(BinaryAnnotationsOpCode::ChangeLineOffset, Buffer); compressAnnotation(EncodedLineDelta, Buffer); } else if (EncodedLineDelta < 0x8 && CodeDelta <= 0xf) { // The ChangeCodeOffsetAndLineOffset combination opcode is used when the // encoded line delta uses 3 or fewer set bits and the code offset fits // in one nibble. unsigned Operand = (EncodedLineDelta << 4) | CodeDelta; - compressAnnotation(ChangeCodeOffsetAndLineOffset, Buffer); + compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeOffsetAndLineOffset, + Buffer); compressAnnotation(Operand, Buffer); } else { // Otherwise use the separate line and code deltas. - compressAnnotation(ChangeLineOffset, Buffer); + compressAnnotation(BinaryAnnotationsOpCode::ChangeLineOffset, Buffer); compressAnnotation(EncodedLineDelta, Buffer); - compressAnnotation(ChangeCodeOffset, Buffer); + compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeOffset, Buffer); compressAnnotation(CodeDelta, Buffer); } @@ -362,7 +368,7 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout, } } - compressAnnotation(ChangeCodeLength, Buffer); + compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeLength, Buffer); compressAnnotation(std::min(EndSymLength, LocAfterLength), Buffer); } |