diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-02-13 09:28:32 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-02-13 09:28:32 +0000 |
commit | a4766d7af91b7e25151b3e97a0831b3615d2abc3 (patch) | |
tree | 9cf18dfab3a5f62e4b251f136a4e18ff0f0bcbde /lib/MC/MCAssembler.cpp | |
parent | 45f48746110f5e6f7e65af7de239333dbd45d1d1 (diff) |
MCAssembler: Switch MCFillFragment to only taking constant values. Symbolic expressions can always be emitted as data + fixups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96092 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCAssembler.cpp')
-rw-r--r-- | lib/MC/MCAssembler.cpp | 52 |
1 files changed, 5 insertions, 47 deletions
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp index c8fa6bd589..7f3930cddf 100644 --- a/lib/MC/MCAssembler.cpp +++ b/lib/MC/MCAssembler.cpp @@ -969,33 +969,10 @@ void MCAssembler::LayoutSection(MCSectionData &SD) { } case MCFragment::FT_Data: + case MCFragment::FT_Fill: F.setFileSize(F.getMaxFileSize()); break; - case MCFragment::FT_Fill: { - MCFillFragment &FF = cast<MCFillFragment>(F); - - F.setFileSize(F.getMaxFileSize()); - - MCValue Target; - if (!FF.getValue().EvaluateAsRelocatable(Target)) - llvm_report_error("expected relocatable expression"); - - // If the fill value is constant, thats it. - if (Target.isAbsolute()) - break; - - // Otherwise, add fixups for the values. - // - // FIXME: What we want to do here is lower this to a data fragment once we - // realize it will need relocations. This means that the only place we - // need to worry about relocations and fixing is on data fragments. - for (uint64_t i = 0, e = FF.getCount(); i != e; ++i) - FF.getFixups().push_back(MCAsmFixup(i*FF.getValueSize(), FF.getValue(), - FF.getValueSize())); - break; - } - case MCFragment::FT_Org: { MCOrgFragment &OF = cast<MCOrgFragment>(F); @@ -1094,33 +1071,14 @@ static void WriteFileData(raw_ostream &OS, const MCFragment &F, case MCFragment::FT_Fill: { MCFillFragment &FF = cast<MCFillFragment>(F); - - int64_t Value = 0; - - MCValue Target; - if (!FF.getValue().EvaluateAsRelocatable(Target)) - llvm_report_error("expected relocatable expression"); - - if (Target.isAbsolute()) - Value = Target.getConstant(); for (uint64_t i = 0, e = FF.getCount(); i != e; ++i) { - if (!Target.isAbsolute()) { - // Find the fixup. - // - // FIXME: Find a better way to write in the fixes (move to - // MCDataFragment). - const MCAsmFixup *Fixup = FF.LookupFixup(i * FF.getValueSize()); - assert(Fixup && "Missing fixup for fill value!"); - Value = Fixup->FixedValue; - } - switch (FF.getValueSize()) { default: assert(0 && "Invalid size!"); - case 1: MOW.Write8 (uint8_t (Value)); break; - case 2: MOW.Write16(uint16_t(Value)); break; - case 4: MOW.Write32(uint32_t(Value)); break; - case 8: MOW.Write64(uint64_t(Value)); break; + case 1: MOW.Write8 (uint8_t (FF.getValue())); break; + case 2: MOW.Write16(uint16_t(FF.getValue())); break; + case 4: MOW.Write32(uint32_t(FF.getValue())); break; + case 8: MOW.Write64(uint64_t(FF.getValue())); break; } } break; |