diff options
author | Eric Christopher <echristo@gmail.com> | 2019-08-02 19:10:37 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2019-08-02 19:10:37 +0000 |
commit | 5fb56b1966550857bd8ea3261ee69f0160355f15 (patch) | |
tree | bc75893085685c5910c87dd5cf50f600882622e7 /llvm/lib/MC | |
parent | 98264863254d29deeb45bcbbdb298f246308d673 (diff) | |
download | bcm5719-llvm-5fb56b1966550857bd8ea3261ee69f0160355f15.tar.gz bcm5719-llvm-5fb56b1966550857bd8ea3261ee69f0160355f15.zip |
Temporarily Revert "Changing representation of cv_def_range directives in Codeview debug info assembly format for better readability"
This is breaking bots and the author asked me to revert.
This reverts commit 367704.
llvm-svn: 367707
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r-- | llvm/lib/MC/MCAsmStreamer.cpp | 63 | ||||
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 114 | ||||
-rw-r--r-- | llvm/lib/MC/MCStreamer.cpp | 46 |
3 files changed, 14 insertions, 209 deletions
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp index c0890b59fe3..7a2b0b8a122 100644 --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/lib/MC/MCAsmStreamer.cpp @@ -254,26 +254,9 @@ public: unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym) override; - - void PrintCVDefRangePrefix( - ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges); - - void EmitCVDefRangeDirective( - ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges, - codeview::DefRangeRegisterRelSym::Header DRHdr) override; - void EmitCVDefRangeDirective( ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges, - codeview::DefRangeSubfieldRegisterSym::Header DRHdr) override; - - void EmitCVDefRangeDirective( - ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges, - codeview::DefRangeRegisterSym::Header DRHdr) override; - - void EmitCVDefRangeDirective( - ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges, - codeview::DefRangeFramePointerRelSym::Header DRHdr) override; - + StringRef FixedSizePortion) override; void EmitCVStringTableDirective() override; void EmitCVFileChecksumsDirective() override; void EmitCVFileChecksumOffsetDirective(unsigned FileNo) override; @@ -1393,8 +1376,9 @@ void MCAsmStreamer::EmitCVInlineLinetableDirective(unsigned PrimaryFunctionId, PrimaryFunctionId, SourceFileId, SourceLineNum, FnStartSym, FnEndSym); } -void MCAsmStreamer::PrintCVDefRangePrefix( - ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges) { +void MCAsmStreamer::EmitCVDefRangeDirective( + ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges, + StringRef FixedSizePortion) { OS << "\t.cv_def_range\t"; for (std::pair<const MCSymbol *, const MCSymbol *> Range : Ranges) { OS << ' '; @@ -1402,43 +1386,10 @@ void MCAsmStreamer::PrintCVDefRangePrefix( OS << ' '; Range.second->print(OS, MAI); } -} - -void MCAsmStreamer::EmitCVDefRangeDirective( - ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges, - codeview::DefRangeRegisterRelSym::Header DRHdr) { - PrintCVDefRangePrefix(Ranges); - OS << ", reg_rel, "; - OS << DRHdr.Register << ", " << DRHdr.Flags << ", " - << DRHdr.BasePointerOffset; - EmitEOL(); -} - -void MCAsmStreamer::EmitCVDefRangeDirective( - ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges, - codeview::DefRangeSubfieldRegisterSym::Header DRHdr) { - PrintCVDefRangePrefix(Ranges); - OS << ", subfield_reg, "; - OS << DRHdr.Register << ", " << DRHdr.OffsetInParent; - EmitEOL(); -} - -void MCAsmStreamer::EmitCVDefRangeDirective( - ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges, - codeview::DefRangeRegisterSym::Header DRHdr) { - PrintCVDefRangePrefix(Ranges); - OS << ", reg, "; - OS << DRHdr.Register; - EmitEOL(); -} - -void MCAsmStreamer::EmitCVDefRangeDirective( - ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges, - codeview::DefRangeFramePointerRelSym::Header DRHdr) { - PrintCVDefRangePrefix(Ranges); - OS << ", frame_ptr_rel, "; - OS << DRHdr.Offset; + OS << ", "; + PrintQuotedString(FixedSizePortion, OS); EmitEOL(); + this->MCStreamer::EmitCVDefRangeDirective(Ranges, FixedSizePortion); } void MCAsmStreamer::EmitCVStringTableDirective() { diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 2740a6875f6..084f6a7a2e1 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -524,19 +524,6 @@ private: /// directives parsed by this class. StringMap<DirectiveKind> DirectiveKindMap; - // Codeview def_range type parsing. - enum CVDefRangeType { - CVDR_DEFRANGE = 0, // Placeholder - CVDR_DEFRANGE_REGISTER, - CVDR_DEFRANGE_FRAMEPOINTER_REL, - CVDR_DEFRANGE_SUBFIELD_REGISTER, - CVDR_DEFRANGE_REGISTER_REL - }; - - /// Maps Codeview def_range types --> CVDefRangeType enum, for - /// Codeview def_range types parsed by this class. - StringMap<CVDefRangeType> CVDefRangeTypeMap; - // ".ascii", ".asciz", ".string" bool parseDirectiveAscii(StringRef IDVal, bool ZeroTerminated); bool parseDirectiveReloc(SMLoc DirectiveLoc); // ".reloc" @@ -684,7 +671,6 @@ private: bool parseDirectiveAddrsigSym(); void initializeDirectiveKindMap(); - void initializeCVDefRangeTypeMap(); }; } // end anonymous namespace @@ -734,7 +720,6 @@ AsmParser::AsmParser(SourceMgr &SM, MCContext &Ctx, MCStreamer &Out, PlatformParser->Initialize(*this); initializeDirectiveKindMap(); - initializeCVDefRangeTypeMap(); NumOfMacroInstantiations = 0; } @@ -1752,7 +1737,6 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info, StringMap<DirectiveKind>::const_iterator DirKindIt = DirectiveKindMap.find(IDVal); DirectiveKind DirKind = (DirKindIt == DirectiveKindMap.end()) - ? DK_NO_DIRECTIVE : DirKindIt->getValue(); switch (DirKind) { @@ -3841,13 +3825,6 @@ bool AsmParser::parseDirectiveCVInlineLinetable() { return false; } -void AsmParser::initializeCVDefRangeTypeMap() { - CVDefRangeTypeMap["reg"] = CVDR_DEFRANGE_REGISTER; - CVDefRangeTypeMap["frame_ptr_rel"] = CVDR_DEFRANGE_FRAMEPOINTER_REL; - CVDefRangeTypeMap["subfield_reg"] = CVDR_DEFRANGE_SUBFIELD_REGISTER; - CVDefRangeTypeMap["reg_rel"] = CVDR_DEFRANGE_REGISTER_REL; -} - /// parseDirectiveCVDefRange /// ::= .cv_def_range RangeStart RangeEnd (GapStart GapEnd)*, bytes* bool AsmParser::parseDirectiveCVDefRange() { @@ -3869,90 +3846,13 @@ bool AsmParser::parseDirectiveCVDefRange() { Ranges.push_back({GapStartSym, GapEndSym}); } - StringRef CVDefRangeTypeStr; - if (parseToken( - AsmToken::Comma, - "expected comma before def_range type in .cv_def_range directive") || - parseIdentifier(CVDefRangeTypeStr)) - return Error(Loc, "expected def_range type in directive"); - - StringMap<CVDefRangeType>::const_iterator CVTypeIt = - CVDefRangeTypeMap.find(CVDefRangeTypeStr); - CVDefRangeType CVDRType = (CVTypeIt == CVDefRangeTypeMap.end()) - ? CVDR_DEFRANGE - : CVTypeIt->getValue(); - switch (CVDRType) { - case CVDR_DEFRANGE_REGISTER: { - int64_t DRRegister; - if (parseToken(AsmToken::Comma, "expected comma before register number in " - ".cv_def_range directive") || - parseAbsoluteExpression(DRRegister)) - return Error(Loc, "expected register number"); - - codeview::DefRangeRegisterSym::Header DRHdr; - DRHdr.Register = DRRegister; - getStreamer().EmitCVDefRangeDirective(Ranges, DRHdr); - break; - } - case CVDR_DEFRANGE_FRAMEPOINTER_REL: { - int64_t DROffset; - if (parseToken(AsmToken::Comma, - "expected comma before offset in .cv_def_range directive") || - parseAbsoluteExpression(DROffset)) - return Error(Loc, "expected offset value"); - - codeview::DefRangeFramePointerRelSym::Header DRHdr; - DRHdr.Offset = DROffset; - getStreamer().EmitCVDefRangeDirective(Ranges, DRHdr); - break; - } - case CVDR_DEFRANGE_SUBFIELD_REGISTER: { - int64_t DRRegister; - int64_t DROffsetInParent; - if (parseToken(AsmToken::Comma, "expected comma before register number in " - ".cv_def_range directive") || - parseAbsoluteExpression(DRRegister)) - return Error(Loc, "expected register number"); - if (parseToken(AsmToken::Comma, - "expected comma before offset in .cv_def_range directive") || - parseAbsoluteExpression(DROffsetInParent)) - return Error(Loc, "expected offset value"); - - codeview::DefRangeSubfieldRegisterSym::Header DRHdr; - DRHdr.Register = DRRegister; - DRHdr.OffsetInParent = DROffsetInParent; - getStreamer().EmitCVDefRangeDirective(Ranges, DRHdr); - break; - } - case CVDR_DEFRANGE_REGISTER_REL: { - int64_t DRRegister; - int64_t DRFlags; - int64_t DRBasePointerOffset; - if (parseToken(AsmToken::Comma, "expected comma before register number in " - ".cv_def_range directive") || - parseAbsoluteExpression(DRRegister)) - return Error(Loc, "expected register value"); - if (parseToken( - AsmToken::Comma, - "expected comma before flag value in .cv_def_range directive") || - parseAbsoluteExpression(DRFlags)) - return Error(Loc, "expected flag value"); - if (parseToken(AsmToken::Comma, "expected comma before base pointer offset " - "in .cv_def_range directive") || - parseAbsoluteExpression(DRBasePointerOffset)) - return Error(Loc, "expected base pointer offset value"); - - codeview::DefRangeRegisterRelSym::Header DRHdr; - DRHdr.Register = DRRegister; - DRHdr.Flags = DRFlags; - DRHdr.BasePointerOffset = DRBasePointerOffset; - getStreamer().EmitCVDefRangeDirective(Ranges, DRHdr); - break; - } - default: - return Error(Loc, "unexpected def_range type in .cv_def_range directive"); - } - return true; + std::string FixedSizePortion; + if (parseToken(AsmToken::Comma, "unexpected token in directive") || + parseEscapedString(FixedSizePortion)) + return true; + + getStreamer().EmitCVDefRangeDirective(Ranges, FixedSizePortion); + return false; } /// parseDirectiveCVString diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index 254eb2cd7b6..decbb96817e 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -327,56 +327,10 @@ 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) { } |