projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Recognize strings for Hexagon-specific variant kinds
[oota-llvm.git]
/
lib
/
MC
/
MCExpr.cpp
diff --git
a/lib/MC/MCExpr.cpp
b/lib/MC/MCExpr.cpp
index 1c0dc3f703aa179ff81ce74d0383546e601af865..0f26b38c29d7c8d6d4828412feb228bd797ae8e8 100644
(file)
--- a/
lib/MC/MCExpr.cpp
+++ b/
lib/MC/MCExpr.cpp
@@
-30,10
+30,10
@@
STATISTIC(MCExprEvaluate, "Number of MCExpr evaluations");
}
}
}
}
-void MCExpr::print(raw_ostream &OS) const {
+void MCExpr::print(raw_ostream &OS
, const MCAsmInfo *MAI
) const {
switch (getKind()) {
case MCExpr::Target:
switch (getKind()) {
case MCExpr::Target:
- return cast<MCTargetExpr>(this)->
PrintImpl(OS
);
+ return cast<MCTargetExpr>(this)->
printImpl(OS, MAI
);
case MCExpr::Constant:
OS << cast<MCConstantExpr>(*this).getValue();
return;
case MCExpr::Constant:
OS << cast<MCConstantExpr>(*this).getValue();
return;
@@
-43,11
+43,13
@@
void MCExpr::print(raw_ostream &OS) const {
const MCSymbol &Sym = SRE.getSymbol();
// Parenthesize names that start with $ so that they don't look like
// absolute names.
const MCSymbol &Sym = SRE.getSymbol();
// Parenthesize names that start with $ so that they don't look like
// absolute names.
- bool UseParens = Sym.getName()[0] == '$';
- if (UseParens)
- OS << '(' << Sym << ')';
- else
- OS << Sym;
+ bool UseParens = Sym.getName().size() && Sym.getName()[0] == '$';
+ if (UseParens) {
+ OS << '(';
+ Sym.print(OS, MAI);
+ OS << ')';
+ } else
+ Sym.print(OS, MAI);
if (SRE.getKind() != MCSymbolRefExpr::VK_None)
SRE.printVariantKind(OS);
if (SRE.getKind() != MCSymbolRefExpr::VK_None)
SRE.printVariantKind(OS);
@@
-63,7
+65,7
@@
void MCExpr::print(raw_ostream &OS) const {
case MCUnaryExpr::Not: OS << '~'; break;
case MCUnaryExpr::Plus: OS << '+'; break;
}
case MCUnaryExpr::Not: OS << '~'; break;
case MCUnaryExpr::Plus: OS << '+'; break;
}
-
OS << *UE.getSubExpr(
);
+
UE.getSubExpr()->print(OS, MAI
);
return;
}
return;
}
@@
-72,9
+74,11
@@
void MCExpr::print(raw_ostream &OS) const {
// Only print parens around the LHS if it is non-trivial.
if (isa<MCConstantExpr>(BE.getLHS()) || isa<MCSymbolRefExpr>(BE.getLHS())) {
// Only print parens around the LHS if it is non-trivial.
if (isa<MCConstantExpr>(BE.getLHS()) || isa<MCSymbolRefExpr>(BE.getLHS())) {
-
OS << *BE.getLHS(
);
+
BE.getLHS()->print(OS, MAI
);
} else {
} else {
- OS << '(' << *BE.getLHS() << ')';
+ OS << '(';
+ BE.getLHS()->print(OS, MAI);
+ OS << ')';
}
switch (BE.getOpcode()) {
}
switch (BE.getOpcode()) {
@@
-111,9
+115,11
@@
void MCExpr::print(raw_ostream &OS) const {
// Only print parens around the LHS if it is non-trivial.
if (isa<MCConstantExpr>(BE.getRHS()) || isa<MCSymbolRefExpr>(BE.getRHS())) {
// Only print parens around the LHS if it is non-trivial.
if (isa<MCConstantExpr>(BE.getRHS()) || isa<MCSymbolRefExpr>(BE.getRHS())) {
-
OS << *BE.getRHS(
);
+
BE.getRHS()->print(OS, MAI
);
} else {
} else {
- OS << '(' << *BE.getRHS() << ')';
+ OS << '(';
+ BE.getRHS()->print(OS, MAI);
+ OS << ')';
}
return;
}
}
return;
}
@@
-131,17
+137,17
@@
void MCExpr::dump() const {
/* *** */
/* *** */
-const MCBinaryExpr *MCBinaryExpr::
C
reate(Opcode Opc, const MCExpr *LHS,
+const MCBinaryExpr *MCBinaryExpr::
c
reate(Opcode Opc, const MCExpr *LHS,
const MCExpr *RHS, MCContext &Ctx) {
return new (Ctx) MCBinaryExpr(Opc, LHS, RHS);
}
const MCExpr *RHS, MCContext &Ctx) {
return new (Ctx) MCBinaryExpr(Opc, LHS, RHS);
}
-const MCUnaryExpr *MCUnaryExpr::
C
reate(Opcode Opc, const MCExpr *Expr,
+const MCUnaryExpr *MCUnaryExpr::
c
reate(Opcode Opc, const MCExpr *Expr,
MCContext &Ctx) {
return new (Ctx) MCUnaryExpr(Opc, Expr);
}
MCContext &Ctx) {
return new (Ctx) MCUnaryExpr(Opc, Expr);
}
-const MCConstantExpr *MCConstantExpr::
C
reate(int64_t Value, MCContext &Ctx) {
+const MCConstantExpr *MCConstantExpr::
c
reate(int64_t Value, MCContext &Ctx) {
return new (Ctx) MCConstantExpr(Value);
}
return new (Ctx) MCConstantExpr(Value);
}
@@
-156,15
+162,15
@@
MCSymbolRefExpr::MCSymbolRefExpr(const MCSymbol *Symbol, VariantKind Kind,
assert(Symbol);
}
assert(Symbol);
}
-const MCSymbolRefExpr *MCSymbolRefExpr::
C
reate(const MCSymbol *Sym,
+const MCSymbolRefExpr *MCSymbolRefExpr::
c
reate(const MCSymbol *Sym,
VariantKind Kind,
MCContext &Ctx) {
return new (Ctx) MCSymbolRefExpr(Sym, Kind, Ctx.getAsmInfo());
}
VariantKind Kind,
MCContext &Ctx) {
return new (Ctx) MCSymbolRefExpr(Sym, Kind, Ctx.getAsmInfo());
}
-const MCSymbolRefExpr *MCSymbolRefExpr::
C
reate(StringRef Name, VariantKind Kind,
+const MCSymbolRefExpr *MCSymbolRefExpr::
c
reate(StringRef Name, VariantKind Kind,
MCContext &Ctx) {
MCContext &Ctx) {
- return
C
reate(Ctx.getOrCreateSymbol(Name), Kind, Ctx);
+ return
c
reate(Ctx.getOrCreateSymbol(Name), Kind, Ctx);
}
StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) {
}
StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) {
@@
-196,6
+202,7
@@
StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) {
case VK_SIZE: return "SIZE";
case VK_WEAKREF: return "WEAKREF";
case VK_ARM_NONE: return "none";
case VK_SIZE: return "SIZE";
case VK_WEAKREF: return "WEAKREF";
case VK_ARM_NONE: return "none";
+ case VK_ARM_GOT_PREL: return "GOT_PREL";
case VK_ARM_TARGET1: return "target1";
case VK_ARM_TARGET2: return "target2";
case VK_ARM_PREL31: return "prel31";
case VK_ARM_TARGET1: return "target1";
case VK_ARM_TARGET2: return "target2";
case VK_ARM_PREL31: return "prel31";
@@
-305,7
+312,6
@@
MCSymbolRefExpr::getVariantKindForName(StringRef Name) {
.Case("got", VK_GOT)
.Case("gotoff", VK_GOTOFF)
.Case("gotpcrel", VK_GOTPCREL)
.Case("got", VK_GOT)
.Case("gotoff", VK_GOTOFF)
.Case("gotpcrel", VK_GOTPCREL)
- .Case("got_prel", VK_GOTPCREL)
.Case("gottpoff", VK_GOTTPOFF)
.Case("indntpoff", VK_INDNTPOFF)
.Case("ntpoff", VK_NTPOFF)
.Case("gottpoff", VK_GOTTPOFF)
.Case("indntpoff", VK_INDNTPOFF)
.Case("ntpoff", VK_NTPOFF)
@@
-376,7
+382,15
@@
MCSymbolRefExpr::getVariantKindForName(StringRef Name) {
.Case("got@tlsld@l", VK_PPC_GOT_TLSLD_LO)
.Case("got@tlsld@h", VK_PPC_GOT_TLSLD_HI)
.Case("got@tlsld@ha", VK_PPC_GOT_TLSLD_HA)
.Case("got@tlsld@l", VK_PPC_GOT_TLSLD_LO)
.Case("got@tlsld@h", VK_PPC_GOT_TLSLD_HI)
.Case("got@tlsld@ha", VK_PPC_GOT_TLSLD_HA)
+ .Case("gdgot", VK_Hexagon_GD_GOT)
+ .Case("gdplt", VK_Hexagon_GD_PLT)
+ .Case("iegot", VK_Hexagon_IE_GOT)
+ .Case("ie", VK_Hexagon_IE)
+ .Case("ldgot", VK_Hexagon_LD_GOT)
+ .Case("ldplt", VK_Hexagon_LD_PLT)
+ .Case("pcrel", VK_Hexagon_PCREL)
.Case("none", VK_ARM_NONE)
.Case("none", VK_ARM_NONE)
+ .Case("got_prel", VK_ARM_GOT_PREL)
.Case("target1", VK_ARM_TARGET1)
.Case("target2", VK_ARM_TARGET2)
.Case("prel31", VK_ARM_PREL31)
.Case("target1", VK_ARM_TARGET1)
.Case("target2", VK_ARM_TARGET2)
.Case("prel31", VK_ARM_PREL31)
@@
-400,23
+414,23
@@
void MCTargetExpr::anchor() {}
/* *** */
/* *** */
-bool MCExpr::
E
valuateAsAbsolute(int64_t &Res) const {
- return
E
valuateAsAbsolute(Res, nullptr, nullptr, nullptr);
+bool MCExpr::
e
valuateAsAbsolute(int64_t &Res) const {
+ return
e
valuateAsAbsolute(Res, nullptr, nullptr, nullptr);
}
}
-bool MCExpr::
E
valuateAsAbsolute(int64_t &Res,
+bool MCExpr::
e
valuateAsAbsolute(int64_t &Res,
const MCAsmLayout &Layout) const {
const MCAsmLayout &Layout) const {
- return
E
valuateAsAbsolute(Res, &Layout.getAssembler(), &Layout, nullptr);
+ return
e
valuateAsAbsolute(Res, &Layout.getAssembler(), &Layout, nullptr);
}
}
-bool MCExpr::
E
valuateAsAbsolute(int64_t &Res,
+bool MCExpr::
e
valuateAsAbsolute(int64_t &Res,
const MCAsmLayout &Layout,
const SectionAddrMap &Addrs) const {
const MCAsmLayout &Layout,
const SectionAddrMap &Addrs) const {
- return
E
valuateAsAbsolute(Res, &Layout.getAssembler(), &Layout, &Addrs);
+ return
e
valuateAsAbsolute(Res, &Layout.getAssembler(), &Layout, &Addrs);
}
}
-bool MCExpr::
E
valuateAsAbsolute(int64_t &Res, const MCAssembler &Asm) const {
- return
E
valuateAsAbsolute(Res, &Asm, nullptr, nullptr);
+bool MCExpr::
e
valuateAsAbsolute(int64_t &Res, const MCAssembler &Asm) const {
+ return
e
valuateAsAbsolute(Res, &Asm, nullptr, nullptr);
}
bool MCExpr::evaluateKnownAbsolute(int64_t &Res,
}
bool MCExpr::evaluateKnownAbsolute(int64_t &Res,
@@
-425,7
+439,7
@@
bool MCExpr::evaluateKnownAbsolute(int64_t &Res,
true);
}
true);
}
-bool MCExpr::
E
valuateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
+bool MCExpr::
e
valuateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
const MCAsmLayout *Layout,
const SectionAddrMap *Addrs) const {
// FIXME: The use if InSet = Addrs is a hack. Setting InSet causes us
const MCAsmLayout *Layout,
const SectionAddrMap *Addrs) const {
// FIXME: The use if InSet = Addrs is a hack. Setting InSet causes us
@@
-446,7
+460,7
@@
bool MCExpr::evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
}
bool IsRelocatable =
}
bool IsRelocatable =
-
E
valuateAsRelocatableImpl(Value, Asm, Layout, nullptr, Addrs, InSet);
+
e
valuateAsRelocatableImpl(Value, Asm, Layout, nullptr, Addrs, InSet);
// Record the current value.
Res = Value.getConstant();
// Record the current value.
Res = Value.getConstant();
@@
-468,14
+482,12
@@
static void AttemptToFoldSymbolOffsetDifference(
if (SA.isUndefined() || SB.isUndefined())
return;
if (SA.isUndefined() || SB.isUndefined())
return;
- if (!Asm->getWriter().
I
sSymbolRefDifferenceFullyResolved(*Asm, A, B, InSet))
+ if (!Asm->getWriter().
i
sSymbolRefDifferenceFullyResolved(*Asm, A, B, InSet))
return;
return;
- const MCSymbolData &AD = SA.getData();
- const MCSymbolData &BD = SB.getData();
-
- if (AD.getFragment() == BD.getFragment()) {
- Addend += (AD.getOffset() - BD.getOffset());
+ if (SA.getFragment() == SB.getFragment() && !SA.isVariable() &&
+ !SB.isVariable()) {
+ Addend += (SA.getOffset() - SB.getOffset());
// Pointers to Thumb symbols need to have their low-bit set to allow
// for interworking.
// Pointers to Thumb symbols need to have their low-bit set to allow
// for interworking.
@@
-491,8
+503,8
@@
static void AttemptToFoldSymbolOffsetDifference(
if (!Layout)
return;
if (!Layout)
return;
- const MCSection &SecA = *
AD
.getFragment()->getParent();
- const MCSection &SecB = *
BD
.getFragment()->getParent();
+ const MCSection &SecA = *
SA
.getFragment()->getParent();
+ const MCSection &SecB = *
SB
.getFragment()->getParent();
if ((&SecA != &SecB) && !Addrs)
return;
if ((&SecA != &SecB) && !Addrs)
return;
@@
-580,38
+592,38
@@
EvaluateSymbolicAdd(const MCAssembler *Asm, const MCAsmLayout *Layout,
const MCSymbolRefExpr *A = LHS_A ? LHS_A : RHS_A;
const MCSymbolRefExpr *B = LHS_B ? LHS_B : RHS_B;
const MCSymbolRefExpr *A = LHS_A ? LHS_A : RHS_A;
const MCSymbolRefExpr *B = LHS_B ? LHS_B : RHS_B;
- // If we have a negated symbol, then we must have also have a non-negated
- // symbol in order to encode the expression.
- if (B && !A)
- return false;
-
Res = MCValue::get(A, B, Result_Cst);
return true;
}
Res = MCValue::get(A, B, Result_Cst);
return true;
}
-bool MCExpr::
E
valuateAsRelocatable(MCValue &Res,
+bool MCExpr::
e
valuateAsRelocatable(MCValue &Res,
const MCAsmLayout *Layout,
const MCFixup *Fixup) const {
MCAssembler *Assembler = Layout ? &Layout->getAssembler() : nullptr;
const MCAsmLayout *Layout,
const MCFixup *Fixup) const {
MCAssembler *Assembler = Layout ? &Layout->getAssembler() : nullptr;
- return
E
valuateAsRelocatableImpl(Res, Assembler, Layout, Fixup, nullptr,
+ return
e
valuateAsRelocatableImpl(Res, Assembler, Layout, Fixup, nullptr,
false);
}
bool MCExpr::evaluateAsValue(MCValue &Res, const MCAsmLayout &Layout) const {
MCAssembler *Assembler = &Layout.getAssembler();
false);
}
bool MCExpr::evaluateAsValue(MCValue &Res, const MCAsmLayout &Layout) const {
MCAssembler *Assembler = &Layout.getAssembler();
- return
E
valuateAsRelocatableImpl(Res, Assembler, &Layout, nullptr, nullptr,
+ return
e
valuateAsRelocatableImpl(Res, Assembler, &Layout, nullptr, nullptr,
true);
}
true);
}
-static bool canExpand(const MCSymbol &Sym, const MCAssembler *Asm, bool InSet) {
+static bool canExpand(const MCSymbol &Sym, bool InSet) {
+ const MCExpr *Expr = Sym.getVariableValue();
+ const auto *Inner = dyn_cast<MCSymbolRefExpr>(Expr);
+ if (Inner) {
+ if (Inner->getKind() == MCSymbolRefExpr::VK_WEAKREF)
+ return false;
+ }
+
if (InSet)
return true;
if (InSet)
return true;
- if (!Asm)
- return false;
- return !Asm->getWriter().isWeak(Sym);
+ return !Sym.isInSection();
}
}
-bool MCExpr::
E
valuateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
+bool MCExpr::
e
valuateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCAsmLayout *Layout,
const MCFixup *Fixup,
const SectionAddrMap *Addrs,
const MCAsmLayout *Layout,
const MCFixup *Fixup,
const SectionAddrMap *Addrs,
@@
-620,7
+632,7
@@
bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
switch (getKind()) {
case Target:
switch (getKind()) {
case Target:
- return cast<MCTargetExpr>(this)->
E
valuateAsRelocatableImpl(Res, Layout,
+ return cast<MCTargetExpr>(this)->
e
valuateAsRelocatableImpl(Res, Layout,
Fixup);
case Constant:
Fixup);
case Constant:
@@
-633,9
+645,9
@@
bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
// Evaluate recursively if this is a variable.
if (Sym.isVariable() && SRE->getKind() == MCSymbolRefExpr::VK_None &&
// Evaluate recursively if this is a variable.
if (Sym.isVariable() && SRE->getKind() == MCSymbolRefExpr::VK_None &&
- canExpand(Sym,
Asm,
InSet)) {
+ canExpand(Sym, InSet)) {
bool IsMachO = SRE->hasSubsectionsViaSymbols();
bool IsMachO = SRE->hasSubsectionsViaSymbols();
- if (Sym.getVariableValue()->
E
valuateAsRelocatableImpl(
+ if (Sym.getVariableValue()->
e
valuateAsRelocatableImpl(
Res, Asm, Layout, Fixup, Addrs, InSet || IsMachO)) {
if (!IsMachO)
return true;
Res, Asm, Layout, Fixup, Addrs, InSet || IsMachO)) {
if (!IsMachO)
return true;
@@
-661,7
+673,7
@@
bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCUnaryExpr *AUE = cast<MCUnaryExpr>(this);
MCValue Value;
const MCUnaryExpr *AUE = cast<MCUnaryExpr>(this);
MCValue Value;
- if (!AUE->getSubExpr()->
E
valuateAsRelocatableImpl(Value, Asm, Layout, Fixup,
+ if (!AUE->getSubExpr()->
e
valuateAsRelocatableImpl(Value, Asm, Layout, Fixup,
Addrs, InSet))
return false;
Addrs, InSet))
return false;
@@
-695,9
+707,9
@@
bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCBinaryExpr *ABE = cast<MCBinaryExpr>(this);
MCValue LHSValue, RHSValue;
const MCBinaryExpr *ABE = cast<MCBinaryExpr>(this);
MCValue LHSValue, RHSValue;
- if (!ABE->getLHS()->
E
valuateAsRelocatableImpl(LHSValue, Asm, Layout, Fixup,
+ if (!ABE->getLHS()->
e
valuateAsRelocatableImpl(LHSValue, Asm, Layout, Fixup,
Addrs, InSet) ||
Addrs, InSet) ||
- !ABE->getRHS()->
E
valuateAsRelocatableImpl(RHSValue, Asm, Layout, Fixup,
+ !ABE->getRHS()->
e
valuateAsRelocatableImpl(RHSValue, Asm, Layout, Fixup,
Addrs, InSet))
return false;
Addrs, InSet))
return false;
@@
-729,7
+741,17
@@
bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
case MCBinaryExpr::AShr: Result = LHS >> RHS; break;
case MCBinaryExpr::Add: Result = LHS + RHS; break;
case MCBinaryExpr::And: Result = LHS & RHS; break;
case MCBinaryExpr::AShr: Result = LHS >> RHS; break;
case MCBinaryExpr::Add: Result = LHS + RHS; break;
case MCBinaryExpr::And: Result = LHS & RHS; break;
- case MCBinaryExpr::Div: Result = LHS / RHS; break;
+ case MCBinaryExpr::Div:
+ // Handle division by zero. gas just emits a warning and keeps going,
+ // we try to be stricter.
+ // FIXME: Currently the caller of this function has no way to understand
+ // we're bailing out because of 'division by zero'. Therefore, it will
+ // emit a 'expected relocatable expression' error. It would be nice to
+ // change this code to emit a better diagnostic.
+ if (RHS == 0)
+ return false;
+ Result = LHS / RHS;
+ break;
case MCBinaryExpr::EQ: Result = LHS == RHS; break;
case MCBinaryExpr::GT: Result = LHS > RHS; break;
case MCBinaryExpr::GTE: Result = LHS >= RHS; break;
case MCBinaryExpr::EQ: Result = LHS == RHS; break;
case MCBinaryExpr::GT: Result = LHS > RHS; break;
case MCBinaryExpr::GTE: Result = LHS >= RHS; break;
@@
-742,7
+764,7
@@
bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
case MCBinaryExpr::Mul: Result = LHS * RHS; break;
case MCBinaryExpr::NE: Result = LHS != RHS; break;
case MCBinaryExpr::Or: Result = LHS | RHS; break;
case MCBinaryExpr::Mul: Result = LHS * RHS; break;
case MCBinaryExpr::NE: Result = LHS != RHS; break;
case MCBinaryExpr::Or: Result = LHS | RHS; break;
- case MCBinaryExpr::Shl: Result =
LHS << RHS
; break;
+ case MCBinaryExpr::Shl: Result =
uint64_t(LHS) << uint64_t(RHS)
; break;
case MCBinaryExpr::Sub: Result = LHS - RHS; break;
case MCBinaryExpr::Xor: Result = LHS ^ RHS; break;
}
case MCBinaryExpr::Sub: Result = LHS - RHS; break;
case MCBinaryExpr::Xor: Result = LHS ^ RHS; break;
}
@@
-755,45
+777,41
@@
bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
llvm_unreachable("Invalid assembly expression kind!");
}
llvm_unreachable("Invalid assembly expression kind!");
}
-MC
Section *MCExpr::FindAssociatedSection
() const {
+MC
Fragment *MCExpr::findAssociatedFragment
() const {
switch (getKind()) {
case Target:
// We never look through target specific expressions.
switch (getKind()) {
case Target:
// We never look through target specific expressions.
- return cast<MCTargetExpr>(this)->
FindAssociatedSection
();
+ return cast<MCTargetExpr>(this)->
findAssociatedFragment
();
case Constant:
case Constant:
- return MCSymbol::AbsolutePseudo
Section
;
+ return MCSymbol::AbsolutePseudo
Fragment
;
case SymbolRef: {
const MCSymbolRefExpr *SRE = cast<MCSymbolRefExpr>(this);
const MCSymbol &Sym = SRE->getSymbol();
case SymbolRef: {
const MCSymbolRefExpr *SRE = cast<MCSymbolRefExpr>(this);
const MCSymbol &Sym = SRE->getSymbol();
-
- if (Sym.isDefined())
- return &Sym.getSection();
-
- return nullptr;
+ return Sym.getFragment();
}
case Unary:
}
case Unary:
- return cast<MCUnaryExpr>(this)->getSubExpr()->
FindAssociatedSection
();
+ return cast<MCUnaryExpr>(this)->getSubExpr()->
findAssociatedFragment
();
case Binary: {
const MCBinaryExpr *BE = cast<MCBinaryExpr>(this);
case Binary: {
const MCBinaryExpr *BE = cast<MCBinaryExpr>(this);
- MC
Section *LHS_S = BE->getLHS()->FindAssociatedSection
();
- MC
Section *RHS_S = BE->getRHS()->FindAssociatedSection
();
+ MC
Fragment *LHS_F = BE->getLHS()->findAssociatedFragment
();
+ MC
Fragment *RHS_F = BE->getRHS()->findAssociatedFragment
();
- // If either
section
is absolute, return the other.
- if (LHS_
S == MCSymbol::AbsolutePseudoSection
)
- return RHS_
S
;
- if (RHS_
S == MCSymbol::AbsolutePseudoSection
)
- return LHS_
S
;
+ // If either is absolute, return the other.
+ if (LHS_
F == MCSymbol::AbsolutePseudoFragment
)
+ return RHS_
F
;
+ if (RHS_
F == MCSymbol::AbsolutePseudoFragment
)
+ return LHS_
F
;
// Not always correct, but probably the best we can do without more context.
if (BE->getOpcode() == MCBinaryExpr::Sub)
// Not always correct, but probably the best we can do without more context.
if (BE->getOpcode() == MCBinaryExpr::Sub)
- return MCSymbol::AbsolutePseudo
Section
;
+ return MCSymbol::AbsolutePseudo
Fragment
;
- // Otherwise, return the first non-null
section
.
- return LHS_
S ? LHS_S : RHS_S
;
+ // Otherwise, return the first non-null
fragment
.
+ return LHS_
F ? LHS_F : RHS_F
;
}
}
}
}