================ @@ -308,6 +312,94 @@ inline constexpr ExtensionInfo Extensions[] = { }; // clang-format on +struct ExtensionSet { + // Set of extensions which are currently enabled. + ExtensionBitset Enabled; + // Set of extensions which have been enabled or disabled at any point. Used + // to avoid cluttering the cc1 command-line with lots of unneeded features. + ExtensionBitset Touched; + // Base architecture version, which we need to know because some feature + // dependencies change depending on this. + const ArchInfo *BaseArch; + + ExtensionSet() : Enabled(), Touched(), BaseArch(nullptr) {} + + // Enable the given architecture extension, and any other extensions it + // depends on. + void enable(ArchExtKind E); + // Disable the given architecture extension, and any other extensions which + // depend on it. + void disable(ArchExtKind E); + + // Add default extensions for the given CPU. + void addCPUDefaults(const CpuInfo &CPU); + // Add default extensions for the given architecture version. + void addArchDefaults(const ArchInfo &Arch); + + // Add or remove a feature based on a modifier string. The string must be of + // the form "<name>" to enable a feature or "no<name>" to disable it. This + // will also enable or disable any features as required by the dependencies + // between them. + bool parseModifier(StringRef Modifier); + + // Convert the set of enabled extension to an LLVM feature list, appending + // them to Features. + void toLLVMFeatureList(std::vector<StringRef> &Features) const; +}; + +struct ExtensionDependency { + ArchExtKind Earlier; + ArchExtKind Later; +}; + +// clang-format off +inline constexpr ExtensionDependency ExtensionDependencies[] = { + {AEK_FP, AEK_FP16}, ---------------- DavidSpickett wrote:
Do I understand that this is `{foo, bar}` meaning if you enable `bar` you must add the feature `foo`? Which seems backwards at first glance but when I get to the use of this maybe it'll be more clear. https://github.com/llvm/llvm-project/pull/78270 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits