mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 04:09:45 +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();
|
||||
|
||||
private:
|
||||
virtual void EmitInstToFragment(const MCInst &Inst);
|
||||
virtual void EmitInstToData(const MCInst &Inst);
|
||||
virtual void EmitInstToFragment(const MCInst &Inst, const MCSubtargetInfo &);
|
||||
virtual void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &);
|
||||
|
||||
virtual void EmitBundleAlignMode(unsigned AlignPow2);
|
||||
virtual void EmitBundleLock(bool AlignToEnd);
|
||||
|
@ -17,6 +17,7 @@ namespace llvm {
|
||||
class MCAssembler;
|
||||
class MCCodeEmitter;
|
||||
class MCSectionData;
|
||||
class MCSubtargetInfo;
|
||||
class MCExpr;
|
||||
class MCFragment;
|
||||
class MCDataFragment;
|
||||
@ -35,7 +36,7 @@ class MCObjectStreamer : public MCStreamer {
|
||||
MCSectionData *CurSectionData;
|
||||
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 EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame);
|
||||
|
||||
@ -87,7 +88,7 @@ public:
|
||||
|
||||
/// \brief Emit an instruction to a special fragment, because this instruction
|
||||
/// 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 EmitBundleLock(bool AlignToEnd);
|
||||
|
@ -397,15 +397,17 @@ void MCELFStreamer::fixSymbolsInTLSFixups(const MCExpr *expr) {
|
||||
}
|
||||
}
|
||||
|
||||
void MCELFStreamer::EmitInstToFragment(const MCInst &Inst) {
|
||||
this->MCObjectStreamer::EmitInstToFragment(Inst);
|
||||
void MCELFStreamer::EmitInstToFragment(const MCInst &Inst,
|
||||
const MCSubtargetInfo &STI) {
|
||||
this->MCObjectStreamer::EmitInstToFragment(Inst, STI);
|
||||
MCRelaxableFragment &F = *cast<MCRelaxableFragment>(getCurrentFragment());
|
||||
|
||||
for (unsigned i = 0, e = F.getFixups().size(); i != e; ++i)
|
||||
fixSymbolsInTLSFixups(F.getFixups()[i].getValue());
|
||||
}
|
||||
|
||||
void MCELFStreamer::EmitInstToData(const MCInst &Inst) {
|
||||
void MCELFStreamer::EmitInstToData(const MCInst &Inst,
|
||||
const MCSubtargetInfo &STI) {
|
||||
MCAssembler &Assembler = getAssembler();
|
||||
SmallVector<MCFixup, 4> Fixups;
|
||||
SmallString<256> Code;
|
||||
|
@ -31,7 +31,7 @@ namespace {
|
||||
|
||||
class MCMachOStreamer : public MCObjectStreamer {
|
||||
private:
|
||||
virtual void EmitInstToData(const MCInst &Inst);
|
||||
virtual void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI);
|
||||
|
||||
void EmitDataRegion(DataRegionData::KindTy Kind);
|
||||
void EmitDataRegionEnd();
|
||||
@ -364,7 +364,8 @@ void MCMachOStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
|
||||
return;
|
||||
}
|
||||
|
||||
void MCMachOStreamer::EmitInstToData(const MCInst &Inst) {
|
||||
void MCMachOStreamer::EmitInstToData(const MCInst &Inst,
|
||||
const MCSubtargetInfo &STI) {
|
||||
MCDataFragment *DF = getOrCreateDataFragment();
|
||||
|
||||
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.
|
||||
MCAssembler &Assembler = getAssembler();
|
||||
if (!Assembler.getBackend().mayNeedRelaxation(Inst)) {
|
||||
EmitInstToData(Inst);
|
||||
EmitInstToData(Inst, STI);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -218,15 +218,16 @@ void MCObjectStreamer::EmitInstruction(const MCInst &Inst, const MCSubtargetInfo
|
||||
getAssembler().getBackend().relaxInstruction(Inst, Relaxed);
|
||||
while (getAssembler().getBackend().mayNeedRelaxation(Relaxed))
|
||||
getAssembler().getBackend().relaxInstruction(Relaxed, Relaxed);
|
||||
EmitInstToData(Relaxed);
|
||||
EmitInstToData(Relaxed, STI);
|
||||
return;
|
||||
}
|
||||
|
||||
// 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
|
||||
// during relaxation.
|
||||
MCRelaxableFragment *IF = new MCRelaxableFragment(Inst);
|
||||
|
@ -23,8 +23,9 @@ namespace {
|
||||
|
||||
class MCPureStreamer : public MCObjectStreamer {
|
||||
private:
|
||||
virtual void EmitInstToFragment(const MCInst &Inst);
|
||||
virtual void EmitInstToData(const MCInst &Inst);
|
||||
virtual void EmitInstToFragment(const MCInst &Inst,
|
||||
const MCSubtargetInfo &STI);
|
||||
virtual void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI);
|
||||
|
||||
public:
|
||||
MCPureStreamer(MCContext &Context, MCAsmBackend &TAB, raw_ostream &OS,
|
||||
@ -178,7 +179,8 @@ bool MCPureStreamer::EmitValueToOffset(const MCExpr *Offset,
|
||||
return false;
|
||||
}
|
||||
|
||||
void MCPureStreamer::EmitInstToFragment(const MCInst &Inst) {
|
||||
void MCPureStreamer::EmitInstToFragment(const MCInst &Inst,
|
||||
const MCSubtargetInfo &STI) {
|
||||
MCRelaxableFragment *IF = new MCRelaxableFragment(Inst);
|
||||
insert(IF);
|
||||
|
||||
@ -196,7 +198,8 @@ void MCPureStreamer::EmitInstToFragment(const MCInst &Inst) {
|
||||
IF->getFixups() = Fixups;
|
||||
}
|
||||
|
||||
void MCPureStreamer::EmitInstToData(const MCInst &Inst) {
|
||||
void MCPureStreamer::EmitInstToData(const MCInst &Inst,
|
||||
const MCSubtargetInfo &STI) {
|
||||
MCDataFragment *DF = getOrCreateDataFragment();
|
||||
|
||||
SmallVector<MCFixup, 4> Fixups;
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
virtual void FinishImpl();
|
||||
|
||||
private:
|
||||
virtual void EmitInstToData(const MCInst &Inst) {
|
||||
virtual void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) {
|
||||
MCDataFragment *DF = getOrCreateDataFragment();
|
||||
|
||||
SmallVector<MCFixup, 4> Fixups;
|
||||
|
Loading…
Reference in New Issue
Block a user