Author: Thurston Dang Date: 2025-04-09T12:07:54-07:00 New Revision: 69a55b8cab98a8f07a9d84e9704fe79ed9d2fbea
URL: https://github.com/llvm/llvm-project/commit/69a55b8cab98a8f07a9d84e9704fe79ed9d2fbea DIFF: https://github.com/llvm/llvm-project/commit/69a55b8cab98a8f07a9d84e9704fe79ed9d2fbea.diff LOG: Revert "[llc] Add -M for InstPrinter options" This reverts commit 02b377d8f7252b1acf6ea4fad55a101b6bc3fcf7. Added: Modified: llvm/docs/CommandGuide/llc.rst llvm/include/llvm/MC/MCTargetOptions.h llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp llvm/test/CodeGen/RISCV/compress-opt-select.ll llvm/test/CodeGen/RISCV/hwasan-check-memaccess.ll llvm/test/tools/llvm-mc/disassembler-options.test llvm/tools/llc/llc.cpp llvm/tools/llvm-mc/llvm-mc.cpp Removed: llvm/test/tools/llc/instprinter-options.ll ################################################################################ diff --git a/llvm/docs/CommandGuide/llc.rst b/llvm/docs/CommandGuide/llc.rst index 900649f59c401..7f28ab3a82f7c 100644 --- a/llvm/docs/CommandGuide/llc.rst +++ b/llvm/docs/CommandGuide/llc.rst @@ -43,11 +43,6 @@ End-user Options Print a summary of command line options. -.. option:: -M - - Pass target-specific InstPrinter options. - Refer to the ``-M`` option of :manpage:`llvm-objdump(1)`. - .. option:: -o <filename> Use ``<filename>`` as the output filename. See the summary above for more diff --git a/llvm/include/llvm/MC/MCTargetOptions.h b/llvm/include/llvm/MC/MCTargetOptions.h index fd554bc0ba7c6..7b0d81faf73d2 100644 --- a/llvm/include/llvm/MC/MCTargetOptions.h +++ b/llvm/include/llvm/MC/MCTargetOptions.h @@ -105,9 +105,6 @@ class MCTargetOptions { /// integrated assembler. std::vector<std::string> IASSearchPaths; - // InstPrinter options. - std::vector<std::string> InstPrinterOptions; - // Whether to emit compact-unwind for non-canonical personality // functions on Darwins. bool EmitCompactUnwindNonCanonical : 1; diff --git a/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp b/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp index 37611479088be..5757ca1b3adf8 100644 --- a/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp +++ b/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp @@ -21,7 +21,6 @@ #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCContext.h" -#include "llvm/MC/MCInstPrinter.h" #include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCRegisterInfo.h" @@ -133,10 +132,8 @@ bool CodeGenTargetMachineImpl::addAsmPrinter(PassManagerBase &PM, MCContext &Context) { Expected<std::unique_ptr<MCStreamer>> MCStreamerOrErr = createMCStreamer(Out, DwoOut, FileType, Context); - if (!MCStreamerOrErr) { - Context.reportError(SMLoc(), toString(MCStreamerOrErr.takeError())); + if (auto Err = MCStreamerOrErr.takeError()) return true; - } // Create the AsmPrinter, which takes ownership of AsmStreamer if successful. FunctionPass *Printer = @@ -166,9 +163,6 @@ CodeGenTargetMachineImpl::createMCStreamer(raw_pwrite_stream &Out, getTargetTriple(), Options.MCOptions.OutputAsmVariant.value_or(MAI.getAssemblerDialect()), MAI, MII, MRI); - for (StringRef Opt : Options.MCOptions.InstPrinterOptions) - if (!InstPrinter->applyTargetSpecificCLOption(Opt)) - return createStringError("invalid InstPrinter option '" + Opt + "'"); // Create a code emitter if asked to show the encoding. std::unique_ptr<MCCodeEmitter> MCE; diff --git a/llvm/test/CodeGen/RISCV/compress-opt-select.ll b/llvm/test/CodeGen/RISCV/compress-opt-select.ll index c0234f40cff56..733c84ac23613 100644 --- a/llvm/test/CodeGen/RISCV/compress-opt-select.ll +++ b/llvm/test/CodeGen/RISCV/compress-opt-select.ll @@ -1,9 +1,9 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 ; RUN: llc -mtriple=riscv32 -target-abi ilp32d -mattr=+c,+f,+d \ -; RUN: -M no-aliases < %s \ +; RUN: -riscv-no-aliases < %s \ ; RUN: | FileCheck -check-prefix=RV32IFDC %s ; RUN: llc -mtriple=riscv32 -target-abi ilp32d -mattr=-c,+f,+d \ -; RUN: -M no-aliases < %s \ +; RUN: -riscv-no-aliases < %s \ ; RUN: | FileCheck -check-prefix=RV32IFD %s ; constant is small and fit in 6 bit (compress imm) diff --git a/llvm/test/CodeGen/RISCV/hwasan-check-memaccess.ll b/llvm/test/CodeGen/RISCV/hwasan-check-memaccess.ll index cf780f4f7f76c..c4e5dcedf5ede 100644 --- a/llvm/test/CodeGen/RISCV/hwasan-check-memaccess.ll +++ b/llvm/test/CodeGen/RISCV/hwasan-check-memaccess.ll @@ -1,7 +1,7 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -mtriple=riscv64 < %s | FileCheck %s ; RUN: llc -mtriple=riscv64 --relocation-model=pic < %s | FileCheck %s -; RUN: llc -mtriple=riscv64 -mattr=+c -M no-aliases < %s \ +; RUN: llc -mtriple=riscv64 -mattr=+c --riscv-no-aliases < %s \ ; RUN: | FileCheck %s --check-prefix=COMPRESS define ptr @f2(ptr %x0, ptr %x1) { diff --git a/llvm/test/tools/llc/instprinter-options.ll b/llvm/test/tools/llc/instprinter-options.ll deleted file mode 100644 index dd47bb46decce..0000000000000 --- a/llvm/test/tools/llc/instprinter-options.ll +++ /dev/null @@ -1,4 +0,0 @@ -; REQUIRES: x86-registered-target -; RUN: not llc -mtriple=x86_64 < %s -M invalid 2>&1 | FileCheck %s --implicit-check-not=error: - -; CHECK: error: invalid InstPrinter option 'invalid' diff --git a/llvm/test/tools/llvm-mc/disassembler-options.test b/llvm/test/tools/llvm-mc/disassembler-options.test index e53bfce9f47ab..a7fd8b1b9f8d3 100644 --- a/llvm/test/tools/llvm-mc/disassembler-options.test +++ b/llvm/test/tools/llvm-mc/disassembler-options.test @@ -1,4 +1,4 @@ # RUN: export LSAN_OPTIONS=detect_leaks=0 # RUN: not llvm-mc -M invalid /dev/null 2>&1 | FileCheck %s -# CHECK: error: invalid InstPrinter option 'invalid' +# CHECK: error: invalid disassembler option 'invalid' diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp index 140459ba2de21..a97d07dec722b 100644 --- a/llvm/tools/llc/llc.cpp +++ b/llvm/tools/llc/llc.cpp @@ -69,9 +69,6 @@ static codegen::RegisterCodeGenFlags CGF; static cl::opt<std::string> InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-")); -static cl::list<std::string> - InstPrinterOptions("M", cl::desc("InstPrinter options")); - static cl::opt<std::string> InputLanguage("x", cl::desc("Input language ('ir' or 'mir')")); @@ -501,7 +498,6 @@ static int compileModule(char **argv, LLVMContext &Context) { Options.MCOptions.AsmVerbose = AsmVerbose; Options.MCOptions.PreserveAsmComments = PreserveComments; Options.MCOptions.IASSearchPaths = IncludeDirs; - Options.MCOptions.InstPrinterOptions = InstPrinterOptions; Options.MCOptions.SplitDwarfFile = SplitDwarfFile; if (DwarfDirectory.getPosition()) { Options.MCOptions.MCUseDwarfDirectory = @@ -678,17 +674,6 @@ static int compileModule(char **argv, LLVMContext &Context) { MachineModuleInfoWrapperPass *MMIWP = new MachineModuleInfoWrapperPass(Target.get()); - // Set a temporary diagnostic handler. This is used before - // MachineModuleInfoWrapperPass::doInitialization for features like -M. - bool HasMCErrors = false; - MCContext &MCCtx = MMIWP->getMMI().getContext(); - MCCtx.setDiagnosticHandler([&](const SMDiagnostic &SMD, bool IsInlineAsm, - const SourceMgr &SrcMgr, - std::vector<const MDNode *> &LocInfos) { - WithColor::error(errs(), argv0) << SMD.getMessage() << '\n'; - HasMCErrors = true; - }); - // Construct a custom pass pipeline that starts after instruction // selection. if (!getRunPassNames().empty()) { @@ -723,8 +708,7 @@ static int compileModule(char **argv, LLVMContext &Context) { } else if (Target->addPassesToEmitFile( PM, *OS, DwoOut ? &DwoOut->os() : nullptr, codegen::getFileType(), NoVerify, MMIWP)) { - if (!HasMCErrors) - reportError("target does not support generation of this file type"); + reportError("target does not support generation of this file type"); } const_cast<TargetLoweringObjectFile *>(Target->getObjFileLowering()) @@ -752,7 +736,7 @@ static int compileModule(char **argv, LLVMContext &Context) { PM.run(*M); - if (Context.getDiagHandlerPtr()->HasErrors || HasMCErrors) + if (Context.getDiagHandlerPtr()->HasErrors) return 1; // Compare the two outputs and make sure they're the same diff --git a/llvm/tools/llvm-mc/llvm-mc.cpp b/llvm/tools/llvm-mc/llvm-mc.cpp index db2c6eeb22519..70f92d09aded7 100644 --- a/llvm/tools/llvm-mc/llvm-mc.cpp +++ b/llvm/tools/llvm-mc/llvm-mc.cpp @@ -49,9 +49,9 @@ static cl::opt<std::string> InputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-"), cl::cat(MCCategory)); -static cl::list<std::string> InstPrinterOptions("M", - cl::desc("InstPrinter options"), - cl::cat(MCCategory)); +static cl::list<std::string> + DisassemblerOptions("M", cl::desc("Disassembler options"), + cl::cat(MCCategory)); static cl::opt<std::string> OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"), @@ -369,7 +369,6 @@ int main(int argc, char **argv) { MCOptions.ShowMCInst = ShowInst; MCOptions.AsmVerbose = true; MCOptions.MCUseDwarfDirectory = MCTargetOptions::EnableDwarfDirectory; - MCOptions.InstPrinterOptions = InstPrinterOptions; setDwarfDebugFlags(argc, argv); setDwarfDebugProducer(); @@ -532,9 +531,9 @@ int main(int argc, char **argv) { return 1; } - for (StringRef Opt : InstPrinterOptions) + for (StringRef Opt : DisassemblerOptions) if (!IP->applyTargetSpecificCLOption(Opt)) { - WithColor::error() << "invalid InstPrinter option '" << Opt << "'\n"; + WithColor::error() << "invalid disassembler option '" << Opt << "'\n"; return 1; } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits