From a4b23ffced8cc7ac2d856f0bd1e4b8b2a12f18e5 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 19 Nov 2010 04:10:13 +0000 Subject: [PATCH] Fix llvm-gcc boostrap on OS X by avoiding printing sleb and uleb when possible. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119785 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCAsmStreamer.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp index b3c47367056..97cfb217d21 100644 --- a/lib/MC/MCAsmStreamer.cpp +++ b/lib/MC/MCAsmStreamer.cpp @@ -535,12 +535,28 @@ void MCAsmStreamer::EmitValue(const MCExpr *Value, unsigned Size, } void MCAsmStreamer::EmitULEB128Value(const MCExpr *Value, unsigned AddrSpace) { + int64_t IntValue; + if (Value->EvaluateAsAbsolute(IntValue)) { + SmallString<32> Tmp; + raw_svector_ostream OSE(Tmp); + MCObjectWriter::EncodeULEB128(IntValue, OSE); + EmitBytes(OSE.str(), AddrSpace); + return; + } assert(MAI.hasLEB128() && "Cannot print a .uleb"); OS << ".uleb128 " << *Value; EmitEOL(); } void MCAsmStreamer::EmitSLEB128Value(const MCExpr *Value, unsigned AddrSpace) { + int64_t IntValue; + if (Value->EvaluateAsAbsolute(IntValue)) { + SmallString<32> Tmp; + raw_svector_ostream OSE(Tmp); + MCObjectWriter::EncodeSLEB128(IntValue, OSE); + EmitBytes(OSE.str(), AddrSpace); + return; + } assert(MAI.hasLEB128() && "Cannot print a .sleb"); OS << ".sleb128 " << *Value; EmitEOL();