diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-12-03 02:54:21 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-12-03 02:54:21 +0000 |
commit | 2df042cb32ecb8d2e1d499dfa27d5074c8b40e13 (patch) | |
tree | d807e249227d692d07520e298c1c78fb0953051e /lib/MC/MCObjectStreamer.cpp | |
parent | 6cfab3748ce62067f7ca9b731295e8b39fd72258 (diff) |
Make EmitIntValue more efficient and more like what we do for leb128. The
difference is much smaller (about 0.3s) but significant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120787 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCObjectStreamer.cpp')
-rw-r--r-- | lib/MC/MCObjectStreamer.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/MC/MCObjectStreamer.cpp b/lib/MC/MCObjectStreamer.cpp index f6753e3d1e..1538a58996 100644 --- a/lib/MC/MCObjectStreamer.cpp +++ b/lib/MC/MCObjectStreamer.cpp @@ -83,16 +83,14 @@ void MCObjectStreamer::EmitValue(const MCExpr *Value, unsigned Size, // Avoid fixups when possible. int64_t AbsValue; - if (AddValueSymbols(Value)->EvaluateAsAbsolute(AbsValue)) { - // FIXME: Endianness assumption. - for (unsigned i = 0; i != Size; ++i) - DF->getContents().push_back(uint8_t(AbsValue >> (i * 8))); - } else { - DF->addFixup(MCFixup::Create(DF->getContents().size(), - AddValueSymbols(Value), - MCFixup::getKindForSize(Size, false))); - DF->getContents().resize(DF->getContents().size() + Size, 0); + if (AddValueSymbols(Value)->EvaluateAsAbsolute(AbsValue, &getAssembler())) { + EmitIntValue(AbsValue, Size, AddrSpace); + return; } + DF->addFixup(MCFixup::Create(DF->getContents().size(), + AddValueSymbols(Value), + MCFixup::getKindForSize(Size, false))); + DF->getContents().resize(DF->getContents().size() + Size, 0); } void MCObjectStreamer::EmitLabel(MCSymbol *Symbol) { |