[clang] [llvm] CodeGen, IR: Add target-{cpu,features} attributes to functions created via createWithDefaultAttr(). (PR #96721)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 25 20:39:04 PDT 2024


================
@@ -327,6 +327,26 @@ class LLVMContext {
   [[deprecated("Always returns false")]]
   bool supportsTypedPointers() const;
 
+  /// Get the current "default" target CPU (target-cpu function attribute). The
+  /// intent is that compiler frontends will set this to a value that reflects
+  /// the attribute that a function would get "by default" without any specific
+  /// function attributes, and compiler passes will attach the attribute to
+  /// newly created functions that are not associated with a particular
+  /// function, such as global initializers. Function::createWithDefaultAttr()
+  /// will create functions with this attribute. This function should only be
+  /// called by passes that run at compile time and not by the backend or LTO
+  /// passes.
+  StringRef getDefaultTargetCPU();
+
+  /// See getDefaultTargetCPU().
+  void setDefaultTargetCPU(StringRef CPU);
+
+  /// Similar to getDefaultTargetCPU() but for default target-features instead.
+  StringRef getDefaultTargetFeatures();
+
+  /// See getDefaultTargetFeatures().
+  void setDefaultTargetFeatures(StringRef Features);
+
----------------
pcc wrote:

Done

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


More information about the cfe-commits mailing list