diff options
author | Jan Hubicka <jh@suse.cz> | 2020-10-02 13:31:05 +0200 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2020-10-02 13:31:05 +0200 |
commit | 05d39f0de9ee0455d7b2b60f314f4231bc9a87c1 (patch) | |
tree | 7bb10d8d757e886dbd5dc025ed425ae63fa58d93 /gcc/tree-into-ssa.c | |
parent | b8e773e9921904210cad1f396b2ab01ffdbc4b39 (diff) | |
download | gcc-05d39f0de9ee0455d7b2b60f314f4231bc9a87c1.zip gcc-05d39f0de9ee0455d7b2b60f314f4231bc9a87c1.tar.gz gcc-05d39f0de9ee0455d7b2b60f314f4231bc9a87c1.tar.bz2 |
Commonize handling of attr-fnspec
* attr-fnspec.h: New file.
* calls.c (decl_return_flags): Use attr_fnspec.
* gimple.c (gimple_call_arg_flags): Use attr_fnspec.
(gimple_call_return_flags): Use attr_fnspec.
* tree-into-ssa.c (pass_build_ssa::execute): Use attr_fnspec.
* tree-ssa-alias.c (attr_fnspec::verify): New member fuction.
Diffstat (limited to 'gcc/tree-into-ssa.c')
-rw-r--r-- | gcc/tree-into-ssa.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index 0d01613..1493b32 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -41,6 +41,7 @@ along with GCC; see the file COPYING3. If not see #include "stringpool.h" #include "attribs.h" #include "asan.h" +#include "attr-fnspec.h" #define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y)) @@ -2492,19 +2493,19 @@ pass_build_ssa::execute (function *fun) } /* Initialize SSA_NAME_POINTS_TO_READONLY_MEMORY. */ - tree fnspec = lookup_attribute ("fn spec", - TYPE_ATTRIBUTES (TREE_TYPE (fun->decl))); - if (fnspec) + tree fnspec_tree + = lookup_attribute ("fn spec", + TYPE_ATTRIBUTES (TREE_TYPE (fun->decl))); + if (fnspec_tree) { - fnspec = TREE_VALUE (TREE_VALUE (fnspec)); - unsigned i = 1; + attr_fnspec fnspec (TREE_VALUE (TREE_VALUE (fnspec_tree))); + unsigned i = 0; for (tree arg = DECL_ARGUMENTS (cfun->decl); arg; arg = DECL_CHAIN (arg), ++i) { - if (i >= (unsigned) TREE_STRING_LENGTH (fnspec)) - break; - if (TREE_STRING_POINTER (fnspec)[i] == 'R' - || TREE_STRING_POINTER (fnspec)[i] == 'r') + if (!fnspec.arg_specified_p (i)) + break; + if (fnspec.arg_readonly_p (i)) { tree name = ssa_default_def (fun, arg); if (name) |