[flang-commits] [flang] [flang] Pass to add frame pointer attribute (PR #74598)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Mon Dec 11 03:05:11 PST 2023


================
@@ -310,10 +311,17 @@ inline void createDefaultFIRCodeGenPassPipeline(
 
   if (config.VScaleMin != 0)
     pm.addPass(fir::createVScaleAttrPass({config.VScaleMin, config.VScaleMax}));
-
+  
+  // Add function attributes 
   fir::FunctionAttrTypes functionAttrs;
-  functionAttrs.framePointerKind = config.FramePointerKind;
-  pm.addPass(fir::createFunctionAttrPass(functionAttrs));
+  
+  if (config.FramePointerKind != llvm::FramePointerKind::None) {  
+    if (config.FramePointerKind == llvm::FramePointerKind::NonLeaf) 
+        functionAttrs.framePointerKind = mlir::LLVM::framePointerKind::FramePointerKind::NonLeaf;
+    else functionAttrs.framePointerKind = mlir::LLVM::framePointerKind::FramePointerKind::All;
----------------
tblah wrote:

Why the extra `if` here? Aren't `NonLeaf` and `All` the only possible values other than `None`?

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


More information about the flang-commits mailing list