Skip to content

Commit e592393

Browse files
committed
MCValue: Replace getSymSpecifier with getSpecifier
Commit 52eb11f temporarily introduced getSymSpecifier to prepare for "MCValue: Replace MCSymbolRefExpr members with MCSymbol" (d5893fc). The refactoring is now complete.
1 parent 803fbdd commit e592393

File tree

15 files changed

+20
-24
lines changed

15 files changed

+20
-24
lines changed

llvm/include/llvm/MC/MCValue.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ class MCValue {
5555

5656
// Get the relocation specifier from SymA. This is a workaround for targets
5757
// that do not use MCValue::Specifier.
58-
uint16_t getSymSpecifier() const { return Specifier; }
59-
// Get the relocation specifier from SymA, or 0 when SymA is null.
6058
uint16_t getAccessVariant() const { return Specifier; }
6159

6260
static MCValue get(const MCSymbol *SymA, const MCSymbol *SymB = nullptr,

llvm/lib/MC/MCAssembler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ bool MCAssembler::isThumbFunc(const MCSymbol *Symbol) const {
126126
return false;
127127

128128
auto *Sym = V.getAddSym();
129-
if (!Sym || V.getSymSpecifier())
129+
if (!Sym || V.getSpecifier())
130130
return false;
131131

132132
if (!isThumbFunc(Sym))

llvm/lib/MC/WasmObjectWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ void WasmObjectWriter::recordRelocation(MCAssembler &Asm,
606606
SymA->setUsedInReloc();
607607
}
608608

609-
switch (Target.getSymSpecifier()) {
609+
switch (Target.getSpecifier()) {
610610
case MCSymbolRefExpr::VK_GOT:
611611
case MCSymbolRefExpr::VK_WASM_GOT_TLS:
612612
SymA->setUsedInGOT();

llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8224,7 +8224,7 @@ bool AArch64AsmParser::classifySymbolRef(const MCExpr *Expr,
82248224
return false;
82258225

82268226
if (Res.getAddSym())
8227-
DarwinSpec = AArch64MCExpr::Specifier(Res.getSymSpecifier());
8227+
DarwinSpec = AArch64MCExpr::Specifier(Res.getSpecifier());
82288228
Addend = Res.getConstant();
82298229

82308230
// It's some symbol reference + a constant addend, but really

llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ void AArch64MachObjectWriter::recordRelocation(
192192
}
193193

194194
if (!getAArch64FixupKindMachOInfo(
195-
Fixup, Type, AArch64MCExpr::Specifier(Target.getSymSpecifier()),
195+
Fixup, Type, AArch64MCExpr::Specifier(Target.getSpecifier()),
196196
Log2Size, Asm)) {
197197
Asm.getContext().reportError(Fixup.getLoc(), "unknown AArch64 fixup kind!");
198198
return;
@@ -221,7 +221,7 @@ void AArch64MachObjectWriter::recordRelocation(
221221
// Check for "_foo@got - .", which comes through here as:
222222
// Ltmp0:
223223
// ... _foo@got - Ltmp0
224-
if (Target.getSymSpecifier() == AArch64MCExpr::M_GOT &&
224+
if (Target.getSpecifier() == AArch64MCExpr::M_GOT &&
225225
Asm.getSymbolOffset(*B) ==
226226
Asm.getFragmentOffset(*Fragment) + Fixup.getOffset()) {
227227
// SymB is the PC, so use a PC-rel pointer-to-GOT relocation.
@@ -232,7 +232,7 @@ void AArch64MachObjectWriter::recordRelocation(
232232
MRE.r_word1 = (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);
233233
Writer->addRelocation(A_Base, Fragment->getParent(), MRE);
234234
return;
235-
} else if (Target.getSymSpecifier() != AArch64MCExpr::None) {
235+
} else if (Target.getSpecifier() != AArch64MCExpr::None) {
236236
// Otherwise, neither symbol can be modified.
237237
Asm.getContext().reportError(Fixup.getLoc(),
238238
"unsupported relocation of modified symbol");

llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFObjectWriter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ unsigned AArch64WinCOFFObjectWriter::getRelocType(
6161
FixupKind = FK_PCRel_4;
6262
}
6363

64-
auto Modifier =
65-
Target.isAbsolute() ? AArch64MCExpr::None : Target.getSymSpecifier();
64+
auto Spec = Target.getSpecifier();
6665
const MCExpr *Expr = Fixup.getValue();
6766

6867
if (const AArch64MCExpr *A64E = dyn_cast<AArch64MCExpr>(Expr)) {
@@ -98,7 +97,7 @@ unsigned AArch64WinCOFFObjectWriter::getRelocType(
9897
return COFF::IMAGE_REL_ARM64_REL32;
9998

10099
case FK_Data_4:
101-
switch (Modifier) {
100+
switch (Spec) {
102101
default:
103102
return COFF::IMAGE_REL_ARM64_ADDR32;
104103
case MCSymbolRefExpr::VK_COFF_IMGREL32:

llvm/lib/Target/ARM/MCTargetDesc/ARMWinCOFFObjectWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ unsigned ARMWinCOFFObjectWriter::getRelocType(MCContext &Ctx,
4444
const MCFixup &Fixup,
4545
bool IsCrossSection,
4646
const MCAsmBackend &MAB) const {
47-
auto Spec = Target.getAddSym() ? Target.getSymSpecifier() : 0;
47+
auto Spec = Target.getSpecifier();
4848
unsigned FixupKind = Fixup.getKind();
4949
if (IsCrossSection) {
5050
if (FixupKind != FK_Data_4) {

llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ bool AVRMCExpr::evaluateAsRelocatableImpl(MCValue &Result,
8181
return false;
8282

8383
auto Spec = AVRMCExpr::VK_None;
84-
if (Value.getSymSpecifier() != MCSymbolRefExpr::VK_None)
84+
if (Value.getSpecifier() != MCSymbolRefExpr::VK_None)
8585
return false;
8686
assert(!Value.getSubSym());
8787
if (specifier == VK_PM)

llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFObjectWriter.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ llvm::createPPCXCOFFObjectWriter(bool Is64Bit) {
4040

4141
std::pair<uint8_t, uint8_t> PPCXCOFFObjectWriter::getRelocTypeAndSignSize(
4242
const MCValue &Target, const MCFixup &Fixup, bool IsPCRel) const {
43-
const auto Specifier =
44-
Target.isAbsolute() ? PPCMCExpr::VK_None : Target.getSymSpecifier();
43+
const auto Specifier = Target.getSpecifier();
4544
// People from AIX OS team says AIX link editor does not care about
4645
// the sign bit in the relocation entry "most" of the time.
4746
// The system assembler seems to set the sign bit on relocation entry

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZELFObjectWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ unsigned SystemZELFObjectWriter::getRelocType(MCContext &Ctx,
220220
bool SystemZELFObjectWriter::needsRelocateWithSymbol(const MCValue &V,
221221
const MCSymbol &Sym,
222222
unsigned Type) const {
223-
switch (V.getSymSpecifier()) {
223+
switch (V.getSpecifier()) {
224224
case SystemZMCExpr::VK_GOT:
225225
case SystemZMCExpr::VK_PLT:
226226
return true;

0 commit comments

Comments
 (0)