mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-04 14:22:26 +00:00
Simplify the visitation of target expressions. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211707 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b4840d7a4d
commit
d4feaf82bc
@ -21,6 +21,7 @@ class MCAssembler;
|
|||||||
class MCContext;
|
class MCContext;
|
||||||
class MCSection;
|
class MCSection;
|
||||||
class MCSectionData;
|
class MCSectionData;
|
||||||
|
class MCObjectStreamer;
|
||||||
class MCSymbol;
|
class MCSymbol;
|
||||||
class MCValue;
|
class MCValue;
|
||||||
class raw_ostream;
|
class raw_ostream;
|
||||||
@ -524,7 +525,7 @@ public:
|
|||||||
virtual void PrintImpl(raw_ostream &OS) const = 0;
|
virtual void PrintImpl(raw_ostream &OS) const = 0;
|
||||||
virtual bool EvaluateAsRelocatableImpl(MCValue &Res,
|
virtual bool EvaluateAsRelocatableImpl(MCValue &Res,
|
||||||
const MCAsmLayout *Layout) const = 0;
|
const MCAsmLayout *Layout) const = 0;
|
||||||
virtual void AddValueSymbols(MCAssembler *) const = 0;
|
virtual void visitUsedExpr(MCObjectStreamer& Streamer) const = 0;
|
||||||
virtual const MCSection *FindAssociatedSection() const = 0;
|
virtual const MCSection *FindAssociatedSection() const = 0;
|
||||||
|
|
||||||
virtual void fixELFSymbolsInTLSFixups(MCAssembler &) const = 0;
|
virtual void fixELFSymbolsInTLSFixups(MCAssembler &) const = 0;
|
||||||
|
@ -78,9 +78,10 @@ protected:
|
|||||||
/// fragment is not a data fragment.
|
/// fragment is not a data fragment.
|
||||||
MCDataFragment *getOrCreateDataFragment() const;
|
MCDataFragment *getOrCreateDataFragment() const;
|
||||||
|
|
||||||
void AddValueSymbols(const MCExpr *Value);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void visitUsedExpr(const MCExpr &Expr);
|
||||||
|
void visitUsedSymbol(const MCSymbol &Sym);
|
||||||
|
|
||||||
MCAssembler &getAssembler() { return *Assembler; }
|
MCAssembler &getAssembler() { return *Assembler; }
|
||||||
|
|
||||||
/// @name MCStreamer Interface
|
/// @name MCStreamer Interface
|
||||||
|
@ -83,28 +83,32 @@ MCDataFragment *MCObjectStreamer::getOrCreateDataFragment() const {
|
|||||||
return F;
|
return F;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCObjectStreamer::AddValueSymbols(const MCExpr *Value) {
|
void MCObjectStreamer::visitUsedSymbol(const MCSymbol &Sym) {
|
||||||
switch (Value->getKind()) {
|
Assembler->getOrCreateSymbolData(Sym);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MCObjectStreamer::visitUsedExpr(const MCExpr &Expr) {
|
||||||
|
switch (Expr.getKind()) {
|
||||||
case MCExpr::Target:
|
case MCExpr::Target:
|
||||||
cast<MCTargetExpr>(Value)->AddValueSymbols(Assembler);
|
cast<MCTargetExpr>(Expr).visitUsedExpr(*this);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MCExpr::Constant:
|
case MCExpr::Constant:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MCExpr::Binary: {
|
case MCExpr::Binary: {
|
||||||
const MCBinaryExpr *BE = cast<MCBinaryExpr>(Value);
|
const MCBinaryExpr &BE = cast<MCBinaryExpr>(Expr);
|
||||||
AddValueSymbols(BE->getLHS());
|
visitUsedExpr(*BE.getLHS());
|
||||||
AddValueSymbols(BE->getRHS());
|
visitUsedExpr(*BE.getRHS());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MCExpr::SymbolRef:
|
case MCExpr::SymbolRef:
|
||||||
Assembler->getOrCreateSymbolData(cast<MCSymbolRefExpr>(Value)->getSymbol());
|
visitUsedSymbol(cast<MCSymbolRefExpr>(Expr).getSymbol());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MCExpr::Unary:
|
case MCExpr::Unary:
|
||||||
AddValueSymbols(cast<MCUnaryExpr>(Value)->getSubExpr());
|
visitUsedExpr(*cast<MCUnaryExpr>(Expr).getSubExpr());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,7 +127,7 @@ void MCObjectStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
|
|||||||
|
|
||||||
// Avoid fixups when possible.
|
// Avoid fixups when possible.
|
||||||
int64_t AbsValue;
|
int64_t AbsValue;
|
||||||
AddValueSymbols(Value);
|
visitUsedExpr(*Value);
|
||||||
if (Value->EvaluateAsAbsolute(AbsValue, getAssembler())) {
|
if (Value->EvaluateAsAbsolute(AbsValue, getAssembler())) {
|
||||||
EmitIntValue(AbsValue, Size);
|
EmitIntValue(AbsValue, Size);
|
||||||
return;
|
return;
|
||||||
@ -203,7 +207,7 @@ 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);
|
||||||
AddValueSymbols(Value);
|
visitUsedExpr(*Value);
|
||||||
MCStreamer::EmitAssignment(Symbol, Value);
|
MCStreamer::EmitAssignment(Symbol, Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +215,7 @@ void MCObjectStreamer::EmitInstruction(const MCInst &Inst, const MCSubtargetInfo
|
|||||||
// Scan for values.
|
// Scan for values.
|
||||||
for (unsigned i = Inst.getNumOperands(); i--; )
|
for (unsigned i = Inst.getNumOperands(); i--; )
|
||||||
if (Inst.getOperand(i).isExpr())
|
if (Inst.getOperand(i).isExpr())
|
||||||
AddValueSymbols(Inst.getOperand(i).getExpr());
|
visitUsedExpr(*Inst.getOperand(i).getExpr());
|
||||||
|
|
||||||
MCSectionData *SD = getCurrentSectionData();
|
MCSectionData *SD = getCurrentSectionData();
|
||||||
SD->setHasInstructions(true);
|
SD->setHasInstructions(true);
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "llvm/MC/MCAssembler.h"
|
#include "llvm/MC/MCAssembler.h"
|
||||||
#include "llvm/MC/MCContext.h"
|
#include "llvm/MC/MCContext.h"
|
||||||
#include "llvm/MC/MCELF.h"
|
#include "llvm/MC/MCELF.h"
|
||||||
|
#include "llvm/MC/MCObjectStreamer.h"
|
||||||
#include "llvm/MC/MCSymbol.h"
|
#include "llvm/MC/MCSymbol.h"
|
||||||
#include "llvm/MC/MCValue.h"
|
#include "llvm/MC/MCValue.h"
|
||||||
#include "llvm/Object/ELF.h"
|
#include "llvm/Object/ELF.h"
|
||||||
@ -81,37 +82,8 @@ void AArch64MCExpr::PrintImpl(raw_ostream &OS) const {
|
|||||||
OS << *Expr;
|
OS << *Expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: This basically copies MCObjectStreamer::AddValueSymbols. Perhaps
|
void AArch64MCExpr::visitUsedExpr(MCObjectStreamer &Streamer) const {
|
||||||
// that method should be made public?
|
Streamer.visitUsedExpr(*getSubExpr());
|
||||||
// FIXME: really do above: now that two backends are using it.
|
|
||||||
static void AddValueSymbolsImpl(const MCExpr *Value, MCAssembler *Asm) {
|
|
||||||
switch (Value->getKind()) {
|
|
||||||
case MCExpr::Target:
|
|
||||||
llvm_unreachable("Can't handle nested target expr!");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MCExpr::Constant:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MCExpr::Binary: {
|
|
||||||
const MCBinaryExpr *BE = cast<MCBinaryExpr>(Value);
|
|
||||||
AddValueSymbolsImpl(BE->getLHS(), Asm);
|
|
||||||
AddValueSymbolsImpl(BE->getRHS(), Asm);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case MCExpr::SymbolRef:
|
|
||||||
Asm->getOrCreateSymbolData(cast<MCSymbolRefExpr>(Value)->getSymbol());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MCExpr::Unary:
|
|
||||||
AddValueSymbolsImpl(cast<MCUnaryExpr>(Value)->getSubExpr(), Asm);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AArch64MCExpr::AddValueSymbols(MCAssembler *Asm) const {
|
|
||||||
AddValueSymbolsImpl(getSubExpr(), Asm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *AArch64MCExpr::FindAssociatedSection() const {
|
const MCSection *AArch64MCExpr::FindAssociatedSection() const {
|
||||||
|
@ -147,7 +147,7 @@ public:
|
|||||||
|
|
||||||
void PrintImpl(raw_ostream &OS) const override;
|
void PrintImpl(raw_ostream &OS) const override;
|
||||||
|
|
||||||
void AddValueSymbols(MCAssembler *) const override;
|
void visitUsedExpr(MCObjectStreamer &Streamer) const override;
|
||||||
|
|
||||||
const MCSection *FindAssociatedSection() const override;
|
const MCSection *FindAssociatedSection() const override;
|
||||||
|
|
||||||
|
@ -1160,7 +1160,7 @@ void ARMELFStreamer::EmitPersonalityFixup(StringRef Name) {
|
|||||||
const MCSymbolRefExpr *PersonalityRef = MCSymbolRefExpr::Create(
|
const MCSymbolRefExpr *PersonalityRef = MCSymbolRefExpr::Create(
|
||||||
PersonalitySym, MCSymbolRefExpr::VK_ARM_NONE, getContext());
|
PersonalitySym, MCSymbolRefExpr::VK_ARM_NONE, getContext());
|
||||||
|
|
||||||
AddValueSymbols(PersonalityRef);
|
visitUsedExpr(*PersonalityRef);
|
||||||
MCDataFragment *DF = getOrCreateDataFragment();
|
MCDataFragment *DF = getOrCreateDataFragment();
|
||||||
DF->getFixups().push_back(MCFixup::Create(DF->getContents().size(),
|
DF->getFixups().push_back(MCFixup::Create(DF->getContents().size(),
|
||||||
PersonalityRef,
|
PersonalityRef,
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "ARMMCExpr.h"
|
#include "ARMMCExpr.h"
|
||||||
#include "llvm/MC/MCAssembler.h"
|
#include "llvm/MC/MCAssembler.h"
|
||||||
#include "llvm/MC/MCContext.h"
|
#include "llvm/MC/MCContext.h"
|
||||||
|
#include "llvm/MC/MCObjectStreamer.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
#define DEBUG_TYPE "armmcexpr"
|
#define DEBUG_TYPE "armmcexpr"
|
||||||
@ -41,33 +42,6 @@ ARMMCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: This basically copies MCObjectStreamer::AddValueSymbols. Perhaps
|
void ARMMCExpr::visitUsedExpr(MCObjectStreamer &Streamer) const {
|
||||||
// that method should be made public?
|
Streamer.visitUsedExpr(*getSubExpr());
|
||||||
static void AddValueSymbols_(const MCExpr *Value, MCAssembler *Asm) {
|
|
||||||
switch (Value->getKind()) {
|
|
||||||
case MCExpr::Target:
|
|
||||||
llvm_unreachable("Can't handle nested target expr!");
|
|
||||||
|
|
||||||
case MCExpr::Constant:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MCExpr::Binary: {
|
|
||||||
const MCBinaryExpr *BE = cast<MCBinaryExpr>(Value);
|
|
||||||
AddValueSymbols_(BE->getLHS(), Asm);
|
|
||||||
AddValueSymbols_(BE->getRHS(), Asm);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case MCExpr::SymbolRef:
|
|
||||||
Asm->getOrCreateSymbolData(cast<MCSymbolRefExpr>(Value)->getSymbol());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MCExpr::Unary:
|
|
||||||
AddValueSymbols_(cast<MCUnaryExpr>(Value)->getSubExpr(), Asm);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ARMMCExpr::AddValueSymbols(MCAssembler *Asm) const {
|
|
||||||
AddValueSymbols_(getSubExpr(), Asm);
|
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public:
|
|||||||
void PrintImpl(raw_ostream &OS) const override;
|
void PrintImpl(raw_ostream &OS) const override;
|
||||||
bool EvaluateAsRelocatableImpl(MCValue &Res,
|
bool EvaluateAsRelocatableImpl(MCValue &Res,
|
||||||
const MCAsmLayout *Layout) const override;
|
const MCAsmLayout *Layout) const override;
|
||||||
void AddValueSymbols(MCAssembler *) const override;
|
void visitUsedExpr(MCObjectStreamer &Streamer) const override;
|
||||||
const MCSection *FindAssociatedSection() const override {
|
const MCSection *FindAssociatedSection() const override {
|
||||||
return getSubExpr()->FindAssociatedSection();
|
return getSubExpr()->FindAssociatedSection();
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "llvm/MC/MCAsmInfo.h"
|
#include "llvm/MC/MCAsmInfo.h"
|
||||||
#include "llvm/MC/MCAssembler.h"
|
#include "llvm/MC/MCAssembler.h"
|
||||||
#include "llvm/MC/MCContext.h"
|
#include "llvm/MC/MCContext.h"
|
||||||
|
#include "llvm/MC/MCObjectStreamer.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -83,33 +84,6 @@ MipsMCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
|
|||||||
return getSubExpr()->EvaluateAsRelocatable(Res, Layout);
|
return getSubExpr()->EvaluateAsRelocatable(Res, Layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: This basically copies MCObjectStreamer::AddValueSymbols. Perhaps
|
void MipsMCExpr::visitUsedExpr(MCObjectStreamer &Streamer) const {
|
||||||
// that method should be made public?
|
Streamer.visitUsedExpr(*getSubExpr());
|
||||||
static void AddValueSymbolsImpl(const MCExpr *Value, MCAssembler *Asm) {
|
|
||||||
switch (Value->getKind()) {
|
|
||||||
case MCExpr::Target:
|
|
||||||
llvm_unreachable("Can't handle nested target expr!");
|
|
||||||
|
|
||||||
case MCExpr::Constant:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MCExpr::Binary: {
|
|
||||||
const MCBinaryExpr *BE = cast<MCBinaryExpr>(Value);
|
|
||||||
AddValueSymbolsImpl(BE->getLHS(), Asm);
|
|
||||||
AddValueSymbolsImpl(BE->getRHS(), Asm);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case MCExpr::SymbolRef:
|
|
||||||
Asm->getOrCreateSymbolData(cast<MCSymbolRefExpr>(Value)->getSymbol());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MCExpr::Unary:
|
|
||||||
AddValueSymbolsImpl(cast<MCUnaryExpr>(Value)->getSubExpr(), Asm);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MipsMCExpr::AddValueSymbols(MCAssembler *Asm) const {
|
|
||||||
AddValueSymbolsImpl(getSubExpr(), Asm);
|
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
void PrintImpl(raw_ostream &OS) const override;
|
void PrintImpl(raw_ostream &OS) const override;
|
||||||
bool EvaluateAsRelocatableImpl(MCValue &Res,
|
bool EvaluateAsRelocatableImpl(MCValue &Res,
|
||||||
const MCAsmLayout *Layout) const override;
|
const MCAsmLayout *Layout) const override;
|
||||||
void AddValueSymbols(MCAssembler *) const override;
|
void visitUsedExpr(MCObjectStreamer &Streamer) const override;
|
||||||
const MCSection *FindAssociatedSection() const override {
|
const MCSection *FindAssociatedSection() const override {
|
||||||
return getSubExpr()->FindAssociatedSection();
|
return getSubExpr()->FindAssociatedSection();
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public:
|
|||||||
const MCAsmLayout *Layout) const override {
|
const MCAsmLayout *Layout) const override {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
void AddValueSymbols(MCAssembler *) const override {};
|
void visitUsedExpr(MCObjectStreamer &Streamer) const override {};
|
||||||
const MCSection *FindAssociatedSection() const override {
|
const MCSection *FindAssociatedSection() const override {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "llvm/MC/MCAsmInfo.h"
|
#include "llvm/MC/MCAsmInfo.h"
|
||||||
#include "llvm/MC/MCAssembler.h"
|
#include "llvm/MC/MCAssembler.h"
|
||||||
#include "llvm/MC/MCContext.h"
|
#include "llvm/MC/MCContext.h"
|
||||||
|
#include "llvm/MC/MCObjectStreamer.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -127,33 +128,6 @@ PPCMCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: This basically copies MCObjectStreamer::AddValueSymbols. Perhaps
|
void PPCMCExpr::visitUsedExpr(MCObjectStreamer &Streamer) const {
|
||||||
// that method should be made public?
|
Streamer.visitUsedExpr(*getSubExpr());
|
||||||
static void AddValueSymbols_(const MCExpr *Value, MCAssembler *Asm) {
|
|
||||||
switch (Value->getKind()) {
|
|
||||||
case MCExpr::Target:
|
|
||||||
llvm_unreachable("Can't handle nested target expr!");
|
|
||||||
|
|
||||||
case MCExpr::Constant:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MCExpr::Binary: {
|
|
||||||
const MCBinaryExpr *BE = cast<MCBinaryExpr>(Value);
|
|
||||||
AddValueSymbols_(BE->getLHS(), Asm);
|
|
||||||
AddValueSymbols_(BE->getRHS(), Asm);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case MCExpr::SymbolRef:
|
|
||||||
Asm->getOrCreateSymbolData(cast<MCSymbolRefExpr>(Value)->getSymbol());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MCExpr::Unary:
|
|
||||||
AddValueSymbols_(cast<MCUnaryExpr>(Value)->getSubExpr(), Asm);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PPCMCExpr::AddValueSymbols(MCAssembler *Asm) const {
|
|
||||||
AddValueSymbols_(getSubExpr(), Asm);
|
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ public:
|
|||||||
void PrintImpl(raw_ostream &OS) const override;
|
void PrintImpl(raw_ostream &OS) const override;
|
||||||
bool EvaluateAsRelocatableImpl(MCValue &Res,
|
bool EvaluateAsRelocatableImpl(MCValue &Res,
|
||||||
const MCAsmLayout *Layout) const override;
|
const MCAsmLayout *Layout) const override;
|
||||||
void AddValueSymbols(MCAssembler *) const override;
|
void visitUsedExpr(MCObjectStreamer &Streamer) const override;
|
||||||
const MCSection *FindAssociatedSection() const override {
|
const MCSection *FindAssociatedSection() const override {
|
||||||
return getSubExpr()->FindAssociatedSection();
|
return getSubExpr()->FindAssociatedSection();
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "llvm/MC/MCAssembler.h"
|
#include "llvm/MC/MCAssembler.h"
|
||||||
#include "llvm/MC/MCContext.h"
|
#include "llvm/MC/MCContext.h"
|
||||||
#include "llvm/MC/MCELF.h"
|
#include "llvm/MC/MCELF.h"
|
||||||
|
#include "llvm/MC/MCObjectStreamer.h"
|
||||||
#include "llvm/MC/MCSymbol.h"
|
#include "llvm/MC/MCSymbol.h"
|
||||||
#include "llvm/Object/ELF.h"
|
#include "llvm/Object/ELF.h"
|
||||||
|
|
||||||
@ -219,35 +220,6 @@ void SparcMCExpr::fixELFSymbolsInTLSFixups(MCAssembler &Asm) const {
|
|||||||
fixELFSymbolsInTLSFixupsImpl(getSubExpr(), Asm);
|
fixELFSymbolsInTLSFixupsImpl(getSubExpr(), Asm);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: This basically copies MCObjectStreamer::AddValueSymbols. Perhaps
|
void SparcMCExpr::visitUsedExpr(MCObjectStreamer &Streamer) const {
|
||||||
// that method should be made public?
|
Streamer.visitUsedExpr(*getSubExpr());
|
||||||
// FIXME: really do above: now that at least three other backends are using it.
|
|
||||||
static void AddValueSymbolsImpl(const MCExpr *Value, MCAssembler *Asm) {
|
|
||||||
switch (Value->getKind()) {
|
|
||||||
case MCExpr::Target:
|
|
||||||
llvm_unreachable("Can't handle nested target expr!");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MCExpr::Constant:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MCExpr::Binary: {
|
|
||||||
const MCBinaryExpr *BE = cast<MCBinaryExpr>(Value);
|
|
||||||
AddValueSymbolsImpl(BE->getLHS(), Asm);
|
|
||||||
AddValueSymbolsImpl(BE->getRHS(), Asm);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case MCExpr::SymbolRef:
|
|
||||||
Asm->getOrCreateSymbolData(cast<MCSymbolRefExpr>(Value)->getSymbol());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MCExpr::Unary:
|
|
||||||
AddValueSymbolsImpl(cast<MCUnaryExpr>(Value)->getSubExpr(), Asm);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SparcMCExpr::AddValueSymbols(MCAssembler *Asm) const {
|
|
||||||
AddValueSymbolsImpl(getSubExpr(), Asm);
|
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ public:
|
|||||||
void PrintImpl(raw_ostream &OS) const override;
|
void PrintImpl(raw_ostream &OS) const override;
|
||||||
bool EvaluateAsRelocatableImpl(MCValue &Res,
|
bool EvaluateAsRelocatableImpl(MCValue &Res,
|
||||||
const MCAsmLayout *Layout) const override;
|
const MCAsmLayout *Layout) const override;
|
||||||
void AddValueSymbols(MCAssembler *) const override;
|
void visitUsedExpr(MCObjectStreamer &Streamer) const override;
|
||||||
const MCSection *FindAssociatedSection() const override {
|
const MCSection *FindAssociatedSection() const override {
|
||||||
return getSubExpr()->FindAssociatedSection();
|
return getSubExpr()->FindAssociatedSection();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user