mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-19 17:24:57 +00:00
Merge the used symbol scanning of MCObjectStreamer and RecordStreamer.
This completes the refactoring of RecordStreamer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211727 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -712,7 +712,7 @@ public:
|
|||||||
|
|
||||||
/// EmitInstruction - Emit the given @p Instruction into the current
|
/// EmitInstruction - Emit the given @p Instruction into the current
|
||||||
/// section.
|
/// section.
|
||||||
virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) = 0;
|
virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI);
|
||||||
|
|
||||||
/// \brief Set the bundle alignment mode from now on in the section.
|
/// \brief Set the bundle alignment mode from now on in the section.
|
||||||
/// The argument is the power of 2 to which the alignment is set. The
|
/// The argument is the power of 2 to which the alignment is set. The
|
||||||
|
@@ -624,19 +624,15 @@ namespace {
|
|||||||
|
|
||||||
void EmitInstruction(const MCInst &Inst,
|
void EmitInstruction(const MCInst &Inst,
|
||||||
const MCSubtargetInfo &STI) override {
|
const MCSubtargetInfo &STI) override {
|
||||||
// Scan for values.
|
MCStreamer::EmitInstruction(Inst, STI);
|
||||||
for (unsigned i = Inst.getNumOperands(); i--; )
|
|
||||||
if (Inst.getOperand(i).isExpr())
|
|
||||||
visitUsedExpr(*Inst.getOperand(i).getExpr());
|
|
||||||
}
|
}
|
||||||
void EmitLabel(MCSymbol *Symbol) override {
|
void EmitLabel(MCSymbol *Symbol) override {
|
||||||
MCStreamer::EmitLabel(Symbol);
|
MCStreamer::EmitLabel(Symbol);
|
||||||
markDefined(*Symbol);
|
markDefined(*Symbol);
|
||||||
}
|
}
|
||||||
void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override {
|
void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override {
|
||||||
// FIXME: should we handle aliases?
|
|
||||||
markDefined(*Symbol);
|
markDefined(*Symbol);
|
||||||
visitUsedExpr(*Value);
|
MCStreamer::EmitAssignment(Symbol, Value);
|
||||||
}
|
}
|
||||||
bool EmitSymbolAttribute(MCSymbol *Symbol,
|
bool EmitSymbolAttribute(MCSymbol *Symbol,
|
||||||
MCSymbolAttr Attribute) override {
|
MCSymbolAttr Attribute) override {
|
||||||
|
@@ -35,8 +35,6 @@ namespace {
|
|||||||
void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = nullptr,
|
void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = nullptr,
|
||||||
uint64_t Size = 0, unsigned ByteAlignment = 0) override {}
|
uint64_t Size = 0, unsigned ByteAlignment = 0) override {}
|
||||||
void EmitGPRel32Value(const MCExpr *Value) override {}
|
void EmitGPRel32Value(const MCExpr *Value) override {}
|
||||||
|
|
||||||
void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo&) override {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -95,13 +95,13 @@ void MCObjectStreamer::EmitCFISections(bool EH, bool Debug) {
|
|||||||
|
|
||||||
void MCObjectStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
|
void MCObjectStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
|
||||||
const SMLoc &Loc) {
|
const SMLoc &Loc) {
|
||||||
|
MCStreamer::EmitValueImpl(Value, Size, Loc);
|
||||||
MCDataFragment *DF = getOrCreateDataFragment();
|
MCDataFragment *DF = getOrCreateDataFragment();
|
||||||
|
|
||||||
MCLineEntry::Make(this, getCurrentSection().first);
|
MCLineEntry::Make(this, getCurrentSection().first);
|
||||||
|
|
||||||
// Avoid fixups when possible.
|
// Avoid fixups when possible.
|
||||||
int64_t AbsValue;
|
int64_t AbsValue;
|
||||||
visitUsedExpr(*Value);
|
|
||||||
if (Value->EvaluateAsAbsolute(AbsValue, getAssembler())) {
|
if (Value->EvaluateAsAbsolute(AbsValue, getAssembler())) {
|
||||||
EmitIntValue(AbsValue, Size);
|
EmitIntValue(AbsValue, Size);
|
||||||
return;
|
return;
|
||||||
@@ -181,15 +181,12 @@ void MCObjectStreamer::ChangeSection(const MCSection *Section,
|
|||||||
|
|
||||||
void MCObjectStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
|
void MCObjectStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
|
||||||
getAssembler().getOrCreateSymbolData(*Symbol);
|
getAssembler().getOrCreateSymbolData(*Symbol);
|
||||||
visitUsedExpr(*Value);
|
|
||||||
MCStreamer::EmitAssignment(Symbol, Value);
|
MCStreamer::EmitAssignment(Symbol, Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCObjectStreamer::EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) {
|
void MCObjectStreamer::EmitInstruction(const MCInst &Inst,
|
||||||
// Scan for values.
|
const MCSubtargetInfo &STI) {
|
||||||
for (unsigned i = Inst.getNumOperands(); i--; )
|
MCStreamer::EmitInstruction(Inst, STI);
|
||||||
if (Inst.getOperand(i).isExpr())
|
|
||||||
visitUsedExpr(*Inst.getOperand(i).getExpr());
|
|
||||||
|
|
||||||
MCSectionData *SD = getCurrentSectionData();
|
MCSectionData *SD = getCurrentSectionData();
|
||||||
SD->setHasInstructions(true);
|
SD->setHasInstructions(true);
|
||||||
|
@@ -607,6 +607,7 @@ void MCStreamer::Finish() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MCStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
|
void MCStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
|
||||||
|
visitUsedExpr(*Value);
|
||||||
Symbol->setVariableValue(Value);
|
Symbol->setVariableValue(Value);
|
||||||
|
|
||||||
MCTargetStreamer *TS = getTargetStreamer();
|
MCTargetStreamer *TS = getTargetStreamer();
|
||||||
@@ -643,6 +644,14 @@ void MCStreamer::visitUsedExpr(const MCExpr &Expr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MCStreamer::EmitInstruction(const MCInst &Inst,
|
||||||
|
const MCSubtargetInfo &STI) {
|
||||||
|
// Scan for values.
|
||||||
|
for (unsigned i = Inst.getNumOperands(); i--;)
|
||||||
|
if (Inst.getOperand(i).isExpr())
|
||||||
|
visitUsedExpr(*Inst.getOperand(i).getExpr());
|
||||||
|
}
|
||||||
|
|
||||||
void MCStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {}
|
void MCStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {}
|
||||||
void MCStreamer::EmitThumbFunc(MCSymbol *Func) {}
|
void MCStreamer::EmitThumbFunc(MCSymbol *Func) {}
|
||||||
void MCStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {}
|
void MCStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {}
|
||||||
@@ -660,7 +669,9 @@ void MCStreamer::ChangeSection(const MCSection *, const MCExpr *) {}
|
|||||||
void MCStreamer::EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {}
|
void MCStreamer::EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {}
|
||||||
void MCStreamer::EmitBytes(StringRef Data) {}
|
void MCStreamer::EmitBytes(StringRef Data) {}
|
||||||
void MCStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
|
void MCStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
|
||||||
const SMLoc &Loc) {}
|
const SMLoc &Loc) {
|
||||||
|
visitUsedExpr(*Value);
|
||||||
|
}
|
||||||
void MCStreamer::EmitULEB128Value(const MCExpr *Value) {}
|
void MCStreamer::EmitULEB128Value(const MCExpr *Value) {}
|
||||||
void MCStreamer::EmitSLEB128Value(const MCExpr *Value) {}
|
void MCStreamer::EmitSLEB128Value(const MCExpr *Value) {}
|
||||||
void MCStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
|
void MCStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
|
||||||
|
Reference in New Issue
Block a user