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;

llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ unsigned WebAssemblyWasmObjectWriter::getRelocType(
6666
const MCValue &Target, const MCFixup &Fixup,
6767
const MCSectionWasm &FixupSection, bool IsLocRel) const {
6868
auto &SymA = cast<MCSymbolWasm>(*Target.getAddSym());
69-
auto Spec = Target.getSymSpecifier();
69+
auto Spec = Target.getSpecifier();
7070
switch (Spec) {
7171
case MCSymbolRefExpr::VK_GOT:
7272
case MCSymbolRefExpr::VK_WASM_GOT_TLS:

llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ bool X86AsmBackend::fixupNeedsRelaxationAdvanced(const MCAssembler &Asm,
744744
if (Fixup.getKind() == FK_Data_1) {
745745
MCValue Target;
746746
if (Fixup.getValue()->evaluateAsRelocatable(Target, &Asm) &&
747-
Target.getAddSym() && Target.getSymSpecifier() == X86MCExpr::VK_ABS8)
747+
Target.getAddSym() && Target.getSpecifier() == X86MCExpr::VK_ABS8)
748748
return false;
749749
}
750750
return true;

llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ unsigned X86ELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target,
391391
bool X86ELFObjectWriter::needsRelocateWithSymbol(const MCValue &V,
392392
const MCSymbol &Sym,
393393
unsigned Type) const {
394-
switch (V.getSymSpecifier()) {
394+
switch (V.getSpecifier()) {
395395
case X86MCExpr::VK_GOT:
396396
case X86MCExpr::VK_PLT:
397397
case X86MCExpr::VK_GOTPCREL:

llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ void X86MachObjectWriter::RecordX86_64Relocation(
151151
const MCSymbol *B_Base = Writer->getAtom(*B);
152152

153153
// Neither symbol can be modified.
154-
if (Target.getSymSpecifier()) {
154+
if (Target.getSpecifier()) {
155155
Asm.getContext().reportError(Fixup.getLoc(),
156156
"unsupported relocation of modified symbol");
157157
return;
@@ -266,7 +266,7 @@ void X86MachObjectWriter::RecordX86_64Relocation(
266266
return;
267267
}
268268

269-
auto Specifier = Target.getSymSpecifier();
269+
auto Specifier = Target.getSpecifier();
270270
if (IsPCRel) {
271271
if (IsRIPRel) {
272272
if (Specifier == X86MCExpr::VK_GOTPCREL) {
@@ -461,7 +461,7 @@ void X86MachObjectWriter::recordTLVPRelocation(MachObjectWriter *Writer,
461461
MCValue Target,
462462
uint64_t &FixedValue) {
463463
const MCSymbol *SymA = Target.getAddSym();
464-
assert(Target.getSymSpecifier() == X86MCExpr::VK_TLVP && !is64Bit() &&
464+
assert(Target.getSpecifier() == X86MCExpr::VK_TLVP && !is64Bit() &&
465465
"Should only be called with a 32-bit TLVP relocation!");
466466

467467
unsigned Log2Size = getFixupKindLog2Size(Fixup.getKind());
@@ -503,7 +503,7 @@ void X86MachObjectWriter::RecordX86Relocation(MachObjectWriter *Writer,
503503
const MCSymbol *A = Target.getAddSym();
504504

505505
// If this is a 32-bit TLVP reloc it's handled a bit differently.
506-
if (A && Target.getSymSpecifier() == X86MCExpr::VK_TLVP) {
506+
if (A && Target.getSpecifier() == X86MCExpr::VK_TLVP) {
507507
recordTLVPRelocation(Writer, Asm, Fragment, Fixup, Target, FixedValue);
508508
return;
509509
}

llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ unsigned X86WinCOFFObjectWriter::getRelocType(MCContext &Ctx,
5959
}
6060
}
6161

62-
auto Spec = Target.getAddSym() ? Target.getSymSpecifier() : 0;
62+
auto Spec = Target.getSpecifier();
6363
if (Is64Bit) {
6464
switch (FixupKind) {
6565
case FK_PCRel_4:

0 commit comments

Comments
 (0)