[llvm] [RISCV] Introduce a new tune feature string syntax and its parser (PR #168160)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 16:55:01 PST 2025


mshockwave wrote:

> We might want to instead have our `RISCVTuneFeature` slightly more separate from the underlying `SubtargetFeature`, to support my proposed names above without having to rename the feature attributes or tablegen names.

What about something like this:
```
// Simple tune feature that remove the subtarget feature upon seeing directive starting with "no-"
def TuneVLDependentLatency
    : SubtargetFeature<"vl-dependent-latency", "HasVLDependentLatency", "true",
                       "Latency of vector instructions is dependent on the "
                       "dynamic value of vl">,
     RISCVSimpleTuneFeature;

// Tune feature that allows you to customize the directive names
def TuneNoDefaultUnroll
    : SubtargetFeature<"no-default-unroll", "EnableDefaultUnroll", "false",
                       "Disable default unroll preference.">,
      RISCVTuneFeature<additionName="no-default-unroll", subtractionName="default-unroll">;
```
Basically this new `RISCVTuneFeature` allows you to use arbitrary directive names that might be completely detached from the actual subtarget feature name. I think it'll also be useful for doing backward compatibilities.

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


More information about the llvm-commits mailing list