Skip to content

Commit c0b4a8e

Browse files
committed
MCValue: Replace getRefKind with getSpecifier
1 parent e7dc05e commit c0b4a8e

File tree

16 files changed

+22
-23
lines changed

16 files changed

+22
-23
lines changed

llvm/include/llvm/MC/MCValue.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class MCValue {
4242
friend class MCExpr;
4343
MCValue() = default;
4444
int64_t getConstant() const { return Cst; }
45-
uint32_t getRefKind() const { return Specifier; }
4645
uint32_t getSpecifier() const { return Specifier; }
4746
void setSpecifier(uint32_t S) { Specifier = S; }
4847

llvm/lib/MC/MCAssembler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ bool MCAssembler::isThumbFunc(const MCSymbol *Symbol) const {
122122
if (!Expr->evaluateAsRelocatable(V, nullptr))
123123
return false;
124124

125-
if (V.getSubSym() || V.getRefKind() != MCSymbolRefExpr::VK_None)
125+
if (V.getSubSym() || V.getSpecifier() != MCSymbolRefExpr::VK_None)
126126
return false;
127127

128128
auto *Sym = V.getAddSym();

llvm/lib/MC/MCExpr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ bool MCExpr::evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
291291
// Value with RefKind (e.g. %hi(0xdeadbeef) in MIPS) is not considered
292292
// absolute (the value is unknown at parse time), even if it might be resolved
293293
// by evaluateFixup.
294-
return IsRelocatable && Value.isAbsolute() && Value.getRefKind() == 0;
294+
return IsRelocatable && Value.isAbsolute() && Value.getSpecifier() == 0;
295295
}
296296

297297
/// Helper method for \see EvaluateSymbolAdd().
@@ -533,7 +533,7 @@ bool MCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
533533
// If the reference has a variant kind, we can only handle expressions
534534
// which evaluate exactly to a single unadorned symbol. Attach the
535535
// original VariantKind to SymA of the result.
536-
if (Res.getRefKind() != MCSymbolRefExpr::VK_None ||
536+
if (Res.getSpecifier() != MCSymbolRefExpr::VK_None ||
537537
!Res.getAddSym() || Res.getSubSym() || Res.getConstant())
538538
return false;
539539
Res.Specifier = Kind;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static uint64_t adjustFixupValue(const MCFixup &Fixup, const MCValue &Target,
222222
return Value >> 4;
223223
case AArch64::fixup_aarch64_movw: {
224224
AArch64MCExpr::Specifier RefKind =
225-
static_cast<AArch64MCExpr::Specifier>(Target.getRefKind());
225+
static_cast<AArch64MCExpr::Specifier>(Target.getSpecifier());
226226
if (AArch64MCExpr::getSymbolLoc(RefKind) != AArch64MCExpr::VK_ABS &&
227227
AArch64MCExpr::getSymbolLoc(RefKind) != AArch64MCExpr::VK_SABS) {
228228
if (!RefKind) {
@@ -422,7 +422,7 @@ void AArch64AsmBackend::applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
422422
bool IsResolved,
423423
const MCSubtargetInfo *STI) const {
424424
if (Fixup.getTargetKind() == FK_Data_8 && TheTriple.isOSBinFormatELF()) {
425-
auto RefKind = static_cast<AArch64MCExpr::Specifier>(Target.getRefKind());
425+
auto RefKind = static_cast<AArch64MCExpr::Specifier>(Target.getSpecifier());
426426
AArch64MCExpr::Specifier SymLoc = AArch64MCExpr::getSymbolLoc(RefKind);
427427
if (SymLoc == AArch64AuthMCExpr::VK_AUTH ||
428428
SymLoc == AArch64AuthMCExpr::VK_AUTHADDR) {
@@ -480,7 +480,7 @@ void AArch64AsmBackend::applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
480480
// FIXME: getFixupKindInfo() and getFixupKindNumBytes() could be fixed to
481481
// handle this more cleanly. This may affect the output of -show-mc-encoding.
482482
AArch64MCExpr::Specifier RefKind =
483-
static_cast<AArch64MCExpr::Specifier>(Target.getRefKind());
483+
static_cast<AArch64MCExpr::Specifier>(Target.getSpecifier());
484484
if (AArch64MCExpr::getSymbolLoc(RefKind) == AArch64MCExpr::VK_SABS ||
485485
(!RefKind && Fixup.getTargetKind() == AArch64::fixup_aarch64_movw)) {
486486
// If the immediate is negative, generate MOVN else MOVZ.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
112112
if (Kind >= FirstLiteralRelocationKind)
113113
return Kind - FirstLiteralRelocationKind;
114114
AArch64MCExpr::Specifier RefKind =
115-
static_cast<AArch64MCExpr::Specifier>(Target.getRefKind());
115+
static_cast<AArch64MCExpr::Specifier>(Target.getSpecifier());
116116
AArch64MCExpr::Specifier SymLoc = AArch64MCExpr::getSymbolLoc(RefKind);
117117
bool IsNC = AArch64MCExpr::isNotChecked(RefKind);
118118

@@ -543,7 +543,7 @@ bool AArch64ELFObjectWriter::needsRelocateWithSymbol(const MCValue &Val,
543543
if (Val.getAddSym() && cast<MCSymbolELF>(Val.getAddSym())->isMemtag())
544544
return true;
545545

546-
if ((Val.getRefKind() & AArch64MCExpr::VK_GOT) == AArch64MCExpr::VK_GOT)
546+
if ((Val.getSpecifier() & AArch64MCExpr::VK_GOT) == AArch64MCExpr::VK_GOT)
547547
return true;
548548
return is_contained({AArch64MCExpr::VK_GOTPCREL, AArch64MCExpr::VK_PLT},
549549
AArch64MCExpr::Specifier(Val.getSpecifier()));

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,8 @@ void AArch64MachObjectWriter::recordRelocation(
391391
Value = 0;
392392
}
393393

394-
if (Target.getRefKind() == AArch64MCExpr::VK_AUTH ||
395-
Target.getRefKind() == AArch64MCExpr::VK_AUTHADDR) {
394+
if (Target.getSpecifier() == AArch64MCExpr::VK_AUTH ||
395+
Target.getSpecifier() == AArch64MCExpr::VK_AUTHADDR) {
396396
auto *Expr = cast<AArch64AuthMCExpr>(Fixup.getValue());
397397

398398
assert(Type == MachO::ARM64_RELOC_UNSIGNED);

llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ unsigned CSKYELFObjectWriter::getRelocType(MCContext &Ctx,
4444
unsigned Kind = Fixup.getTargetKind();
4545
uint8_t Modifier = Target.getSpecifier();
4646

47-
switch (Target.getRefKind()) {
47+
switch (Target.getSpecifier()) {
4848
case CSKYMCExpr::VK_TLSIE:
4949
case CSKYMCExpr::VK_TLSLE:
5050
case CSKYMCExpr::VK_TLSGD:
@@ -170,7 +170,7 @@ unsigned CSKYELFObjectWriter::getRelocType(MCContext &Ctx,
170170
bool CSKYELFObjectWriter::needsRelocateWithSymbol(const MCValue &V,
171171
const MCSymbol &,
172172
unsigned Type) const {
173-
switch (V.getRefKind()) {
173+
switch (V.getSpecifier()) {
174174
case CSKYMCExpr::VK_PLT:
175175
case CSKYMCExpr::VK_GOT:
176176
return true;

llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ bool LoongArchAsmParser::classifySymbolRef(const MCExpr *Expr,
707707

708708
MCValue Res;
709709
if (Expr->evaluateAsRelocatable(Res, nullptr))
710-
return Res.getRefKind() == LoongArchMCExpr::VK_None;
710+
return Res.getSpecifier() == LoongArchMCExpr::VK_None;
711711
return false;
712712
}
713713

llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ bool LoongArchAsmBackend::handleAddSubRelocations(const MCAssembler &Asm,
452452
const MCFixup &Fixup,
453453
const MCValue &Target,
454454
uint64_t &FixedValue) const {
455-
assert(Target.getRefKind() == 0 &&
455+
assert(Target.getSpecifier() == 0 &&
456456
"relocatable SymA-SymB cannot have relocation specifier");
457457
std::pair<MCFixupKind, MCFixupKind> FK;
458458
uint64_t FixedValueA, FixedValueB;

llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ unsigned LoongArchELFObjectWriter::getRelocType(MCContext &Ctx,
5050
const MCValue &Target,
5151
const MCFixup &Fixup,
5252
bool IsPCRel) const {
53-
switch (Target.getRefKind()) {
53+
switch (Target.getSpecifier()) {
5454
case LoongArchMCExpr::VK_TLS_LE_HI20:
5555
case LoongArchMCExpr::VK_TLS_IE_PC_HI20:
5656
case LoongArchMCExpr::VK_TLS_IE_HI20:

llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ unsigned MipsELFObjectWriter::getRelocType(MCContext &Ctx,
162162
if (Kind >= FirstLiteralRelocationKind)
163163
return Kind - FirstLiteralRelocationKind;
164164

165-
switch (Target.getRefKind()) {
165+
switch (Target.getSpecifier()) {
166166
case MipsMCExpr::MEK_DTPREL:
167167
case MipsMCExpr::MEK_DTPREL_HI:
168168
case MipsMCExpr::MEK_DTPREL_LO:

llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2798,14 +2798,14 @@ bool RISCVAsmParser::classifySymbolRef(const MCExpr *Expr,
27982798

27992799
MCValue Res;
28002800
if (Expr->evaluateAsRelocatable(Res, nullptr))
2801-
return Res.getRefKind() == RISCVMCExpr::VK_None;
2801+
return Res.getSpecifier() == RISCVMCExpr::VK_None;
28022802
return false;
28032803
}
28042804

28052805
bool RISCVAsmParser::isSymbolDiff(const MCExpr *Expr) {
28062806
MCValue Res;
28072807
if (Expr->evaluateAsRelocatable(Res, nullptr)) {
2808-
return Res.getRefKind() == RISCVMCExpr::VK_None && Res.getAddSym() &&
2808+
return Res.getSpecifier() == RISCVMCExpr::VK_None && Res.getAddSym() &&
28092809
Res.getSubSym();
28102810
}
28112811
return false;

llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ bool RISCVAsmBackend::handleAddSubRelocations(const MCAssembler &Asm,
628628
const MCFixup &Fixup,
629629
const MCValue &Target,
630630
uint64_t &FixedValue) const {
631-
assert(Target.getRefKind() == 0 &&
631+
assert(Target.getSpecifier() == 0 &&
632632
"relocatable SymA-SymB cannot have relocation specifier");
633633
uint64_t FixedValueA, FixedValueB;
634634
unsigned TA = 0, TB = 0;

llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ unsigned RISCVELFObjectWriter::getRelocType(MCContext &Ctx,
5656
if (Kind >= FirstLiteralRelocationKind)
5757
return Kind - FirstLiteralRelocationKind;
5858

59-
auto Spec = RISCVMCExpr::Specifier(Target.getRefKind());
59+
auto Spec = RISCVMCExpr::Specifier(Target.getSpecifier());
6060
switch (Spec) {
6161
case RISCVMCExpr::VK_TPREL_HI:
6262
case RISCVMCExpr::VK_TLS_GOT_HI:

llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ unsigned SparcELFObjectWriter::getRelocType(MCContext &Ctx,
4646
if (Kind >= FirstLiteralRelocationKind)
4747
return Kind - FirstLiteralRelocationKind;
4848

49-
switch (Target.getRefKind()) {
49+
switch (Target.getSpecifier()) {
5050
case SparcMCExpr::VK_TLS_GD_HI22:
5151
case SparcMCExpr::VK_TLS_GD_LO10:
5252
case SparcMCExpr::VK_TLS_GD_ADD:

llvm/lib/Target/VE/MCTargetDesc/VEELFObjectWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class VEELFObjectWriter : public MCELFObjectTargetWriter {
4040
unsigned VEELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target,
4141
const MCFixup &Fixup,
4242
bool IsPCRel) const {
43-
switch (Target.getRefKind()) {
43+
switch (Target.getSpecifier()) {
4444
case VEMCExpr::VK_TLS_GD_HI32:
4545
case VEMCExpr::VK_TLS_GD_LO32:
4646
case VEMCExpr::VK_TPOFF_HI32:

0 commit comments

Comments
 (0)