[clang-tools-extra] [flang] [clang] [llvm] [flang] Pass to add frame pointer attribute (PR #74598)

Kiran Chandramohan via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 19 04:20:02 PST 2023


================
@@ -349,4 +349,23 @@ def VScaleAttr : Pass<"vscale-attr", "mlir::func::FuncOp"> {
   let constructor = "::fir::createVScaleAttrPass()";
 }
 
+def FunctionAttr : Pass<"function-attr", "mlir::func::FuncOp"> {
+  let summary = "This is a generic pass that adds function attributes that are expected at the LLVM IR level";
+  let description = [{ This feature introduces a general attribute aimed at customizing function characteristics. 
+     Options include:
+     Add "frame-pointer" attribute to functions: Set an attribute for the frame 
+     pointer on functions, to avoid saving the frame pointer in a register in 
+     functions where it is unnecessary. 
+     This eliminates the need for instructions to save, establish, and restore 
+     frame pointers, while also freeing up an additional register in numerous functions. 
+     However, this approach can make debugging unfeasible on certain machines.
+  }];
+  let options = [
+    Option<"framePointerKind", "frame-pointer",
+           "mlir::LLVM::framePointerKind::FramePointerKind", /*default=*/"mlir::LLVM::framePointerKind::FramePointerKind{}",
+           "frame pointer">,
+  ];
----------------
kiranchandramohan wrote:

Stick to 80 characters if possible in the summary, description and options.

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


More information about the cfe-commits mailing list