aboutsummaryrefslogtreecommitdiff
path: root/lib/MC/MCAssembler.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-03-23 01:39:05 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-03-23 01:39:05 +0000
commit9799de910e97879bf9f30f359551071a94d61570 (patch)
tree56a4b506404d726b866fd1e268f483f622878ae3 /lib/MC/MCAssembler.cpp
parent1ccd91a5b156ff8b415806b0d60fd7c302d62693 (diff)
MC: Tweak MCInstFragment to include the encoded data and fixups, so that we don't need to recompute them during relaxation. I will revisit this once all the other pieces of fast relaxation are in place.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99244 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCAssembler.cpp')
-rw-r--r--lib/MC/MCAssembler.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp
index ba2e5de73e..39bad6dea4 100644
--- a/lib/MC/MCAssembler.cpp
+++ b/lib/MC/MCAssembler.cpp
@@ -773,22 +773,14 @@ void MCAssembler::FinishLayout(MCAsmLayout &Layout) {
SD.getFragmentList().insert(it2, DF);
// Update the data fragments layout data.
+ DF->setParent(IF->getParent());
DF->setOffset(IF->getOffset());
DF->setFileSize(IF->getInstSize());
- // Encode the final instruction.
- SmallVector<MCFixup, 4> Fixups;
- raw_svector_ostream VecOS(DF->getContents());
- getEmitter().EncodeInstruction(IF->getInst(), VecOS, Fixups);
-
- // Copy over the fixups.
- //
- // FIXME-PERF: Encode fixups directly into the data fragment as well.
- for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
- MCFixup &F = Fixups[i];
- DF->addFixup(MCAsmFixup(DF->getContents().size()+F.getOffset(),
- *F.getValue(), F.getKind()));
- }
+ // Copy in the data and the fixups.
+ DF->getContents().append(IF->getCode().begin(), IF->getCode().end());
+ for (unsigned i = 0, e = IF->getFixups().size(); i != e; ++i)
+ DF->getFixups().push_back(IF->getFixups()[i]);
// Delete the instruction fragment and update the iterator.
SD.getFragmentList().erase(IF);