[llvm] fe56c4c - [MC] Remove unneeded VK_None argument from MCSymbolRefExpr::create. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 5 23:14:09 PST 2025
Author: Fangrui Song
Date: 2025-03-05T23:14:04-08:00
New Revision: fe56c4c01972edc51c415c4f410739bbec9f7d13
URL: https://github.com/llvm/llvm-project/commit/fe56c4c01972edc51c415c4f410739bbec9f7d13
DIFF: https://github.com/llvm/llvm-project/commit/fe56c4c01972edc51c415c4f410739bbec9f7d13.diff
LOG: [MC] Remove unneeded VK_None argument from MCSymbolRefExpr::create. NFC
Added:
Modified:
llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/lib/MC/MCELFStreamer.cpp
llvm/lib/MC/MCParser/AsmParser.cpp
llvm/lib/MC/MCParser/MCAsmParserExtension.cpp
llvm/lib/MC/MCParser/MasmParser.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/AArch64/AArch64MCInstLower.cpp
llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp
llvm/lib/Target/CSKY/CSKYAsmPrinter.cpp
llvm/lib/Target/CSKY/CSKYMCInstLower.cpp
llvm/lib/Target/Lanai/LanaiMCInstLower.cpp
llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
llvm/lib/Target/LoongArch/LoongArchMCInstLower.cpp
llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
llvm/lib/Target/Mips/MipsAsmPrinter.cpp
llvm/lib/Target/Mips/MipsTargetObjectFile.cpp
llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp
llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
llvm/lib/Target/TargetLoweringObjectFile.cpp
llvm/lib/Target/X86/X86MCInstLower.cpp
llvm/lib/Target/Xtensa/AsmParser/XtensaAsmParser.cpp
llvm/lib/Target/Xtensa/XtensaAsmPrinter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index be2f5fb0b4a79..00e4533559c28 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -1581,10 +1581,8 @@ const MCExpr *TargetLoweringObjectFileMachO::getIndirectSymViaGOTPCRel(
StubSym = MachineModuleInfoImpl::StubValueTy(const_cast<MCSymbol *>(Sym),
!GV->hasLocalLinkage());
- const MCExpr *BSymExpr =
- MCSymbolRefExpr::create(BaseSym, MCSymbolRefExpr::VK_None, Ctx);
- const MCExpr *LHS =
- MCSymbolRefExpr::create(Stub, MCSymbolRefExpr::VK_None, Ctx);
+ const MCExpr *BSymExpr = MCSymbolRefExpr::create(BaseSym, Ctx);
+ const MCExpr *LHS = MCSymbolRefExpr::create(Stub, Ctx);
if (!Offset)
return MCBinaryExpr::createSub(LHS, BSymExpr, Ctx);
@@ -2306,8 +2304,7 @@ const MCExpr *TargetLoweringObjectFileWasm::lowerRelativeReference(
return nullptr;
return MCBinaryExpr::createSub(
- MCSymbolRefExpr::create(TM.getSymbol(LHS), MCSymbolRefExpr::VK_None,
- getContext()),
+ MCSymbolRefExpr::create(TM.getSymbol(LHS), getContext()),
MCSymbolRefExpr::create(TM.getSymbol(RHS), getContext()), getContext());
}
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp
index 83fa445a8b936..df559f1f6a162 100644
--- a/llvm/lib/MC/MCELFStreamer.cpp
+++ b/llvm/lib/MC/MCELFStreamer.cpp
@@ -448,8 +448,7 @@ void MCELFStreamer::finalizeCGProfileEntry(const MCSymbolRefExpr *&SRE,
}
S = S->getSection().getBeginSymbol();
S->setUsedInReloc();
- SRE = MCSymbolRefExpr::create(S, MCSymbolRefExpr::VK_None, getContext(),
- SRE->getLoc());
+ SRE = MCSymbolRefExpr::create(S, getContext(), SRE->getLoc());
}
const MCConstantExpr *MCOffset = MCConstantExpr::create(Offset, getContext());
if (std::optional<std::pair<bool, std::string>> Err =
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 88398de66f410..1e1b63717ded5 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -1187,8 +1187,7 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc,
// Emit a temporary label to the streamer and refer to it.
MCSymbol *Sym = Ctx.createTempSymbol();
Out.emitLabel(Sym);
- Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None,
- getContext());
+ Res = MCSymbolRefExpr::create(Sym, getContext());
EndLoc = FirstTokenLoc;
return false;
}
@@ -1315,7 +1314,7 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc,
// temporary label to the streamer and refer to it.
MCSymbol *Sym = Ctx.createTempSymbol();
Out.emitLabel(Sym);
- Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ Res = MCSymbolRefExpr::create(Sym, getContext());
EndLoc = Lexer.getTok().getEndLoc();
Lex(); // Eat identifier.
return false;
diff --git a/llvm/lib/MC/MCParser/MCAsmParserExtension.cpp b/llvm/lib/MC/MCParser/MCAsmParserExtension.cpp
index de63aa3538fbe..01808e624dbf0 100644
--- a/llvm/lib/MC/MCParser/MCAsmParserExtension.cpp
+++ b/llvm/lib/MC/MCParser/MCAsmParserExtension.cpp
@@ -54,10 +54,7 @@ bool MCAsmParserExtension::parseDirectiveCGProfile(StringRef, SMLoc) {
MCSymbol *ToSym = getContext().getOrCreateSymbol(To);
getStreamer().emitCGProfileEntry(
- MCSymbolRefExpr::create(FromSym, MCSymbolRefExpr::VK_None, getContext(),
- FromLoc),
- MCSymbolRefExpr::create(ToSym, MCSymbolRefExpr::VK_None, getContext(),
- ToLoc),
- Count);
+ MCSymbolRefExpr::create(FromSym, getContext(), FromLoc),
+ MCSymbolRefExpr::create(ToSym, getContext(), ToLoc), Count);
return false;
}
diff --git a/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp
index 4ef781c54f11d..b7adce918b467 100644
--- a/llvm/lib/MC/MCParser/MasmParser.cpp
+++ b/llvm/lib/MC/MCParser/MasmParser.cpp
@@ -1404,8 +1404,7 @@ bool MasmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc,
// temporary label to the streamer and refer to it.
MCSymbol *Sym = Ctx.createTempSymbol();
Out.emitLabel(Sym);
- Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None,
- getContext());
+ Res = MCSymbolRefExpr::create(Sym, getContext());
EndLoc = FirstTokenLoc;
return false;
}
@@ -1491,8 +1490,8 @@ bool MasmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc,
}
// Otherwise create a symbol ref.
- const MCExpr *SymRef = MCSymbolRefExpr::create(
- Sym, MCSymbolRefExpr::VK_None, getContext(), FirstTokenLoc);
+ const MCExpr *SymRef =
+ MCSymbolRefExpr::create(Sym, getContext(), FirstTokenLoc);
if (Info.Offset) {
Res = MCBinaryExpr::create(
MCBinaryExpr::Add, SymRef,
@@ -1548,7 +1547,7 @@ bool MasmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc,
// temporary label to the streamer and refer to it.
MCSymbol *Sym = Ctx.createTempSymbol();
Out.emitLabel(Sym);
- Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ Res = MCSymbolRefExpr::create(Sym, getContext());
EndLoc = Lexer.getTok().getEndLoc();
Lex(); // Eat identifier.
return false;
diff --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index fc38bfe93c1e0..49d48357b7fc5 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -1362,8 +1362,7 @@ void AArch64AsmPrinter::emitFunctionEntryLabel() {
auto emitFunctionAlias = [&](MCSymbol *Src, MCSymbol *Dst) {
OutStreamer->emitSymbolAttribute(Src, MCSA_WeakAntiDep);
OutStreamer->emitAssignment(
- Src, MCSymbolRefExpr::create(Dst, MCSymbolRefExpr::VK_None,
- MMI->getContext()));
+ Src, MCSymbolRefExpr::create(Dst, MMI->getContext()));
};
auto getSymbolFromMetadata = [&](StringRef Name) {
@@ -1436,8 +1435,7 @@ void AArch64AsmPrinter::emitGlobalAlias(const Module &M,
OutStreamer->endCOFFSymbolDef();
OutStreamer->emitSymbolAttribute(Sym, MCSA_Weak);
OutStreamer->emitAssignment(
- Sym, MCSymbolRefExpr::create(ExpSym, MCSymbolRefExpr::VK_None,
- MMI->getContext()));
+ Sym, MCSymbolRefExpr::create(ExpSym, MMI->getContext()));
return;
}
}
diff --git a/llvm/lib/Target/AArch64/AArch64MCInstLower.cpp b/llvm/lib/Target/AArch64/AArch64MCInstLower.cpp
index 46ce151ca82b6..db8522cabd681 100644
--- a/llvm/lib/Target/AArch64/AArch64MCInstLower.cpp
+++ b/llvm/lib/Target/AArch64/AArch64MCInstLower.cpp
@@ -261,8 +261,7 @@ MCOperand AArch64MCInstLower::lowerSymbolOperandELF(const MachineOperand &MO,
if (MO.getTargetFlags() & AArch64II::MO_NC)
RefFlags |= AArch64MCExpr::VK_NC;
- const MCExpr *Expr =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, Ctx);
+ const MCExpr *Expr = MCSymbolRefExpr::create(Sym, Ctx);
if (!MO.isJTI() && MO.getOffset())
Expr = MCBinaryExpr::createAdd(
Expr, MCConstantExpr::create(MO.getOffset(), Ctx), Ctx);
@@ -316,8 +315,7 @@ MCOperand AArch64MCInstLower::lowerSymbolOperandCOFF(const MachineOperand &MO,
RefFlags |= AArch64MCExpr::VK_NC;
}
- const MCExpr *Expr =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, Ctx);
+ const MCExpr *Expr = MCSymbolRefExpr::create(Sym, Ctx);
if (!MO.isJTI() && MO.getOffset())
Expr = MCBinaryExpr::createAdd(
Expr, MCConstantExpr::create(MO.getOffset(), Ctx), Ctx);
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
index 88005553d721a..a0953e13aa373 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
@@ -537,7 +537,7 @@ void AArch64TargetELFStreamer::finish() {
const auto &Sym = cast<MCSymbolELF>(Symbol);
if (!Sym.isMemtag())
continue;
- auto *SRE = MCSymbolRefExpr::create(&Sym, MCSymbolRefExpr::VK_None, Ctx);
+ auto *SRE = MCSymbolRefExpr::create(&Sym, Ctx);
(void)S.emitRelocDirective(*Zero, "BFD_RELOC_NONE", SRE, SMLoc(),
*Ctx.getSubtargetInfo());
}
diff --git a/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp b/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp
index d7dde11a1ecac..80239453fb3ff 100644
--- a/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp
+++ b/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp
@@ -1205,7 +1205,7 @@ ParseStatus CSKYAsmParser::parseCSKYSymbol(OperandVector &Operands) {
}
Res = V;
} else
- Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ Res = MCSymbolRefExpr::create(Sym, getContext());
MCBinaryExpr::Opcode Opcode;
switch (getLexer().getKind()) {
@@ -1277,7 +1277,7 @@ ParseStatus CSKYAsmParser::parseDataSymbol(OperandVector &Operands) {
}
Res = V;
} else {
- Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ Res = MCSymbolRefExpr::create(Sym, getContext());
}
MCBinaryExpr::Opcode Opcode;
@@ -1352,7 +1352,7 @@ ParseStatus CSKYAsmParser::parseConstpoolSymbol(OperandVector &Operands) {
}
Res = V;
} else {
- Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ Res = MCSymbolRefExpr::create(Sym, getContext());
}
MCBinaryExpr::Opcode Opcode;
diff --git a/llvm/lib/Target/CSKY/CSKYAsmPrinter.cpp b/llvm/lib/Target/CSKY/CSKYAsmPrinter.cpp
index 7f0c2d1dad70b..7ab3b5cb81c2d 100644
--- a/llvm/lib/Target/CSKY/CSKYAsmPrinter.cpp
+++ b/llvm/lib/Target/CSKY/CSKYAsmPrinter.cpp
@@ -219,8 +219,7 @@ void CSKYAsmPrinter::emitMachineConstantPoolValue(
MCSym = GetExternalSymbolSymbol(Sym);
}
// Create an MCSymbol for the reference.
- const MCExpr *Expr =
- MCSymbolRefExpr::create(MCSym, MCSymbolRefExpr::VK_None, OutContext);
+ const MCExpr *Expr = MCSymbolRefExpr::create(MCSym, OutContext);
if (CCPV->getPCAdjustment()) {
diff --git a/llvm/lib/Target/CSKY/CSKYMCInstLower.cpp b/llvm/lib/Target/CSKY/CSKYMCInstLower.cpp
index 7e0b9bcd75491..5fe7eea4f236b 100644
--- a/llvm/lib/Target/CSKY/CSKYMCInstLower.cpp
+++ b/llvm/lib/Target/CSKY/CSKYMCInstLower.cpp
@@ -64,8 +64,7 @@ MCOperand CSKYMCInstLower::lowerSymbolOperand(const MachineOperand &MO,
Kind = CSKYMCExpr::VK_CSKY_ADDR_LO16;
break;
}
- const MCExpr *ME =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, Ctx);
+ const MCExpr *ME = MCSymbolRefExpr::create(Sym, Ctx);
if (Kind != CSKYMCExpr::VK_CSKY_None)
ME = CSKYMCExpr::create(ME, Kind, Ctx);
diff --git a/llvm/lib/Target/Lanai/LanaiMCInstLower.cpp b/llvm/lib/Target/Lanai/LanaiMCInstLower.cpp
index 906a5f0745513..c2fba5dcd89a4 100644
--- a/llvm/lib/Target/Lanai/LanaiMCInstLower.cpp
+++ b/llvm/lib/Target/Lanai/LanaiMCInstLower.cpp
@@ -80,8 +80,7 @@ MCOperand LanaiMCInstLower::LowerSymbolOperand(const MachineOperand &MO,
llvm_unreachable("Unknown target flag on GV operand");
}
- const MCExpr *Expr =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, Ctx);
+ const MCExpr *Expr = MCSymbolRefExpr::create(Sym, Ctx);
if (!MO.isJTI() && MO.getOffset())
Expr = MCBinaryExpr::createAdd(
Expr, MCConstantExpr::create(MO.getOffset(), Ctx), Ctx);
diff --git a/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp b/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
index 420b98b8a9c1f..1bcd4a866c41c 100644
--- a/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
+++ b/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
@@ -810,7 +810,7 @@ ParseStatus LoongArchAsmParser::parseSImm26Operand(OperandVector &Operands) {
SMLoc E = SMLoc::getFromPointer(S.getPointer() + Identifier.size());
MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);
- Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ Res = MCSymbolRefExpr::create(Sym, getContext());
Res = LoongArchMCExpr::create(Res, LoongArchMCExpr::VK_LoongArch_CALL,
getContext());
Operands.push_back(LoongArchOperand::createImm(Res, S, E));
diff --git a/llvm/lib/Target/LoongArch/LoongArchMCInstLower.cpp b/llvm/lib/Target/LoongArch/LoongArchMCInstLower.cpp
index d87ed068ebff8..5d561038960e1 100644
--- a/llvm/lib/Target/LoongArch/LoongArchMCInstLower.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchMCInstLower.cpp
@@ -126,8 +126,7 @@ static MCOperand lowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym,
// TODO: Handle more target-flags.
}
- const MCExpr *ME =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, Ctx);
+ const MCExpr *ME = MCSymbolRefExpr::create(Sym, Ctx);
if (!MO.isJTI() && !MO.isMBB() && MO.getOffset())
ME = MCBinaryExpr::createAdd(
diff --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
index 62f17675f8230..44212b832378b 100644
--- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -2095,8 +2095,7 @@ bool MipsAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
MCSymbol *TmpLabel = getContext().createTempSymbol();
const MCExpr *TmpExpr = MCSymbolRefExpr::create(TmpLabel, getContext());
const MCExpr *RelocJalrExpr =
- MCSymbolRefExpr::create(JalSym, MCSymbolRefExpr::VK_None,
- getContext(), IDLoc);
+ MCSymbolRefExpr::create(JalSym, getContext(), IDLoc);
TOut.getStreamer().emitRelocDirective(
*TmpExpr, inMicroMipsMode() ? "R_MICROMIPS_JALR" : "R_MIPS_JALR",
@@ -3313,8 +3312,7 @@ bool MipsAsmParser::emitPartialAddress(MipsTargetStreamer &TOut, SMLoc IDLoc,
return true;
if(IsPicEnabled) {
- const MCExpr *GotSym =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ const MCExpr *GotSym = MCSymbolRefExpr::create(Sym, getContext());
const MipsMCExpr *GotExpr =
MipsMCExpr::create(MipsMCExpr::MEK_GOT, GotSym, getContext());
@@ -3326,8 +3324,7 @@ bool MipsAsmParser::emitPartialAddress(MipsTargetStreamer &TOut, SMLoc IDLoc,
IDLoc, STI);
}
} else { //!IsPicEnabled
- const MCExpr *HiSym =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ const MCExpr *HiSym = MCSymbolRefExpr::create(Sym, getContext());
const MipsMCExpr *HiExpr =
MipsMCExpr::create(MipsMCExpr::MEK_HI, HiSym, getContext());
@@ -3340,12 +3337,10 @@ bool MipsAsmParser::emitPartialAddress(MipsTargetStreamer &TOut, SMLoc IDLoc,
if(isABI_O32() || isABI_N32()) {
TOut.emitRX(Mips::LUi, ATReg, MCOperand::createExpr(HiExpr), IDLoc, STI);
} else { //isABI_N64()
- const MCExpr *HighestSym =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ const MCExpr *HighestSym = MCSymbolRefExpr::create(Sym, getContext());
const MipsMCExpr *HighestExpr =
MipsMCExpr::create(MipsMCExpr::MEK_HIGHEST, HighestSym, getContext());
- const MCExpr *HigherSym =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ const MCExpr *HigherSym = MCSymbolRefExpr::create(Sym, getContext());
const MipsMCExpr *HigherExpr =
MipsMCExpr::create(MipsMCExpr::MEK_HIGHER, HigherSym, getContext());
@@ -3433,8 +3428,7 @@ bool MipsAsmParser::expandLoadSingleImmToFPR(MCInst &Inst, SMLoc IDLoc,
getContext().getELFSection(".rodata", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
MCSymbol *Sym = getContext().createTempSymbol();
- const MCExpr *LoSym =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ const MCExpr *LoSym = MCSymbolRefExpr::create(Sym, getContext());
const MipsMCExpr *LoExpr =
MipsMCExpr::create(MipsMCExpr::MEK_LO, LoSym, getContext());
@@ -3485,8 +3479,7 @@ bool MipsAsmParser::expandLoadDoubleImmToGPR(MCInst &Inst, SMLoc IDLoc,
getContext().getELFSection(".rodata", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
MCSymbol *Sym = getContext().createTempSymbol();
- const MCExpr *LoSym =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ const MCExpr *LoSym = MCSymbolRefExpr::create(Sym, getContext());
const MipsMCExpr *LoExpr =
MipsMCExpr::create(MipsMCExpr::MEK_LO, LoSym, getContext());
@@ -3567,8 +3560,7 @@ bool MipsAsmParser::expandLoadDoubleImmToFPR(MCInst &Inst, bool Is64FPU,
getContext().getELFSection(".rodata", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
MCSymbol *Sym = getContext().createTempSymbol();
- const MCExpr *LoSym =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ const MCExpr *LoSym = MCSymbolRefExpr::create(Sym, getContext());
const MipsMCExpr *LoExpr =
MipsMCExpr::create(MipsMCExpr::MEK_LO, LoSym, getContext());
@@ -6457,8 +6449,7 @@ bool MipsAsmParser::parseOperand(OperandVector &Operands, StringRef Mnemonic) {
SMLoc E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer() - 1);
MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);
// Otherwise create a symbol reference.
- const MCExpr *SymRef =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ const MCExpr *SymRef = MCSymbolRefExpr::create(Sym, getContext());
Operands.push_back(MipsOperand::CreateImm(SymRef, S, E, *this));
return false;
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
index 6ed77d45b8a74..4919d4f108567 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
@@ -1118,9 +1118,7 @@ void MipsTargetELFStreamer::emitDirectiveEnd(StringRef Name) {
Sec->setAlignment(Align(4));
MCSymbol *Sym = Context.getOrCreateSymbol(Name);
- const MCSymbolRefExpr *ExprRef =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, Context);
-
+ const auto *ExprRef = MCSymbolRefExpr::create(Sym, Context);
OS.emitValueImpl(ExprRef, 4);
OS.emitIntValue(GPRInfoSet ? GPRBitMask : 0, 4); // reg_mask
@@ -1143,8 +1141,7 @@ void MipsTargetELFStreamer::emitDirectiveEnd(StringRef Name) {
MCSymbol *CurPCSym = Context.createTempSymbol();
OS.emitLabel(CurPCSym);
const MCExpr *Size = MCBinaryExpr::createSub(
- MCSymbolRefExpr::create(CurPCSym, MCSymbolRefExpr::VK_None, Context),
- ExprRef, Context);
+ MCSymbolRefExpr::create(CurPCSym, Context), ExprRef, Context);
// The ELFObjectWriter can determine the absolute size as it has access to
// the layout information of the assembly file, so a size expression rather
diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
index 0a70c298dd0da..1819456bee9d4 100644
--- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
+++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
@@ -1199,8 +1199,7 @@ void MipsAsmPrinter::EmitSled(const MachineInstr &MI, SledKind Kind) {
// Emit "B .tmpN" instruction, which jumps over the nop sled to the actual
// start of function
- const MCExpr *TargetExpr = MCSymbolRefExpr::create(
- Target, MCSymbolRefExpr::VariantKind::VK_None, OutContext);
+ const MCExpr *TargetExpr = MCSymbolRefExpr::create(Target, OutContext);
EmitToStreamer(*OutStreamer, MCInstBuilder(Mips::BEQ)
.addReg(Mips::ZERO)
.addReg(Mips::ZERO)
diff --git a/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp b/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp
index 8c482abb8af47..e74b3ad5ebca3 100644
--- a/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp
+++ b/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp
@@ -186,8 +186,7 @@ MCSection *MipsTargetObjectFile::getSectionForConstant(const DataLayout &DL,
const MCExpr *
MipsTargetObjectFile::getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
- const MCExpr *Expr =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ const MCExpr *Expr = MCSymbolRefExpr::create(Sym, getContext());
Expr = MCBinaryExpr::createAdd(
Expr, MCConstantExpr::create(0x8000, getContext()), getContext());
return MipsMCExpr::create(MipsMCExpr::MEK_DTPREL, Expr, getContext());
diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
index a78df078f62f2..65cfeadc21a3b 100644
--- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -245,8 +245,7 @@ unsigned NVPTXAsmPrinter::encodeVirtualRegister(unsigned Reg) {
MCOperand NVPTXAsmPrinter::GetSymbolRef(const MCSymbol *Symbol) {
const MCExpr *Expr;
- Expr = MCSymbolRefExpr::create(Symbol, MCSymbolRefExpr::VK_None,
- OutContext);
+ Expr = MCSymbolRefExpr::create(Symbol, OutContext);
return MCOperand::createExpr(Expr);
}
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 0e406f7ba93b6..2a448d987f297 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -680,8 +680,7 @@ void PPCAsmPrinter::EmitAIXTlsCallHelper(const MachineInstr *MI) {
"Only expecting to emit calls to get the thread pointer on AIX!");
MCSymbol *TlsCall = createMCSymbolForTlsGetAddr(OutContext, MI->getOpcode());
- const MCExpr *TlsRef =
- MCSymbolRefExpr::create(TlsCall, MCSymbolRefExpr::VK_None, OutContext);
+ const MCExpr *TlsRef = MCSymbolRefExpr::create(TlsCall, OutContext);
EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::BLA).addExpr(TlsRef));
}
@@ -1008,8 +1007,7 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
MCSymbol *PICOffset =
MF->getInfo<PPCFunctionInfo>()->getPICOffsetSymbol(*MF);
TmpInst.setOpcode(PPC::LWZ);
- const MCExpr *Exp =
- MCSymbolRefExpr::create(PICOffset, MCSymbolRefExpr::VK_None, OutContext);
+ const MCExpr *Exp = MCSymbolRefExpr::create(PICOffset, OutContext);
const MCExpr *PB =
MCSymbolRefExpr::create(MF->getPICBaseSymbol(),
MCSymbolRefExpr::VK_None,
@@ -1064,8 +1062,7 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
// 'MOSymbol'. Said TOC entry will be synthesized later.
MCSymbol *TOCEntry =
lookUpOrCreateTOCEntry(MOSymbol, getTOCEntryTypeForMO(MO), VK);
- const MCExpr *Exp =
- MCSymbolRefExpr::create(TOCEntry, MCSymbolRefExpr::VK_None, OutContext);
+ const MCExpr *Exp = MCSymbolRefExpr::create(TOCEntry, OutContext);
// AIX uses the label directly as the lwz displacement operand for
// references into the toc section. The displacement value will be generated
@@ -1110,8 +1107,7 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
// Map the operand to its corresponding MCSymbol.
const MCSymbol *const MOSymbol = getMCSymbolForTOCPseudoMO(MO, *this);
- const MCExpr *Exp =
- MCSymbolRefExpr::create(MOSymbol, MCSymbolRefExpr::VK_None, OutContext);
+ const MCExpr *Exp = MCSymbolRefExpr::create(MOSymbol, OutContext);
TmpInst.getOperand(2) = MCOperand::createExpr(Exp);
EmitToStreamer(*OutStreamer, TmpInst);
diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
index 44c19f5da1e26..b342c18bece08 100644
--- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
+++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
@@ -2188,7 +2188,7 @@ ParseStatus RISCVAsmParser::parseBareSymbol(OperandVector &Operands) {
}
Res = V;
} else
- Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ Res = MCSymbolRefExpr::create(Sym, getContext());
MCBinaryExpr::Opcode Opcode;
switch (getLexer().getKind()) {
@@ -2234,7 +2234,7 @@ ParseStatus RISCVAsmParser::parseCallSymbol(OperandVector &Operands) {
(void)Identifier.consume_back("@plt");
MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);
- Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ Res = MCSymbolRefExpr::create(Sym, getContext());
Res = RISCVMCExpr::create(Res, Kind, getContext());
Operands.push_back(RISCVOperand::createImm(Res, S, E, isRV64()));
return ParseStatus::Success;
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp
index 5965dc610f8d5..d5938e9c6d8ff 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp
@@ -48,8 +48,7 @@ const MCExpr *RISCVMCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym,
// enabled, so we follow binutils in using the R_RISCV_32_PCREL relocation
// for the FDE initial location.
MCContext &Ctx = Streamer.getContext();
- const MCExpr *ME =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, Ctx);
+ const MCExpr *ME = MCSymbolRefExpr::create(Sym, Ctx);
assert(Encoding & dwarf::DW_EH_PE_sdata4 && "Unexpected encoding");
return RISCVMCExpr::create(ME, RISCVMCExpr::VK_RISCV_32_PCREL, Ctx);
}
diff --git a/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp b/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
index 7dcf2ba2ac405..9c076fdc687e0 100644
--- a/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
+++ b/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
@@ -520,8 +520,7 @@ void RISCVAsmPrinter::emitSled(const MachineInstr *MI, SledKind Kind) {
OutStreamer->emitLabel(CurSled);
auto Target = OutContext.createTempSymbol();
- const MCExpr *TargetExpr = MCSymbolRefExpr::create(
- Target, MCSymbolRefExpr::VariantKind::VK_None, OutContext);
+ const MCExpr *TargetExpr = MCSymbolRefExpr::create(Target, OutContext);
// Emit "J bytes" instruction, which jumps over the nop sled to the actual
// start of function.
@@ -622,7 +621,7 @@ void RISCVAsmPrinter::LowerHWASAN_CHECK_MEMACCESS(const MachineInstr &MI) {
utostr(AccessInfo) + "_short";
Sym = OutContext.getOrCreateSymbol(SymName);
}
- auto Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, OutContext);
+ auto Res = MCSymbolRefExpr::create(Sym, OutContext);
auto Expr = RISCVMCExpr::create(Res, RISCVMCExpr::VK_RISCV_CALL, OutContext);
EmitToStreamer(*OutStreamer, MCInstBuilder(RISCV::PseudoCALL).addExpr(Expr));
@@ -996,8 +995,7 @@ static MCOperand lowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym,
break;
}
- const MCExpr *ME =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, Ctx);
+ const MCExpr *ME = MCSymbolRefExpr::create(Sym, Ctx);
if (!MO.isJTI() && !MO.isMBB() && MO.getOffset())
ME = MCBinaryExpr::createAdd(
@@ -1208,8 +1206,7 @@ void RISCVAsmPrinter::emitMachineConstantPoolValue(
MCSym = GetExternalSymbolSymbol(Sym);
}
- const MCExpr *Expr =
- MCSymbolRefExpr::create(MCSym, MCSymbolRefExpr::VK_None, OutContext);
+ const MCExpr *Expr = MCSymbolRefExpr::create(MCSym, OutContext);
uint64_t Size = getDataLayout().getTypeAllocSize(RCPV->getType());
OutStreamer->emitValue(Expr, Size);
}
diff --git a/llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp b/llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
index 4b26437c5fecb..e4dc3b36ded50 100644
--- a/llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
+++ b/llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
@@ -1648,8 +1648,7 @@ ParseStatus SystemZAsmParser::parsePCRel(OperandVector &Operands,
int64_t Value = CE->getValue();
MCSymbol *Sym = Ctx.createTempSymbol();
Out.emitLabel(Sym);
- const MCExpr *Base = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None,
- Ctx);
+ const MCExpr *Base = MCSymbolRefExpr::create(Sym, Ctx);
Expr = Value == 0 ? Base : MCBinaryExpr::createAdd(Base, Expr, Ctx);
}
diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp
index 02c101055d9f3..2f2f194980edd 100644
--- a/llvm/lib/Target/TargetLoweringObjectFile.cpp
+++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp
@@ -186,9 +186,8 @@ void TargetLoweringObjectFile::emitCGProfileMetadata(MCStreamer &Streamer,
->getValue()
->getUniqueInteger()
.getZExtValue();
- Streamer.emitCGProfileEntry(
- MCSymbolRefExpr::create(From, MCSymbolRefExpr::VK_None, C),
- MCSymbolRefExpr::create(To, MCSymbolRefExpr::VK_None, C), Count);
+ Streamer.emitCGProfileEntry(MCSymbolRefExpr::create(From, C),
+ MCSymbolRefExpr::create(To, C), Count);
}
}
diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp
index 0f8fbf5be1c95..71859dea9ff5f 100644
--- a/llvm/lib/Target/X86/X86MCInstLower.cpp
+++ b/llvm/lib/Target/X86/X86MCInstLower.cpp
@@ -889,8 +889,7 @@ void X86AsmPrinter::LowerFENTRY_CALL(const MachineInstr &MI,
bool Is64Bits = Subtarget->is64Bit();
MCContext &Ctx = OutStreamer->getContext();
MCSymbol *fentry = Ctx.getOrCreateSymbol("__fentry__");
- const MCSymbolRefExpr *Op =
- MCSymbolRefExpr::create(fentry, MCSymbolRefExpr::VK_None, Ctx);
+ const MCSymbolRefExpr *Op = MCSymbolRefExpr::create(fentry, Ctx);
EmitAndCountInstruction(
MCInstBuilder(Is64Bits ? X86::CALL64pcrel32 : X86::CALLpcrel32)
diff --git a/llvm/lib/Target/Xtensa/AsmParser/XtensaAsmParser.cpp b/llvm/lib/Target/Xtensa/AsmParser/XtensaAsmParser.cpp
index 0c9258ecd65ec..55f783d6da063 100644
--- a/llvm/lib/Target/Xtensa/AsmParser/XtensaAsmParser.cpp
+++ b/llvm/lib/Target/Xtensa/AsmParser/XtensaAsmParser.cpp
@@ -426,8 +426,7 @@ bool XtensaAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
TmpInst.setOpcode(Xtensa::L32R);
const MCExpr *Value = Inst.getOperand(1).getExpr();
MCSymbol *Sym = getContext().createTempSymbol();
- const MCExpr *Expr =
- MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ const MCExpr *Expr = MCSymbolRefExpr::create(Sym, getContext());
const MCExpr *OpExpr = XtensaMCExpr::create(
Expr, XtensaMCExpr::VK_Xtensa_None, getContext());
TmpInst.addOperand(Inst.getOperand(0));
@@ -668,7 +667,7 @@ ParseStatus XtensaAsmParser::parseImmediate(OperandVector &Operands) {
return ParseStatus::Failure;
MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);
- Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+ Res = MCSymbolRefExpr::create(Sym, getContext());
break;
}
case AsmToken::Percent:
diff --git a/llvm/lib/Target/Xtensa/XtensaAsmPrinter.cpp b/llvm/lib/Target/Xtensa/XtensaAsmPrinter.cpp
index 95dfafc13f390..91118621d64ab 100644
--- a/llvm/lib/Target/Xtensa/XtensaAsmPrinter.cpp
+++ b/llvm/lib/Target/Xtensa/XtensaAsmPrinter.cpp
@@ -256,8 +256,7 @@ XtensaAsmPrinter::LowerSymbolOperand(const MachineOperand &MO,
report_fatal_error("<unknown operand type>");
}
- const MCExpr *ME =
- MCSymbolRefExpr::create(Symbol, MCSymbolRefExpr::VK_None, OutContext);
+ const MCExpr *ME = MCSymbolRefExpr::create(Symbol, OutContext);
ME = XtensaMCExpr::create(ME, Kind, OutContext);
if (Offset) {
More information about the llvm-commits
mailing list