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

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Thu Dec 7 02:17:39 PST 2023


================
@@ -245,6 +245,19 @@ static void parseCodeGenArgs(Fortran::frontend::CodeGenOptions &opts,
 
   opts.AliasAnalysis = opts.OptimizationLevel > 0;
 
+  if (const llvm::opt::Arg *a =
+          args.getLastArg(clang::driver::options::OPT_mframe_pointer_EQ)) {
+    llvm::StringRef s = a->getValue();
+    assert(s == "none" || s == "non-leaf"|| s == "all");
+    if (s == "none")
+      opts.setFramePointer(llvm::FramePointerKind::None);
+    else
+      if (s == "non-leaf")
+        opts.setFramePointer(llvm::FramePointerKind::NonLeaf);
+      else
+        opts.setFramePointer(llvm::FramePointerKind::All);
----------------
kiranchandramohan wrote:

Nit: Add braces for the the outer if else.

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


More information about the flang-commits mailing list