mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-22 09:29:31 +00:00
Modify MCObjectStreamer EmitInstTo* interface
Add MCSubtargetInfo parameter virtual void EmitInstToFragment(const MCInst &Inst, const MCSubtargetInfo &); virtual void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &); git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200346 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4396f5d9d2
commit
d5d381b762
@ -85,8 +85,8 @@ public:
|
|||||||
virtual void FinishImpl();
|
virtual void FinishImpl();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void EmitInstToFragment(const MCInst &Inst);
|
virtual void EmitInstToFragment(const MCInst &Inst, const MCSubtargetInfo &);
|
||||||
virtual void EmitInstToData(const MCInst &Inst);
|
virtual void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &);
|
||||||
|
|
||||||
virtual void EmitBundleAlignMode(unsigned AlignPow2);
|
virtual void EmitBundleAlignMode(unsigned AlignPow2);
|
||||||
virtual void EmitBundleLock(bool AlignToEnd);
|
virtual void EmitBundleLock(bool AlignToEnd);
|
||||||
|
@ -17,6 +17,7 @@ namespace llvm {
|
|||||||
class MCAssembler;
|
class MCAssembler;
|
||||||
class MCCodeEmitter;
|
class MCCodeEmitter;
|
||||||
class MCSectionData;
|
class MCSectionData;
|
||||||
|
class MCSubtargetInfo;
|
||||||
class MCExpr;
|
class MCExpr;
|
||||||
class MCFragment;
|
class MCFragment;
|
||||||
class MCDataFragment;
|
class MCDataFragment;
|
||||||
@ -35,7 +36,7 @@ class MCObjectStreamer : public MCStreamer {
|
|||||||
MCSectionData *CurSectionData;
|
MCSectionData *CurSectionData;
|
||||||
MCSectionData::iterator CurInsertionPoint;
|
MCSectionData::iterator CurInsertionPoint;
|
||||||
|
|
||||||
virtual void EmitInstToData(const MCInst &Inst) = 0;
|
virtual void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo&) = 0;
|
||||||
virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
|
virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
|
||||||
virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame);
|
virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame);
|
||||||
|
|
||||||
@ -87,7 +88,7 @@ public:
|
|||||||
|
|
||||||
/// \brief Emit an instruction to a special fragment, because this instruction
|
/// \brief Emit an instruction to a special fragment, because this instruction
|
||||||
/// can change its size during relaxation.
|
/// can change its size during relaxation.
|
||||||
virtual void EmitInstToFragment(const MCInst &Inst);
|
virtual void EmitInstToFragment(const MCInst &Inst, const MCSubtargetInfo &);
|
||||||
|
|
||||||
virtual void EmitBundleAlignMode(unsigned AlignPow2);
|
virtual void EmitBundleAlignMode(unsigned AlignPow2);
|
||||||
virtual void EmitBundleLock(bool AlignToEnd);
|
virtual void EmitBundleLock(bool AlignToEnd);
|
||||||
|
@ -397,15 +397,17 @@ void MCELFStreamer::fixSymbolsInTLSFixups(const MCExpr *expr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCELFStreamer::EmitInstToFragment(const MCInst &Inst) {
|
void MCELFStreamer::EmitInstToFragment(const MCInst &Inst,
|
||||||
this->MCObjectStreamer::EmitInstToFragment(Inst);
|
const MCSubtargetInfo &STI) {
|
||||||
|
this->MCObjectStreamer::EmitInstToFragment(Inst, STI);
|
||||||
MCRelaxableFragment &F = *cast<MCRelaxableFragment>(getCurrentFragment());
|
MCRelaxableFragment &F = *cast<MCRelaxableFragment>(getCurrentFragment());
|
||||||
|
|
||||||
for (unsigned i = 0, e = F.getFixups().size(); i != e; ++i)
|
for (unsigned i = 0, e = F.getFixups().size(); i != e; ++i)
|
||||||
fixSymbolsInTLSFixups(F.getFixups()[i].getValue());
|
fixSymbolsInTLSFixups(F.getFixups()[i].getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCELFStreamer::EmitInstToData(const MCInst &Inst) {
|
void MCELFStreamer::EmitInstToData(const MCInst &Inst,
|
||||||
|
const MCSubtargetInfo &STI) {
|
||||||
MCAssembler &Assembler = getAssembler();
|
MCAssembler &Assembler = getAssembler();
|
||||||
SmallVector<MCFixup, 4> Fixups;
|
SmallVector<MCFixup, 4> Fixups;
|
||||||
SmallString<256> Code;
|
SmallString<256> Code;
|
||||||
|
@ -31,7 +31,7 @@ namespace {
|
|||||||
|
|
||||||
class MCMachOStreamer : public MCObjectStreamer {
|
class MCMachOStreamer : public MCObjectStreamer {
|
||||||
private:
|
private:
|
||||||
virtual void EmitInstToData(const MCInst &Inst);
|
virtual void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI);
|
||||||
|
|
||||||
void EmitDataRegion(DataRegionData::KindTy Kind);
|
void EmitDataRegion(DataRegionData::KindTy Kind);
|
||||||
void EmitDataRegionEnd();
|
void EmitDataRegionEnd();
|
||||||
@ -364,7 +364,8 @@ void MCMachOStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCMachOStreamer::EmitInstToData(const MCInst &Inst) {
|
void MCMachOStreamer::EmitInstToData(const MCInst &Inst,
|
||||||
|
const MCSubtargetInfo &STI) {
|
||||||
MCDataFragment *DF = getOrCreateDataFragment();
|
MCDataFragment *DF = getOrCreateDataFragment();
|
||||||
|
|
||||||
SmallVector<MCFixup, 4> Fixups;
|
SmallVector<MCFixup, 4> Fixups;
|
||||||
|
@ -203,7 +203,7 @@ void MCObjectStreamer::EmitInstruction(const MCInst &Inst, const MCSubtargetInfo
|
|||||||
// If this instruction doesn't need relaxation, just emit it as data.
|
// If this instruction doesn't need relaxation, just emit it as data.
|
||||||
MCAssembler &Assembler = getAssembler();
|
MCAssembler &Assembler = getAssembler();
|
||||||
if (!Assembler.getBackend().mayNeedRelaxation(Inst)) {
|
if (!Assembler.getBackend().mayNeedRelaxation(Inst)) {
|
||||||
EmitInstToData(Inst);
|
EmitInstToData(Inst, STI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,15 +218,16 @@ void MCObjectStreamer::EmitInstruction(const MCInst &Inst, const MCSubtargetInfo
|
|||||||
getAssembler().getBackend().relaxInstruction(Inst, Relaxed);
|
getAssembler().getBackend().relaxInstruction(Inst, Relaxed);
|
||||||
while (getAssembler().getBackend().mayNeedRelaxation(Relaxed))
|
while (getAssembler().getBackend().mayNeedRelaxation(Relaxed))
|
||||||
getAssembler().getBackend().relaxInstruction(Relaxed, Relaxed);
|
getAssembler().getBackend().relaxInstruction(Relaxed, Relaxed);
|
||||||
EmitInstToData(Relaxed);
|
EmitInstToData(Relaxed, STI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise emit to a separate fragment.
|
// Otherwise emit to a separate fragment.
|
||||||
EmitInstToFragment(Inst);
|
EmitInstToFragment(Inst, STI);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCObjectStreamer::EmitInstToFragment(const MCInst &Inst) {
|
void MCObjectStreamer::EmitInstToFragment(const MCInst &Inst,
|
||||||
|
const MCSubtargetInfo &STI) {
|
||||||
// Always create a new, separate fragment here, because its size can change
|
// Always create a new, separate fragment here, because its size can change
|
||||||
// during relaxation.
|
// during relaxation.
|
||||||
MCRelaxableFragment *IF = new MCRelaxableFragment(Inst);
|
MCRelaxableFragment *IF = new MCRelaxableFragment(Inst);
|
||||||
|
@ -23,8 +23,9 @@ namespace {
|
|||||||
|
|
||||||
class MCPureStreamer : public MCObjectStreamer {
|
class MCPureStreamer : public MCObjectStreamer {
|
||||||
private:
|
private:
|
||||||
virtual void EmitInstToFragment(const MCInst &Inst);
|
virtual void EmitInstToFragment(const MCInst &Inst,
|
||||||
virtual void EmitInstToData(const MCInst &Inst);
|
const MCSubtargetInfo &STI);
|
||||||
|
virtual void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MCPureStreamer(MCContext &Context, MCAsmBackend &TAB, raw_ostream &OS,
|
MCPureStreamer(MCContext &Context, MCAsmBackend &TAB, raw_ostream &OS,
|
||||||
@ -178,7 +179,8 @@ bool MCPureStreamer::EmitValueToOffset(const MCExpr *Offset,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPureStreamer::EmitInstToFragment(const MCInst &Inst) {
|
void MCPureStreamer::EmitInstToFragment(const MCInst &Inst,
|
||||||
|
const MCSubtargetInfo &STI) {
|
||||||
MCRelaxableFragment *IF = new MCRelaxableFragment(Inst);
|
MCRelaxableFragment *IF = new MCRelaxableFragment(Inst);
|
||||||
insert(IF);
|
insert(IF);
|
||||||
|
|
||||||
@ -196,7 +198,8 @@ void MCPureStreamer::EmitInstToFragment(const MCInst &Inst) {
|
|||||||
IF->getFixups() = Fixups;
|
IF->getFixups() = Fixups;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCPureStreamer::EmitInstToData(const MCInst &Inst) {
|
void MCPureStreamer::EmitInstToData(const MCInst &Inst,
|
||||||
|
const MCSubtargetInfo &STI) {
|
||||||
MCDataFragment *DF = getOrCreateDataFragment();
|
MCDataFragment *DF = getOrCreateDataFragment();
|
||||||
|
|
||||||
SmallVector<MCFixup, 4> Fixups;
|
SmallVector<MCFixup, 4> Fixups;
|
||||||
|
@ -78,7 +78,7 @@ public:
|
|||||||
virtual void FinishImpl();
|
virtual void FinishImpl();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void EmitInstToData(const MCInst &Inst) {
|
virtual void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) {
|
||||||
MCDataFragment *DF = getOrCreateDataFragment();
|
MCDataFragment *DF = getOrCreateDataFragment();
|
||||||
|
|
||||||
SmallVector<MCFixup, 4> Fixups;
|
SmallVector<MCFixup, 4> Fixups;
|
||||||
|
Loading…
Reference in New Issue
Block a user