Skip to content

Commit fe56c4c

Browse files
committed
[MC] Remove unneeded VK_None argument from MCSymbolRefExpr::create. NFC
1 parent 7e5821b commit fe56c4c

28 files changed

+57
-102
lines changed

llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,10 +1581,8 @@ const MCExpr *TargetLoweringObjectFileMachO::getIndirectSymViaGOTPCRel(
15811581
StubSym = MachineModuleInfoImpl::StubValueTy(const_cast<MCSymbol *>(Sym),
15821582
!GV->hasLocalLinkage());
15831583

1584-
const MCExpr *BSymExpr =
1585-
MCSymbolRefExpr::create(BaseSym, MCSymbolRefExpr::VK_None, Ctx);
1586-
const MCExpr *LHS =
1587-
MCSymbolRefExpr::create(Stub, MCSymbolRefExpr::VK_None, Ctx);
1584+
const MCExpr *BSymExpr = MCSymbolRefExpr::create(BaseSym, Ctx);
1585+
const MCExpr *LHS = MCSymbolRefExpr::create(Stub, Ctx);
15881586

15891587
if (!Offset)
15901588
return MCBinaryExpr::createSub(LHS, BSymExpr, Ctx);
@@ -2306,8 +2304,7 @@ const MCExpr *TargetLoweringObjectFileWasm::lowerRelativeReference(
23062304
return nullptr;
23072305

23082306
return MCBinaryExpr::createSub(
2309-
MCSymbolRefExpr::create(TM.getSymbol(LHS), MCSymbolRefExpr::VK_None,
2310-
getContext()),
2307+
MCSymbolRefExpr::create(TM.getSymbol(LHS), getContext()),
23112308
MCSymbolRefExpr::create(TM.getSymbol(RHS), getContext()), getContext());
23122309
}
23132310

llvm/lib/MC/MCELFStreamer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,7 @@ void MCELFStreamer::finalizeCGProfileEntry(const MCSymbolRefExpr *&SRE,
448448
}
449449
S = S->getSection().getBeginSymbol();
450450
S->setUsedInReloc();
451-
SRE = MCSymbolRefExpr::create(S, MCSymbolRefExpr::VK_None, getContext(),
452-
SRE->getLoc());
451+
SRE = MCSymbolRefExpr::create(S, getContext(), SRE->getLoc());
453452
}
454453
const MCConstantExpr *MCOffset = MCConstantExpr::create(Offset, getContext());
455454
if (std::optional<std::pair<bool, std::string>> Err =

llvm/lib/MC/MCParser/AsmParser.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,8 +1187,7 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc,
11871187
// Emit a temporary label to the streamer and refer to it.
11881188
MCSymbol *Sym = Ctx.createTempSymbol();
11891189
Out.emitLabel(Sym);
1190-
Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None,
1191-
getContext());
1190+
Res = MCSymbolRefExpr::create(Sym, getContext());
11921191
EndLoc = FirstTokenLoc;
11931192
return false;
11941193
}
@@ -1315,7 +1314,7 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc,
13151314
// temporary label to the streamer and refer to it.
13161315
MCSymbol *Sym = Ctx.createTempSymbol();
13171316
Out.emitLabel(Sym);
1318-
Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
1317+
Res = MCSymbolRefExpr::create(Sym, getContext());
13191318
EndLoc = Lexer.getTok().getEndLoc();
13201319
Lex(); // Eat identifier.
13211320
return false;

llvm/lib/MC/MCParser/MCAsmParserExtension.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ bool MCAsmParserExtension::parseDirectiveCGProfile(StringRef, SMLoc) {
5454
MCSymbol *ToSym = getContext().getOrCreateSymbol(To);
5555

5656
getStreamer().emitCGProfileEntry(
57-
MCSymbolRefExpr::create(FromSym, MCSymbolRefExpr::VK_None, getContext(),
58-
FromLoc),
59-
MCSymbolRefExpr::create(ToSym, MCSymbolRefExpr::VK_None, getContext(),
60-
ToLoc),
61-
Count);
57+
MCSymbolRefExpr::create(FromSym, getContext(), FromLoc),
58+
MCSymbolRefExpr::create(ToSym, getContext(), ToLoc), Count);
6259
return false;
6360
}

llvm/lib/MC/MCParser/MasmParser.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,8 +1404,7 @@ bool MasmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc,
14041404
// temporary label to the streamer and refer to it.
14051405
MCSymbol *Sym = Ctx.createTempSymbol();
14061406
Out.emitLabel(Sym);
1407-
Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None,
1408-
getContext());
1407+
Res = MCSymbolRefExpr::create(Sym, getContext());
14091408
EndLoc = FirstTokenLoc;
14101409
return false;
14111410
}
@@ -1491,8 +1490,8 @@ bool MasmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc,
14911490
}
14921491

14931492
// Otherwise create a symbol ref.
1494-
const MCExpr *SymRef = MCSymbolRefExpr::create(
1495-
Sym, MCSymbolRefExpr::VK_None, getContext(), FirstTokenLoc);
1493+
const MCExpr *SymRef =
1494+
MCSymbolRefExpr::create(Sym, getContext(), FirstTokenLoc);
14961495
if (Info.Offset) {
14971496
Res = MCBinaryExpr::create(
14981497
MCBinaryExpr::Add, SymRef,
@@ -1548,7 +1547,7 @@ bool MasmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc,
15481547
// temporary label to the streamer and refer to it.
15491548
MCSymbol *Sym = Ctx.createTempSymbol();
15501549
Out.emitLabel(Sym);
1551-
Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
1550+
Res = MCSymbolRefExpr::create(Sym, getContext());
15521551
EndLoc = Lexer.getTok().getEndLoc();
15531552
Lex(); // Eat identifier.
15541553
return false;

llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,8 +1362,7 @@ void AArch64AsmPrinter::emitFunctionEntryLabel() {
13621362
auto emitFunctionAlias = [&](MCSymbol *Src, MCSymbol *Dst) {
13631363
OutStreamer->emitSymbolAttribute(Src, MCSA_WeakAntiDep);
13641364
OutStreamer->emitAssignment(
1365-
Src, MCSymbolRefExpr::create(Dst, MCSymbolRefExpr::VK_None,
1366-
MMI->getContext()));
1365+
Src, MCSymbolRefExpr::create(Dst, MMI->getContext()));
13671366
};
13681367

13691368
auto getSymbolFromMetadata = [&](StringRef Name) {
@@ -1436,8 +1435,7 @@ void AArch64AsmPrinter::emitGlobalAlias(const Module &M,
14361435
OutStreamer->endCOFFSymbolDef();
14371436
OutStreamer->emitSymbolAttribute(Sym, MCSA_Weak);
14381437
OutStreamer->emitAssignment(
1439-
Sym, MCSymbolRefExpr::create(ExpSym, MCSymbolRefExpr::VK_None,
1440-
MMI->getContext()));
1438+
Sym, MCSymbolRefExpr::create(ExpSym, MMI->getContext()));
14411439
return;
14421440
}
14431441
}

llvm/lib/Target/AArch64/AArch64MCInstLower.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,7 @@ MCOperand AArch64MCInstLower::lowerSymbolOperandELF(const MachineOperand &MO,
261261
if (MO.getTargetFlags() & AArch64II::MO_NC)
262262
RefFlags |= AArch64MCExpr::VK_NC;
263263

264-
const MCExpr *Expr =
265-
MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, Ctx);
264+
const MCExpr *Expr = MCSymbolRefExpr::create(Sym, Ctx);
266265
if (!MO.isJTI() && MO.getOffset())
267266
Expr = MCBinaryExpr::createAdd(
268267
Expr, MCConstantExpr::create(MO.getOffset(), Ctx), Ctx);
@@ -316,8 +315,7 @@ MCOperand AArch64MCInstLower::lowerSymbolOperandCOFF(const MachineOperand &MO,
316315
RefFlags |= AArch64MCExpr::VK_NC;
317316
}
318317

319-
const MCExpr *Expr =
320-
MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, Ctx);
318+
const MCExpr *Expr = MCSymbolRefExpr::create(Sym, Ctx);
321319
if (!MO.isJTI() && MO.getOffset())
322320
Expr = MCBinaryExpr::createAdd(
323321
Expr, MCConstantExpr::create(MO.getOffset(), Ctx), Ctx);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ void AArch64TargetELFStreamer::finish() {
537537
const auto &Sym = cast<MCSymbolELF>(Symbol);
538538
if (!Sym.isMemtag())
539539
continue;
540-
auto *SRE = MCSymbolRefExpr::create(&Sym, MCSymbolRefExpr::VK_None, Ctx);
540+
auto *SRE = MCSymbolRefExpr::create(&Sym, Ctx);
541541
(void)S.emitRelocDirective(*Zero, "BFD_RELOC_NONE", SRE, SMLoc(),
542542
*Ctx.getSubtargetInfo());
543543
}

llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ ParseStatus CSKYAsmParser::parseCSKYSymbol(OperandVector &Operands) {
12051205
}
12061206
Res = V;
12071207
} else
1208-
Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
1208+
Res = MCSymbolRefExpr::create(Sym, getContext());
12091209

12101210
MCBinaryExpr::Opcode Opcode;
12111211
switch (getLexer().getKind()) {
@@ -1277,7 +1277,7 @@ ParseStatus CSKYAsmParser::parseDataSymbol(OperandVector &Operands) {
12771277
}
12781278
Res = V;
12791279
} else {
1280-
Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
1280+
Res = MCSymbolRefExpr::create(Sym, getContext());
12811281
}
12821282

12831283
MCBinaryExpr::Opcode Opcode;
@@ -1352,7 +1352,7 @@ ParseStatus CSKYAsmParser::parseConstpoolSymbol(OperandVector &Operands) {
13521352
}
13531353
Res = V;
13541354
} else {
1355-
Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
1355+
Res = MCSymbolRefExpr::create(Sym, getContext());
13561356
}
13571357

13581358
MCBinaryExpr::Opcode Opcode;

llvm/lib/Target/CSKY/CSKYAsmPrinter.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ void CSKYAsmPrinter::emitMachineConstantPoolValue(
219219
MCSym = GetExternalSymbolSymbol(Sym);
220220
}
221221
// Create an MCSymbol for the reference.
222-
const MCExpr *Expr =
223-
MCSymbolRefExpr::create(MCSym, MCSymbolRefExpr::VK_None, OutContext);
222+
const MCExpr *Expr = MCSymbolRefExpr::create(MCSym, OutContext);
224223

225224
if (CCPV->getPCAdjustment()) {
226225

0 commit comments

Comments
 (0)