[llvm] r259700 - [codeview] Remove EmitLabelDiff in favor emitAbsoluteSymbolDiff

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 3 13:24:42 PST 2016


Author: rnk
Date: Wed Feb  3 15:24:42 2016
New Revision: 259700

URL: http://llvm.org/viewvc/llvm-project?rev=259700&view=rev
Log:
[codeview] Remove EmitLabelDiff in favor emitAbsoluteSymbolDiff

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp?rev=259700&r1=259699&r2=259700&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp Wed Feb  3 15:24:42 2016
@@ -312,18 +312,6 @@ void CodeViewDebug::emitInlineeLinesSubs
   OS.EmitLabel(InlineEnd);
 }
 
-static void EmitLabelDiff(MCStreamer &Streamer,
-                          const MCSymbol *From, const MCSymbol *To,
-                          unsigned int Size = 4) {
-  MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
-  MCContext &Context = Streamer.getContext();
-  const MCExpr *FromRef = MCSymbolRefExpr::create(From, Variant, Context),
-               *ToRef   = MCSymbolRefExpr::create(To, Variant, Context);
-  const MCExpr *AddrDelta =
-      MCBinaryExpr::create(MCBinaryExpr::Sub, ToRef, FromRef, Context);
-  Streamer.EmitValue(AddrDelta, Size);
-}
-
 void CodeViewDebug::collectInlineSiteChildren(
     SmallVectorImpl<unsigned> &Children, const FunctionInfo &FI,
     const InlineSite &Site) {
@@ -339,8 +327,6 @@ void CodeViewDebug::collectInlineSiteChi
 void CodeViewDebug::emitInlinedCallSite(const FunctionInfo &FI,
                                         const DILocation *InlinedAt,
                                         const InlineSite &Site) {
-  MCStreamer &OS = *Asm->OutStreamer;
-
   MCSymbol *InlineBegin = Asm->MMI->getContext().createTempSymbol(),
            *InlineEnd = Asm->MMI->getContext().createTempSymbol();
 
@@ -349,7 +335,7 @@ void CodeViewDebug::emitInlinedCallSite(
 
   // SymbolRecord
   OS.AddComment("Record length");
-  EmitLabelDiff(OS, InlineBegin, InlineEnd, 2);   // RecordLength
+  OS.emitAbsoluteSymbolDiff(InlineEnd, InlineBegin, 2);   // RecordLength
   OS.EmitLabel(InlineBegin);
   OS.AddComment("Record kind: S_INLINESITE");
   OS.EmitIntValue(SymbolRecordKind::S_INLINESITE, 2); // RecordKind
@@ -407,13 +393,13 @@ void CodeViewDebug::emitDebugInfoForFunc
   OS.AddComment("Symbol subsection for " + Twine(FuncName));
   OS.EmitIntValue(unsigned(ModuleSubstreamKind::Symbols), 4);
   OS.AddComment("Subsection size");
-  EmitLabelDiff(*Asm->OutStreamer, SymbolsBegin, SymbolsEnd);
+  OS.emitAbsoluteSymbolDiff(SymbolsEnd, SymbolsBegin, 4);
   OS.EmitLabel(SymbolsBegin);
   {
     MCSymbol *ProcRecordBegin = Asm->MMI->getContext().createTempSymbol(),
              *ProcRecordEnd = Asm->MMI->getContext().createTempSymbol();
     OS.AddComment("Record length");
-    EmitLabelDiff(*Asm->OutStreamer, ProcRecordBegin, ProcRecordEnd, 2);
+    OS.emitAbsoluteSymbolDiff(ProcRecordEnd, ProcRecordBegin, 2);
     OS.EmitLabel(ProcRecordBegin);
 
     OS.AddComment("Record kind: S_GPROC32_ID");
@@ -429,7 +415,7 @@ void CodeViewDebug::emitDebugInfoForFunc
     // This is the important bit that tells the debugger where the function
     // code is located and what's its size:
     OS.AddComment("Code size");
-    EmitLabelDiff(*Asm->OutStreamer, Fn, FI.End);
+    OS.emitAbsoluteSymbolDiff(FI.End, Fn, 4);
     OS.AddComment("Offset after prologue");
     OS.EmitIntValue(0, 4);
     OS.AddComment("Offset before epilogue");




More information about the llvm-commits mailing list