[llvm] [llvm-objdump] Add triple support to `mcpu=help` (PR #165661)

Ruoyu Qiu via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 25 01:50:31 PST 2025


================
@@ -3533,6 +3533,35 @@ commaSeparatedValues(const llvm::opt::InputArgList &InputArgs, int ID) {
   return Values;
 }
 
+static void mcpuHelp() {
+  std::string Error;
+  Triple DummyTriple;
+
+  if (!TripleName.empty())
+    DummyTriple.setTriple(TripleName);
+  else {
+    // If the target triple is derived from the files, we display help message
----------------
cabbaken wrote:

In the original logic, we output the help message based on the first file's Triple; if there are multiple files, the help message is output based on the first file's Triple. For example, `llvm-objdump -d --mcpu=help ./arm.o ./x86_64.o` will only output the arm help message.

My modification will not cause the help message to be printed twice, because `cpuHelp()` in MCSubtargetInfo.cpp ensures the help message is output only once. 

Based on the above information, I believe using the --triple to determine the help message output is reasonable. Or do we need to modify MCSubtargetInfo.cpp to support outputting the help message multiple times?

https://github.com/llvm/llvm-project/pull/165661


More information about the llvm-commits mailing list