[clang] [llvm] [RISCV] Support RISC-V Profiles in -march option (PR #76357)

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 8 17:41:13 PST 2024


================
@@ -0,0 +1,189 @@
+//===------ RISCVProfiles.td - RISC-V Profiles -------------*- tablegen -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+class RISCVProfile<string name, list<SubtargetFeature> features>
----------------
topperc wrote:

> When adding new RISCVProcessorModel, we can just specify profile feature and those implemented optional extensions.

This case can be handled with a named list in tablegen and a `listconcat` without exposing it as a subtarget feature.

> When disassembling some object files, we don't need a long -mattr if we know it's compiled with a profile.

If objdump requires you to use `-mattr`, instead of `-march`, that's a bad interface design. Users of objdump shouldn't need to know if they to have pass `experimental-` before an extension name.

> When doing some end-to-end tests that we need to discard CPU specific features (so we can't use -mcpu), we don't need a long -mattr.

This might be an argument for a `generic-<profile>` `mcpu`.

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


More information about the cfe-commits mailing list