[dragonegg] r187105 - Try to update to set the no-frame-pointer-elim-non-leaf attribute as a function attribute instead of target option.

David Blaikie dblaikie at gmail.com
Thu Jul 25 09:35:51 PDT 2013


On Wed, Jul 24, 2013 at 11:20 PM, Bill Wendling <isanbard at gmail.com> wrote:
> Author: void
> Date: Thu Jul 25 01:20:06 2013
> New Revision: 187105
>
> URL: http://llvm.org/viewvc/llvm-project?rev=187105&view=rev
> Log:
> Try to update to set the no-frame-pointer-elim-non-leaf attribute as a function attribute instead of target option.
>
> Modified:
>     dragonegg/trunk/src/Backend.cpp
>     dragonegg/trunk/src/Convert.cpp
>
> Modified: dragonegg/trunk/src/Backend.cpp
> URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=187105&r1=187104&r2=187105&view=diff
> ==============================================================================
> --- dragonegg/trunk/src/Backend.cpp (original)
> +++ dragonegg/trunk/src/Backend.cpp Thu Jul 25 01:20:06 2013
> @@ -484,11 +484,9 @@ static void CreateTargetMachine(const st
>    if (flag_omit_frame_pointer) {
>      // Eliminate frame pointers everywhere.
>      Options.NoFramePointerElim = false;
> -    Options.NoFramePointerElimNonLeaf = false;
>    } else {
>      // Keep frame pointers everywhere.
>      Options.NoFramePointerElim = true;
> -    Options.NoFramePointerElimNonLeaf = true;
>    }
>    // If a target has an option to eliminate frame pointers in leaf functions
>    // only then it should set
>
> Modified: dragonegg/trunk/src/Convert.cpp
> URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=187105&r1=187104&r2=187105&view=diff
> ==============================================================================
> --- dragonegg/trunk/src/Convert.cpp (original)
> +++ dragonegg/trunk/src/Convert.cpp Thu Jul 25 01:20:06 2013
> @@ -1034,6 +1034,14 @@ void TreeToLLVM::StartFunctionBody() {
>    if (lookup_attribute("naked", DECL_ATTRIBUTES(FnDecl)))
>      Fn->addFnAttr(Attribute::Naked);
>
> +  if (flag_omit_frame_pointer) {
> +    // Eliminate frame pointers everywhere.
> +    Fn->addFnAttr("no-frame-pointer-elim-non-leaf", "false");

Curious choice to do this with if (x) { addFnAttribute } else {
addFnAttribute } here whereas to use the conditional operator in the
Clang change for the same. As I mentioned there, presumably we want a
simple bool->StringRef (if we don't already) & just
Fn->addFnAttr("no-frame-pointer-elim-non-leaf",
ToString(!flag_omit_frame_pointer))

Speaking of which:

If the flag has to be present anyway, should we avoid the negative in
it & just name it "frame-pointer-elim-non-leaf"?

> +  } else {
> +    // Keep frame pointers everywhere.
> +    Fn->addFnAttr("no-frame-pointer-elim-non-leaf", "true");
> +  }
> +
>    // Handle annotate attributes
>    if (DECL_ATTRIBUTES(FnDecl))
>      AddAnnotateAttrsToGlobal(Fn, FnDecl);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list