mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 16:19:52 +00:00
[MC][COFF] Switch the COFF streamer over to using the MCObjectStreamer version of EmitInstruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171437 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -72,16 +72,25 @@ public:
|
|||||||
virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
|
virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment);
|
uint64_t Size, unsigned ByteAlignment);
|
||||||
virtual void EmitFileDirective(StringRef Filename);
|
virtual void EmitFileDirective(StringRef Filename);
|
||||||
virtual void EmitInstruction(const MCInst &Instruction);
|
|
||||||
virtual void EmitWin64EHHandlerData();
|
virtual void EmitWin64EHHandlerData();
|
||||||
virtual void FinishImpl();
|
virtual void FinishImpl();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void EmitInstToFragment(const MCInst &Inst) {
|
|
||||||
llvm_unreachable("Not used by WinCOFF.");
|
|
||||||
}
|
|
||||||
virtual void EmitInstToData(const MCInst &Inst) {
|
virtual void EmitInstToData(const MCInst &Inst) {
|
||||||
llvm_unreachable("Not used by WinCOFF.");
|
MCDataFragment *DF = getOrCreateDataFragment();
|
||||||
|
|
||||||
|
SmallVector<MCFixup, 4> Fixups;
|
||||||
|
SmallString<256> Code;
|
||||||
|
raw_svector_ostream VecOS(Code);
|
||||||
|
getAssembler().getEmitter().EncodeInstruction(Inst, VecOS, Fixups);
|
||||||
|
VecOS.flush();
|
||||||
|
|
||||||
|
// Add the fixups and data.
|
||||||
|
for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
|
||||||
|
Fixups[i].setOffset(Fixups[i].getOffset() + DF->getContents().size());
|
||||||
|
DF->getFixups().push_back(Fixups[i]);
|
||||||
|
}
|
||||||
|
DF->getContents().append(Code.begin(), Code.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSection(StringRef Section,
|
void SetSection(StringRef Section,
|
||||||
@@ -116,7 +125,6 @@ private:
|
|||||||
SectionKind::getBSS());
|
SectionKind::getBSS());
|
||||||
EmitCodeAlignment(4, 0);
|
EmitCodeAlignment(4, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
} // end anonymous namespace.
|
} // end anonymous namespace.
|
||||||
|
|
||||||
@@ -334,22 +342,6 @@ void WinCOFFStreamer::EmitFileDirective(StringRef Filename) {
|
|||||||
// info will be a much large effort.
|
// info will be a much large effort.
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinCOFFStreamer::EmitInstruction(const MCInst &Instruction) {
|
|
||||||
for (unsigned i = 0, e = Instruction.getNumOperands(); i != e; ++i)
|
|
||||||
if (Instruction.getOperand(i).isExpr())
|
|
||||||
AddValueSymbols(Instruction.getOperand(i).getExpr());
|
|
||||||
|
|
||||||
getCurrentSectionData()->setHasInstructions(true);
|
|
||||||
|
|
||||||
MCInstFragment *Fragment =
|
|
||||||
new MCInstFragment(Instruction, getCurrentSectionData());
|
|
||||||
|
|
||||||
raw_svector_ostream VecOS(Fragment->getContents());
|
|
||||||
|
|
||||||
getAssembler().getEmitter().EncodeInstruction(Instruction, VecOS,
|
|
||||||
Fragment->getFixups());
|
|
||||||
}
|
|
||||||
|
|
||||||
void WinCOFFStreamer::EmitWin64EHHandlerData() {
|
void WinCOFFStreamer::EmitWin64EHHandlerData() {
|
||||||
MCStreamer::EmitWin64EHHandlerData();
|
MCStreamer::EmitWin64EHHandlerData();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user