[llvm] [CodeGen] Declare command line options in TableGen (PR #228729)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 3 22:40:09 PDT 2026


================
@@ -0,0 +1,200 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+include "llvm/Option/LibraryOptions.td"
+
+def CodeGenOptions : OptionsStruct;
+
+defm : BoolField<"addr-sink-combine-base-gv", "true",
+  "Allow combining of BaseGV field in Address sinking">;
+defm : BoolField<"addr-sink-combine-base-offs", "true",
+  "Allow combining of BaseOffs field in Address sinking">;
+defm : BoolField<"addr-sink-combine-base-reg", "true",
+  "Allow combining of BaseReg field in Address sinking">;
+defm : BoolField<"addr-sink-combine-scaled-reg", "true",
+  "Allow combining of ScaledReg field in Address sinking">;
+defm : BoolField<"addr-sink-new-phis", "false",
+  "Allow creation of Phis in Address sinking">;
+defm : BoolField<"addr-sink-new-select", "true",
+  "Allow creation of selects in Address sinking">;
+defm : OptionalBoolField<"addr-sink-using-gep",
+  "Address sinking in CGP using GEPs">;
+defm : BoolField<"basic-block-section-match-infer", "false",
+  "Enable matching and inference when generating basic block sections">;
+defm : BoolField<"bbsections-guided-section-prefix", "true",
+  "Use the basic-block-sections profile to determine the text section prefix for hot functions. "
+  "Functions with basic-block-sections profile will be placed in `.text.hot` regardless of their FDO profile info. "
+  "Other functions won't be impacted, i.e., their prefixes will be decided by FDO/sampleFDO profiles">;
+defm : ValueField<"cgp-freq-ratio-to-skip-merge", "uint64_t", "2",
+  "Skip merging empty blocks if (frequency of empty block) / (frequency of destination block) is greater than this ratio">;
+defm : BoolField<"cgp-icmp-eq2icmp-st", "false",
+  "Enable ICMP_EQ to ICMP_S(L|G)T conversion">;
+defm : ValueField<"cgp-max-address-users-to-scan", "unsigned", "100",
+  "Max number of address users to look at">;
+defm : BoolField<"cgp-optimize-phi-types", "true",
+  "Enable converting phi types in CodeGenPrepare">;
+defm : BoolField<"cgp-split-large-offset-gep", "true",
+  "Enable splitting large offset of GEP">;
+defm : BoolField<"cgp-type-promotion-merge", "true",
+  "Enable merging of redundant sexts when one is dominating the other">;
+defm : BoolField<"cgp-verify-bfi-updates", "false",
+  "Enable BFI update verification for CodeGenPrepare">;
+defm : ValueField<"cgpp-huge-func", "unsigned", "10000",
+  "Least BB number of huge function">;
+defm : BoolField<"codegen-pipeline-trigger-crash", "false",
+  "Trigger crash in codegen pipeline">;
+defm : OptionalBoolField<"debugify-and-strip-all-safe",
+  "Debugify MIR before and Strip debug after each pass except those known to be unsafe when debug info is present">;
+defm : OptionalBoolField<"debugify-check-and-strip-all-safe",
+  "Debugify MIR before, by checking and stripping the debug info after, each pass except those known to be unsafe when debug info is present">;
+defm : BoolField<"disable-atexit-based-global-dtor-lowering", "false",
+  "For MachO, disable atexit()-based global destructor lowering">;
+defm : BoolField<"disable-block-placement", "false",
+  "Disable probability-driven block placement">;
+defm : BoolField<"disable-branch-fold", "false",
+  "Disable branch folding">;
+// Disable the pass to fix unwind information. Whether the pass is included in
+// the pipeline is controlled via the target options, this option serves as
+// manual override.
+defm : BoolField<"disable-cfi-fixup", "false",
+  "Disable the CFI fixup pass">;
+defm : BoolField<"disable-cgp", "false",
+  "Disable Codegen Prepare">;
+defm : BoolField<"disable-cgp-branch-opts", "false",
+  "Disable branch optimizations in CodeGenPrepare">;
+defm : BoolField<"disable-cgp-delete-phis", "false",
+  "Disable elimination of dead PHI nodes">;
+defm : BoolField<"disable-cgp-ext-ld-promotion", "false",
+  "Disable ext(promotable(ld)) -> promoted(ext(ld)) optimization in CodeGenPrepare">;
+defm : BoolField<"disable-cgp-gc-opts", "false",
+  "Disable GC optimizations in CodeGenPrepare">;
+defm : BoolField<"disable-cgp-select2branch", "false",
+  "Disable select to branch conversion">;
+defm : BoolField<"disable-cgp-store-extract", "false",
+  "Disable store(extract) optimizations in CodeGenPrepare">;
+defm : BoolField<"disable-complex-addr-modes", "false",
+  "Disables combining addressing modes with different parts in optimizeMemoryInst">;
+defm : BoolField<"disable-constant-hoisting", "false",
+  "Disable ConstantHoisting">;
+defm : BoolField<"disable-copyprop", "false",
+  "Disable Copy Propagation pass">;
+defm : BoolField<"disable-early-ifcvt", "false",
+  "Disable Early If-conversion">;
+defm : BoolField<"disable-early-taildup", "false",
+  "Disable pre-register allocation tail duplication">;
+defm : BoolField<"disable-expand-reductions", "false",
+  "Disable the expand reduction intrinsics pass from running">;
+// Disable MIRProfileLoader before BlockPlacement. This is for debugging and
+// tuning purpose.
----------------
aengelke wrote:

```suggestion
// tuning purposes.
```

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


More information about the llvm-commits mailing list