From cab4a09d69e7cc5c2c64ec1c3d126c4d825d2b83 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Thu, 25 Jul 2013 00:32:41 +0000 Subject: [PATCH] Replace the "NoFramePointerElimNonLeaf" target option with a function attribute. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187092 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/BackendUtil.cpp | 3 --- lib/CodeGen/CGCall.cpp | 12 ++++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp index 04355e252e..1bf49184fc 100644 --- a/lib/CodeGen/BackendUtil.cpp +++ b/lib/CodeGen/BackendUtil.cpp @@ -412,13 +412,10 @@ TargetMachine *EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) { // Set frame pointer elimination mode. if (!CodeGenOpts.DisableFPElim) { Options.NoFramePointerElim = false; - Options.NoFramePointerElimNonLeaf = false; } else if (CodeGenOpts.OmitLeafFramePointer) { Options.NoFramePointerElim = false; - Options.NoFramePointerElimNonLeaf = true; } else { Options.NoFramePointerElim = true; - Options.NoFramePointerElimNonLeaf = true; } if (CodeGenOpts.UseInitArray) diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index 0a202ef5d4..9a38771aa4 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -1072,6 +1072,18 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, CodeGenOpts.SoftFloat ? "true" : "false"); FuncAttrs.addAttribute("stack-protector-buffer-size", llvm::utostr(CodeGenOpts.SSPBufferSize)); + + bool NoFramePointerElimNonLeaf; + if (!CodeGenOpts.DisableFPElim) { + NoFramePointerElimNonLeaf = false; + } else if (CodeGenOpts.OmitLeafFramePointer) { + NoFramePointerElimNonLeaf = true; + } else { + NoFramePointerElimNonLeaf = true; + } + + FuncAttrs.addAttribute("no-frame-pointer-elim-non-leaf", + NoFramePointerElimNonLeaf ? "true" : "false"); } QualType RetTy = FI.getReturnType(); -- 2.40.0