diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-05-26 15:18:56 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-05-26 15:18:56 +0000 |
commit | c90e30aa6f3792a460202017523171f435e2ba34 (patch) | |
tree | 64b89bfe8da26c13607117554d4cf01ca98e0acc /lib/MC | |
parent | 0dd0c941c9eb4adc13319ed7adcaffe58a68d294 (diff) | |
download | external_llvm-c90e30aa6f3792a460202017523171f435e2ba34.zip external_llvm-c90e30aa6f3792a460202017523171f435e2ba34.tar.gz external_llvm-c90e30aa6f3792a460202017523171f435e2ba34.tar.bz2 |
MC: Eliminate MCAsmFixup, replace with MCFixup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r-- | lib/MC/MCAssembler.cpp | 22 | ||||
-rw-r--r-- | lib/MC/MCMachOStreamer.cpp | 14 | ||||
-rw-r--r-- | lib/MC/MachObjectWriter.cpp | 8 |
3 files changed, 20 insertions, 24 deletions
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp index de04d2b..705521d 100644 --- a/lib/MC/MCAssembler.cpp +++ b/lib/MC/MCAssembler.cpp @@ -226,7 +226,7 @@ MCAssembler::~MCAssembler() { } static bool isScatteredFixupFullyResolvedSimple(const MCAssembler &Asm, - const MCAsmFixup &Fixup, + const MCFixup &Fixup, const MCValue Target, const MCSection *BaseSection) { // The effective fixup address is @@ -264,7 +264,7 @@ static bool isScatteredFixupFullyResolvedSimple(const MCAssembler &Asm, static bool isScatteredFixupFullyResolved(const MCAssembler &Asm, const MCAsmLayout &Layout, - const MCAsmFixup &Fixup, + const MCFixup &Fixup, const MCValue Target, const MCSymbolData *BaseSymbol) { // The effective fixup address is @@ -343,7 +343,7 @@ const MCSymbolData *MCAssembler::getAtom(const MCAsmLayout &Layout, } bool MCAssembler::EvaluateFixup(const MCAsmLayout &Layout, - const MCAsmFixup &Fixup, const MCFragment *DF, + const MCFixup &Fixup, const MCFragment *DF, MCValue &Target, uint64_t &Value) const { ++stats::EvaluateFixup; @@ -740,7 +740,7 @@ void MCAssembler::Finish() { for (MCDataFragment::fixup_iterator it3 = DF->fixup_begin(), ie3 = DF->fixup_end(); it3 != ie3; ++it3) { - MCAsmFixup &Fixup = *it3; + MCFixup &Fixup = *it3; // Evaluate the fixup. MCValue Target; @@ -764,7 +764,7 @@ void MCAssembler::Finish() { stats::ObjectBytes += OS.tell() - StartOffset; } -bool MCAssembler::FixupNeedsRelaxation(const MCAsmFixup &Fixup, +bool MCAssembler::FixupNeedsRelaxation(const MCFixup &Fixup, const MCFragment *DF, const MCAsmLayout &Layout) const { if (getRelaxAll()) @@ -841,11 +841,9 @@ bool MCAssembler::LayoutOnce(MCAsmLayout &Layout) { IF->setInst(Relaxed); IF->getCode() = Code; IF->getFixups().clear(); - for (unsigned i = 0, e = Fixups.size(); i != e; ++i) { - MCFixup &F = Fixups[i]; - IF->getFixups().push_back(MCAsmFixup(F.getOffset(), *F.getValue(), - F.getKind())); - } + // FIXME: Eliminate copy. + for (unsigned i = 0, e = Fixups.size(); i != e; ++i) + IF->getFixups().push_back(Fixups[i]); // Update the layout, and remember that we relaxed. If we are relaxing // everything, we can skip this step since nothing will depend on updating @@ -904,8 +902,8 @@ void MCAssembler::FinishLayout(MCAsmLayout &Layout) { namespace llvm { -raw_ostream &operator<<(raw_ostream &OS, const MCAsmFixup &AF) { - OS << "<MCAsmFixup" << " Offset:" << AF.getOffset() +raw_ostream &operator<<(raw_ostream &OS, const MCFixup &AF) { + OS << "<MCFixup" << " Offset:" << AF.getOffset() << " Value:" << *AF.getValue() << " Kind:" << AF.getKind() << ">"; return OS; diff --git a/lib/MC/MCMachOStreamer.cpp b/lib/MC/MCMachOStreamer.cpp index eaa89fa..f49acf2 100644 --- a/lib/MC/MCMachOStreamer.cpp +++ b/lib/MC/MCMachOStreamer.cpp @@ -376,8 +376,9 @@ void MCMachOStreamer::EmitValue(const MCExpr *Value, unsigned Size, for (unsigned i = 0; i != Size; ++i) DF->getContents().push_back(uint8_t(AbsValue >> (i * 8))); } else { - DF->addFixup(MCAsmFixup(DF->getContents().size(), *AddValueSymbols(Value), - MCFixup::getKindForSize(Size))); + DF->addFixup(MCFixup::Create(DF->getContents().size(), + AddValueSymbols(Value), + MCFixup::getKindForSize(Size))); DF->getContents().resize(DF->getContents().size() + Size, 0); } } @@ -434,12 +435,9 @@ void MCMachOStreamer::EmitInstruction(const MCInst &Inst) { VecOS.flush(); // FIXME: Eliminate this copy. - SmallVector<MCAsmFixup, 4> AsmFixups; - for (unsigned i = 0, e = Fixups.size(); i != e; ++i) { - MCFixup &F = Fixups[i]; - AsmFixups.push_back(MCAsmFixup(F.getOffset(), *F.getValue(), - F.getKind())); - } + SmallVector<MCFixup, 4> AsmFixups; + for (unsigned i = 0, e = Fixups.size(); i != e; ++i) + AsmFixups.push_back(Fixups[i]); // See if we might need to relax this instruction, if so it needs its own // fragment. diff --git a/lib/MC/MachObjectWriter.cpp b/lib/MC/MachObjectWriter.cpp index 464bf86..1de22c4 100644 --- a/lib/MC/MachObjectWriter.cpp +++ b/lib/MC/MachObjectWriter.cpp @@ -472,7 +472,7 @@ public: void RecordX86_64Relocation(const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, - const MCAsmFixup &Fixup, MCValue Target, + const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue) { unsigned IsPCRel = isFixupKindPCRel(Fixup.getKind()); unsigned IsRIPRel = isFixupKindRIPRel(Fixup.getKind()); @@ -682,7 +682,7 @@ public: void RecordScatteredRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, - const MCAsmFixup &Fixup, MCValue Target, + const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue) { uint32_t FixupOffset = Layout.getFragmentOffset(Fragment)+Fixup.getOffset(); unsigned IsPCRel = isFixupKindPCRel(Fixup.getKind()); @@ -739,7 +739,7 @@ public: } void RecordRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout, - const MCFragment *Fragment, const MCAsmFixup &Fixup, + const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue) { if (Is64Bit) { RecordX86_64Relocation(Asm, Layout, Fragment, Fixup, Target, FixedValue); @@ -1168,7 +1168,7 @@ void MachObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm) { void MachObjectWriter::RecordRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, - const MCAsmFixup &Fixup, MCValue Target, + const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue) { ((MachObjectWriterImpl*) Impl)->RecordRelocation(Asm, Layout, Fragment, Fixup, Target, FixedValue); |