add a EmitSymbolValue convenience method to MCStreamer.
authorChris Lattner <sabre@nondot.org>
Tue, 9 Mar 2010 00:39:24 +0000 (00:39 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 9 Mar 2010 00:39:24 +0000 (00:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98017 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCStreamer.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
lib/MC/MCStreamer.cpp

index 696d024aa85a6d6ce7d34165d95743365c1a8cab..6359ccefe63a394e09ed88cc0178c3d302ff0483 100644 (file)
@@ -191,6 +191,11 @@ namespace llvm {
     /// EmitIntValue - Special case of EmitValue that avoids the client having
     /// to pass in a MCExpr for constant integers.
     virtual void EmitIntValue(uint64_t Value, unsigned Size,unsigned AddrSpace);
+
+    /// EmitSymbolValue - Special case of EmitValue that avoids the client
+    /// having to pass in a MCExpr for MCSymbols.
+    virtual void EmitSymbolValue(const MCSymbol *Sym, unsigned Size,
+                                 unsigned AddrSpace);
     
     /// EmitGPRel32Value - Emit the expression @p Value into the output as a
     /// gprel32 (32-bit GP relative) value.
index 5db2b0749d566fd857150c694031940ad34fb648..246538b8c202dce001a263b9b378d08fd870483a 100644 (file)
@@ -914,9 +914,7 @@ void AsmPrinter::EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo,
     OutContext.GetOrCreateSymbol(Twine(MAI->getPrivateGlobalPrefix()) + "set" +
                                  Twine(SetCounter++));
   OutStreamer.EmitAssignment(SetLabel, Diff);
-  
-  OutStreamer.EmitValue(MCSymbolRefExpr::Create(SetLabel, OutContext),
-                        Size, 0/*AddrSpace*/);
+  OutStreamer.EmitSymbolValue(SetLabel, Size, 0/*AddrSpace*/);
 }
 
 
index 7ca94de980d58ed56eeacb6322e1a228ebde7568..8272eabe8458674669128f8ecdfc4afe24978ade 100644 (file)
 // This file contains support for writing dwarf debug info into asm files.
 //
 //===----------------------------------------------------------------------===//
+
 #define DEBUG_TYPE "dwarfdebug"
 #include "DwarfDebug.h"
 #include "llvm/Module.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
-#include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCSection.h"
 #include "llvm/MC/MCStreamer.h"
 #include "llvm/MC/MCAsmInfo.h"
@@ -2970,9 +2970,7 @@ void DwarfDebug::emitDebugInlineInfo() {
       Asm->EmitInt32(LI->second->getOffset());
 
       if (Asm->VerboseAsm) Asm->OutStreamer.AddComment("low_pc");
-      Asm->OutStreamer.EmitValue(MCSymbolRefExpr::Create(LI->first,
-                                                         Asm->OutContext),
-                                 TD->getPointerSize(), 0/*AddrSpace*/);
+      Asm->OutStreamer.EmitSymbolValue(LI->first, TD->getPointerSize(), 0);
     }
   }
 
index 3eee56181e1daf67f7de81de6e71b5ecad18bb5c..d0f2a60bcf2db6dd783d68d86d944eb93d100a03 100644 (file)
@@ -258,8 +258,7 @@ void DwarfPrinter::EmitSectionOffset(const MCSymbol *Label,
     O << SecOffDir << Label->getName();
   else {
     unsigned Size = IsSmall ? 4 : TD->getPointerSize();
-    Asm->OutStreamer.EmitValue(MCSymbolRefExpr::Create(Label, Asm->OutContext),
-                               Size, 0/*AddrSpace*/);
+    Asm->OutStreamer.EmitSymbolValue(Label, Size, 0/*AddrSpace*/);
   }
 }
 
index 15b30794d91e20f0a9fa5e774263899cbb0f97d7..703acc4e59911775b837ed9b6fe96ef92f63e8cb 100644 (file)
@@ -31,6 +31,11 @@ void MCStreamer::EmitIntValue(uint64_t Value, unsigned Size,
   EmitValue(MCConstantExpr::Create(Value, getContext()), Size, AddrSpace);
 }
 
+void MCStreamer::EmitSymbolValue(const MCSymbol *Sym, unsigned Size,
+                                 unsigned AddrSpace) {
+  EmitValue(MCSymbolRefExpr::Create(Sym, getContext()), Size, AddrSpace);
+}
+
 /// EmitFill - Emit NumBytes bytes worth of the value specified by
 /// FillValue.  This implements directives such as '.space'.
 void MCStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue,