Driver/IRgen: Add support for -momit-leaf-frame-pointer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107367 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp
index 793a4da..69efe43 100644
--- a/lib/CodeGen/BackendUtil.cpp
+++ b/lib/CodeGen/BackendUtil.cpp
@@ -160,7 +160,20 @@
   // FIXME: Expose these capabilities via actual APIs!!!! Aside from just
   // being gross, this is also totally broken if we ever care about
   // concurrency.
-  llvm::NoFramePointerElim = CodeGenOpts.DisableFPElim;
+
+  // Set frame pointer elimination mode.
+  if (!CodeGenOpts.DisableFPElim) {
+    llvm::NoFramePointerElim = false;
+    llvm::NoFramePointerElimNonLeaf = false;
+  } else if (CodeGenOpts.OmitLeafFramePointer) {
+    llvm::NoFramePointerElim = false;
+    llvm::NoFramePointerElimNonLeaf = true;
+  } else {
+    llvm::NoFramePointerElim = true;
+    llvm::NoFramePointerElimNonLeaf = true;
+  }
+
+  // Set float ABI type.
   if (CodeGenOpts.FloatABI == "soft")
     llvm::FloatABIType = llvm::FloatABI::Soft;
   else if (CodeGenOpts.FloatABI == "hard")
@@ -169,6 +182,7 @@
     assert(CodeGenOpts.FloatABI.empty() && "Invalid float abi!");
     llvm::FloatABIType = llvm::FloatABI::Default;
   }
+
   NoZerosInBSS = CodeGenOpts.NoZeroInitializedInBSS;
   llvm::UseSoftFloat = CodeGenOpts.SoftFloat;
   UnwindTablesMandatory = CodeGenOpts.UnwindTables;