Skip to content

Commit fd511f1

Browse files
committed
AArch64: Change getSpecifierName to take Specifier parameter
1 parent 732c07a commit fd511f1

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ const MCAsmInfo::AtSpecifier MachOAtSpecifiers[] = {
5353
{AArch64::S_MACHO_TLVPPAGEOFF, "TLVPPAGEOFF"},
5454
};
5555

56-
StringRef AArch64::getSpecifierName(const MCSpecifierExpr &Expr) {
56+
StringRef AArch64::getSpecifierName(AArch64::Specifier S) {
5757
// clang-format off
58-
switch (static_cast<uint32_t>(Expr.getSpecifier())) {
58+
switch (static_cast<uint32_t>(S)) {
5959
case AArch64::S_CALL: return "";
6060
case AArch64::S_LO12: return ":lo12:";
6161
case AArch64::S_ABS_G3: return ":abs_g3:";
@@ -183,7 +183,7 @@ void AArch64MCAsmInfoDarwin::printSpecifierExpr(
183183
raw_ostream &OS, const MCSpecifierExpr &Expr) const {
184184
if (auto *AE = dyn_cast<AArch64AuthMCExpr>(&Expr))
185185
return AE->print(OS, this);
186-
OS << AArch64::getSpecifierName(Expr);
186+
OS << AArch64::getSpecifierName(Expr.getSpecifier());
187187
printExpr(OS, *Expr.getSubExpr());
188188
}
189189

@@ -232,7 +232,7 @@ void AArch64MCAsmInfoELF::printSpecifierExpr(
232232
raw_ostream &OS, const MCSpecifierExpr &Expr) const {
233233
if (auto *AE = dyn_cast<AArch64AuthMCExpr>(&Expr))
234234
return AE->print(OS, this);
235-
OS << AArch64::getSpecifierName(Expr);
235+
OS << AArch64::getSpecifierName(Expr.getSpecifier());
236236
printExpr(OS, *Expr.getSubExpr());
237237
}
238238

@@ -262,7 +262,7 @@ AArch64MCAsmInfoMicrosoftCOFF::AArch64MCAsmInfoMicrosoftCOFF() {
262262

263263
void AArch64MCAsmInfoMicrosoftCOFF::printSpecifierExpr(
264264
raw_ostream &OS, const MCSpecifierExpr &Expr) const {
265-
OS << AArch64::getSpecifierName(Expr);
265+
OS << AArch64::getSpecifierName(Expr.getSpecifier());
266266
printExpr(OS, *Expr.getSubExpr());
267267
}
268268

@@ -292,7 +292,7 @@ AArch64MCAsmInfoGNUCOFF::AArch64MCAsmInfoGNUCOFF() {
292292

293293
void AArch64MCAsmInfoGNUCOFF::printSpecifierExpr(
294294
raw_ostream &OS, const MCSpecifierExpr &Expr) const {
295-
OS << AArch64::getSpecifierName(Expr);
295+
OS << AArch64::getSpecifierName(Expr.getSpecifier());
296296
printExpr(OS, *Expr.getSubExpr());
297297
}
298298

llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ enum {
181181

182182
/// Return the string representation of the ELF relocation specifier
183183
/// (e.g. ":got:", ":lo12:").
184-
StringRef getSpecifierName(const MCSpecifierExpr &Expr);
184+
StringRef getSpecifierName(Specifier S);
185185

186186
inline Specifier getSymbolLoc(Specifier S) {
187187
return static_cast<Specifier>(S & AArch64::S_SymLocBits);

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,21 @@ unsigned AArch64WinCOFFObjectWriter::getRelocType(
7373
// Supported
7474
break;
7575
default:
76-
Ctx.reportError(Fixup.getLoc(), "relocation specifier " +
77-
AArch64::getSpecifierName(*A64E) +
78-
" unsupported on COFF targets");
76+
Ctx.reportError(Fixup.getLoc(),
77+
"relocation specifier " +
78+
AArch64::getSpecifierName(A64E->getSpecifier()) +
79+
" unsupported on COFF targets");
7980
return COFF::IMAGE_REL_ARM64_ABSOLUTE; // Dummy return value
8081
}
8182
}
8283

8384
switch (FixupKind) {
8485
default: {
8586
if (auto *A64E = dyn_cast<MCSpecifierExpr>(Expr)) {
86-
Ctx.reportError(Fixup.getLoc(), "relocation specifier " +
87-
AArch64::getSpecifierName(*A64E) +
88-
" unsupported on COFF targets");
87+
Ctx.reportError(Fixup.getLoc(),
88+
"relocation specifier " +
89+
AArch64::getSpecifierName(A64E->getSpecifier()) +
90+
" unsupported on COFF targets");
8991
} else {
9092
MCFixupKindInfo Info = MAB.getFixupKindInfo(Fixup.getKind());
9193
Ctx.reportError(Fixup.getLoc(), Twine("relocation type ") + Info.Name +

0 commit comments

Comments
 (0)