From 16cbe95dd6707e87e4fb0f8803b64daf67740a58 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 23 Mar 2010 01:39:05 +0000 Subject: 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. llvm-svn: 99244 --- llvm/lib/MC/MCAssembler.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'llvm/lib/MC/MCAssembler.cpp') diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index ba2e5de73e5..39bad6dea46 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/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 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); -- cgit v1.2.3