diff options
author | Reid Kleckner <rnk@google.com> | 2018-08-28 23:25:59 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2018-08-28 23:25:59 +0000 |
commit | 689f7733173c4a7757f10bc7442905c18274f288 (patch) | |
tree | 7525f8a1cd9fea7b4f9e41b69ce027e4c4535240 /llvm/lib/MC/MCObjectStreamer.cpp | |
parent | 35818e27894db154a9c884cb4d203dc84684ef59 (diff) | |
download | bcm5719-llvm-689f7733173c4a7757f10bc7442905c18274f288.tar.gz bcm5719-llvm-689f7733173c4a7757f10bc7442905c18274f288.zip |
[codeview] Clean up machinery for deferring .cv_loc emission
Now that we create the label at the point of the directive, we don't
need to set the "current CV location", and then later when we emit the
next instruction, create a label for it and emit it.
DWARF still defers the labels used in .debug_loc until the next
instruction or value, for reasons unknown.
llvm-svn: 340883
Diffstat (limited to 'llvm/lib/MC/MCObjectStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCObjectStreamer.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index 9a55ac0a84a..019b9348a4e 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -173,7 +173,6 @@ void MCObjectStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size, MCDataFragment *DF = getOrCreateDataFragment(); flushPendingLabels(DF, DF->getContents().size()); - MCCVLineEntry::Make(this); MCDwarfLineEntry::Make(this, getCurrentSectionOnly()); // Avoid fixups when possible. @@ -270,7 +269,6 @@ bool MCObjectStreamer::changeSectionImpl(MCSection *Section, const MCExpr *Subsection) { assert(Section && "Cannot switch to a null section!"); flushPendingLabels(nullptr); - getContext().clearCVLocSeen(); getContext().clearDwarfLocSeen(); bool Created = getAssembler().registerSection(*Section); @@ -311,7 +309,6 @@ void MCObjectStreamer::EmitInstructionImpl(const MCInst &Inst, // Now that a machine instruction has been assembled into this section, make // a line entry for any .loc directive that has been seen. - MCCVLineEntry::Make(this); MCDwarfLineEntry::Make(this, getCurrentSectionOnly()); // If this instruction doesn't need relaxation, just emit it as data. @@ -446,12 +443,16 @@ void MCObjectStreamer::EmitCVLocDirective(unsigned FunctionId, unsigned FileNo, unsigned Line, unsigned Column, bool PrologueEnd, bool IsStmt, StringRef FileName, SMLoc Loc) { - // Unlike dwarf locations, we don't save the MCCVLineEntry until the next - // instruction. We create the label exactly where the directive appears in the - // assembly. - this->MCStreamer::EmitCVLocDirective(FunctionId, FileNo, Line, Column, - PrologueEnd, IsStmt, FileName, Loc); - MCCVLineEntry::Make(this); + // Validate the directive. + if (!checkCVLocSection(FunctionId, FileNo, Loc)) + return; + + // Emit a label at the current position and record it in the CodeViewContext. + MCSymbol *LineSym = getContext().createTempSymbol(); + EmitLabel(LineSym); + getContext().getCVContext().recordCVLoc(getContext(), LineSym, FunctionId, + FileNo, Line, Column, PrologueEnd, + IsStmt); } void MCObjectStreamer::EmitCVLinetableDirective(unsigned FunctionId, @@ -491,7 +492,6 @@ void MCObjectStreamer::EmitCVFileChecksumOffsetDirective(unsigned FileNo) { } void MCObjectStreamer::EmitBytes(StringRef Data) { - MCCVLineEntry::Make(this); MCDwarfLineEntry::Make(this, getCurrentSectionOnly()); MCDataFragment *DF = getOrCreateDataFragment(); flushPendingLabels(DF, DF->getContents().size()); |