summaryrefslogtreecommitdiff
path: root/lib/MC/MCObjectStreamer.cpp
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2012-12-07 19:13:57 +0000
committerEli Bendersky <eliben@google.com>2012-12-07 19:13:57 +0000
commit64d9a3233476553fc950f0f2fc6a2cdd2a4c05cf (patch)
tree42e99ad39f9203c0caf206319b45449bf7723230 /lib/MC/MCObjectStreamer.cpp
parente4ccfef809a1a47f1386bb2767b8c77e64644435 (diff)
downloadllvm-64d9a3233476553fc950f0f2fc6a2cdd2a4c05cf.tar.gz
llvm-64d9a3233476553fc950f0f2fc6a2cdd2a4c05cf.tar.bz2
llvm-64d9a3233476553fc950f0f2fc6a2cdd2a4c05cf.tar.xz
Refactor MCInstFragment and MCDataFragment to adhere to a common interface,
which removes code duplication and prepares the ground for future additions. Full discussion: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20121203/158233.html git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169626 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCObjectStreamer.cpp')
-rw-r--r--lib/MC/MCObjectStreamer.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/MC/MCObjectStreamer.cpp b/lib/MC/MCObjectStreamer.cpp
index 08200eb8f0..c2171ffaa5 100644
--- a/lib/MC/MCObjectStreamer.cpp
+++ b/lib/MC/MCObjectStreamer.cpp
@@ -99,9 +99,9 @@ void MCObjectStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
EmitIntValue(AbsValue, Size, AddrSpace);
return;
}
- DF->addFixup(MCFixup::Create(DF->getContents().size(),
- Value,
- MCFixup::getKindForSize(Size, false)));
+ DF->getFixups().push_back(
+ MCFixup::Create(DF->getContents().size(), Value,
+ MCFixup::getKindForSize(Size, false)));
DF->getContents().resize(DF->getContents().size() + Size, 0);
}
@@ -204,7 +204,7 @@ void MCObjectStreamer::EmitInstToFragment(const MCInst &Inst) {
raw_svector_ostream VecOS(Code);
getAssembler().getEmitter().EncodeInstruction(Inst, VecOS, IF->getFixups());
VecOS.flush();
- IF->getCode().append(Code.begin(), Code.end());
+ IF->getContents().append(Code.begin(), Code.end());
}
void MCObjectStreamer::EmitDwarfAdvanceLineAddr(int64_t LineDelta,
@@ -288,7 +288,8 @@ bool MCObjectStreamer::EmitValueToOffset(const MCExpr *Offset,
void MCObjectStreamer::EmitGPRel32Value(const MCExpr *Value) {
MCDataFragment *DF = getOrCreateDataFragment();
- DF->addFixup(MCFixup::Create(DF->getContents().size(), Value, FK_GPRel_4));
+ DF->getFixups().push_back(MCFixup::Create(DF->getContents().size(),
+ Value, FK_GPRel_4));
DF->getContents().resize(DF->getContents().size() + 4, 0);
}
@@ -296,7 +297,8 @@ void MCObjectStreamer::EmitGPRel32Value(const MCExpr *Value) {
void MCObjectStreamer::EmitGPRel64Value(const MCExpr *Value) {
MCDataFragment *DF = getOrCreateDataFragment();
- DF->addFixup(MCFixup::Create(DF->getContents().size(), Value, FK_GPRel_4));
+ DF->getFixups().push_back(MCFixup::Create(DF->getContents().size(),
+ Value, FK_GPRel_4));
DF->getContents().resize(DF->getContents().size() + 8, 0);
}