diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-11-28 23:22:44 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-11-28 23:22:44 +0000 |
commit | ec0b428398c5fb91fdce5d3d003ab0e4b75b5d6a (patch) | |
tree | 2793c663c262a1b2b6eb0e719a4d9e880414ecff /lib/MC/MCAsmStreamer.cpp | |
parent | f7c3b75bc52e66f80842687f445dec51a7a23c64 (diff) | |
download | llvm-ec0b428398c5fb91fdce5d3d003ab0e4b75b5d6a.tar.gz llvm-ec0b428398c5fb91fdce5d3d003ab0e4b75b5d6a.tar.bz2 llvm-ec0b428398c5fb91fdce5d3d003ab0e4b75b5d6a.tar.xz |
Make EmitIntValue non virtual.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120271 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCAsmStreamer.cpp')
-rw-r--r-- | lib/MC/MCAsmStreamer.cpp | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp index 8ee5542d36..c03f969e85 100644 --- a/lib/MC/MCAsmStreamer.cpp +++ b/lib/MC/MCAsmStreamer.cpp @@ -149,8 +149,6 @@ public: virtual void EmitValue(const MCExpr *Value, unsigned Size,unsigned AddrSpace); - virtual void EmitIntValue(uint64_t Value, unsigned Size, unsigned AddrSpace); - virtual void EmitULEB128Value(const MCExpr *Value, unsigned AddrSpace = 0); virtual void EmitSLEB128Value(const MCExpr *Value, unsigned AddrSpace = 0); @@ -496,10 +494,8 @@ void MCAsmStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) { EmitEOL(); } -/// EmitIntValue - Special case of EmitValue that avoids the client having -/// to pass in a MCExpr for constant integers. -void MCAsmStreamer::EmitIntValue(uint64_t Value, unsigned Size, - unsigned AddrSpace) { +void MCAsmStreamer::EmitValue(const MCExpr *Value, unsigned Size, + unsigned AddrSpace) { assert(CurSection && "Cannot emit contents before setting section!"); const char *Directive = 0; switch (Size) { @@ -511,34 +507,20 @@ void MCAsmStreamer::EmitIntValue(uint64_t Value, unsigned Size, Directive = MAI.getData64bitsDirective(AddrSpace); // If the target doesn't support 64-bit data, emit as two 32-bit halves. if (Directive) break; + int64_t IntValue; + if (!Value->EvaluateAsAbsolute(IntValue)) + report_fatal_error("Don't know how to emit this value."); if (isLittleEndian()) { - EmitIntValue((uint32_t)(Value >> 0 ), 4, AddrSpace); - EmitIntValue((uint32_t)(Value >> 32), 4, AddrSpace); + EmitIntValue((uint32_t)(IntValue >> 0 ), 4, AddrSpace); + EmitIntValue((uint32_t)(IntValue >> 32), 4, AddrSpace); } else { - EmitIntValue((uint32_t)(Value >> 32), 4, AddrSpace); - EmitIntValue((uint32_t)(Value >> 0 ), 4, AddrSpace); + EmitIntValue((uint32_t)(IntValue >> 32), 4, AddrSpace); + EmitIntValue((uint32_t)(IntValue >> 0 ), 4, AddrSpace); } return; } assert(Directive && "Invalid size for machine code value!"); - OS << Directive << truncateToSize(Value, Size); - EmitEOL(); -} - -void MCAsmStreamer::EmitValue(const MCExpr *Value, unsigned Size, - unsigned AddrSpace) { - assert(CurSection && "Cannot emit contents before setting section!"); - const char *Directive = 0; - switch (Size) { - default: break; - case 1: Directive = MAI.getData8bitsDirective(AddrSpace); break; - case 2: Directive = MAI.getData16bitsDirective(AddrSpace); break; - case 4: Directive = MAI.getData32bitsDirective(AddrSpace); break; - case 8: Directive = MAI.getData64bitsDirective(AddrSpace); break; - } - - assert(Directive && "Invalid size for machine code value!"); OS << Directive << *Value; EmitEOL(); } |