[PATCH] Attach attribute "trap-func-name" to IR function

Eric Christopher echristo at gmail.com
Mon Jun 29 22:48:07 PDT 2015


Lgtm thanks.

On Mon, Jun 29, 2015, 10:35 PM Akira Hatanaka <ahatanak at gmail.com> wrote:

> Remove cc1 option and simplify patch.
>
>
> http://reviews.llvm.org/D10831
>
> Files:
>   lib/CodeGen/BackendUtil.cpp
>   lib/CodeGen/CGCall.cpp
>   test/CodeGen/fn-attr.c
>
> Index: lib/CodeGen/BackendUtil.cpp
> ===================================================================
> --- lib/CodeGen/BackendUtil.cpp
> +++ lib/CodeGen/BackendUtil.cpp
> @@ -536,7 +536,6 @@
>    Options.NoZerosInBSS = CodeGenOpts.NoZeroInitializedInBSS;
>    Options.UnsafeFPMath = CodeGenOpts.UnsafeFPMath;
>    Options.StackAlignmentOverride = CodeGenOpts.StackAlignment;
> -  Options.TrapFuncName = CodeGenOpts.TrapFuncName;
>    Options.PositionIndependentExecutable = LangOpts.PIELevel != 0;
>    Options.FunctionSections = CodeGenOpts.FunctionSections;
>    Options.DataSections = CodeGenOpts.DataSections;
> Index: lib/CodeGen/CGCall.cpp
> ===================================================================
> --- lib/CodeGen/CGCall.cpp
> +++ lib/CodeGen/CGCall.cpp
> @@ -1483,6 +1483,9 @@
>      if (!CodeGenOpts.StackRealignment)
>        FuncAttrs.addAttribute("no-realign-stack");
>
> +    if (!CodeGenOpts.TrapFuncName.empty())
> +      FuncAttrs.addAttribute("trap-func-name", CodeGenOpts.TrapFuncName);
> +
>      // Add target-cpu and target-features attributes to functions. If
>      // we have a decl for the function and it has a target attribute then
>      // parse that and add it to the feature set.
> Index: test/CodeGen/fn-attr.c
> ===================================================================
> --- /dev/null
> +++ test/CodeGen/fn-attr.c
> @@ -0,0 +1,5 @@
> +// RUN: %clang_cc1 -triple thumbv7-apple-ios5 -function-attribute
> trap-func-name=trapfuncname1 -emit-llvm -o - %s | FileCheck %s
> +
> +// CHECK: attributes #0 = { {{.*}} "trap-func-name"="trapfuncname1"
> +
> +int foo1(int a) { return a; }
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150630/439e7743/attachment.html>


More information about the cfe-commits mailing list