add a EmitSymbolValue convenience method to MCStreamer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98017 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-03-09 00:39:24 +00:00
parent 6ed0f90dac
commit 6cde3e6e99
5 changed files with 14 additions and 9 deletions

View 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.

View 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*/);
}

View File

@ -10,12 +10,12 @@
// 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);
}
}

View 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*/);
}
}

View 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,