mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
MC: Eliminate an unnecessary copy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104709 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8488252855
commit
dae5b9f804
@ -434,11 +434,6 @@ void MCMachOStreamer::EmitInstruction(const MCInst &Inst) {
|
|||||||
Assembler.getEmitter().EncodeInstruction(Inst, VecOS, Fixups);
|
Assembler.getEmitter().EncodeInstruction(Inst, VecOS, Fixups);
|
||||||
VecOS.flush();
|
VecOS.flush();
|
||||||
|
|
||||||
// FIXME: Eliminate this copy.
|
|
||||||
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
|
// See if we might need to relax this instruction, if so it needs its own
|
||||||
// fragment.
|
// fragment.
|
||||||
//
|
//
|
||||||
@ -461,16 +456,16 @@ void MCMachOStreamer::EmitInstruction(const MCInst &Inst) {
|
|||||||
// FIXME: Revisit this design decision when relaxation is done, we may be
|
// FIXME: Revisit this design decision when relaxation is done, we may be
|
||||||
// able to get away with not storing any extra data in the MCInst.
|
// able to get away with not storing any extra data in the MCInst.
|
||||||
IF->getCode() = Code;
|
IF->getCode() = Code;
|
||||||
IF->getFixups() = AsmFixups;
|
IF->getFixups() = Fixups;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the fixups and data.
|
// Add the fixups and data.
|
||||||
MCDataFragment *DF = getOrCreateDataFragment();
|
MCDataFragment *DF = getOrCreateDataFragment();
|
||||||
for (unsigned i = 0, e = AsmFixups.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
|
||||||
AsmFixups[i].setOffset(AsmFixups[i].getOffset() + DF->getContents().size());
|
Fixups[i].setOffset(Fixups[i].getOffset() + DF->getContents().size());
|
||||||
DF->addFixup(AsmFixups[i]);
|
DF->addFixup(Fixups[i]);
|
||||||
}
|
}
|
||||||
DF->getContents().append(Code.begin(), Code.end());
|
DF->getContents().append(Code.begin(), Code.end());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user