aboutsummaryrefslogtreecommitdiff
path: root/gcc/calls.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2020-10-02 13:31:05 +0200
committerJan Hubicka <jh@suse.cz>2020-10-02 13:31:05 +0200
commit05d39f0de9ee0455d7b2b60f314f4231bc9a87c1 (patch)
tree7bb10d8d757e886dbd5dc025ed425ae63fa58d93 /gcc/calls.c
parentb8e773e9921904210cad1f396b2ab01ffdbc4b39 (diff)
downloadgcc-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/calls.c')
-rw-r--r--gcc/calls.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/gcc/calls.c b/gcc/calls.c
index ed43638..93da3d6 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see
#include "attribs.h"
#include "builtins.h"
#include "gimple-fold.h"
+#include "attr-fnspec.h"
#include "tree-pretty-print.h"
@@ -642,25 +643,15 @@ decl_return_flags (tree fndecl)
if (!attr)
return 0;
- attr = TREE_VALUE (TREE_VALUE (attr));
- if (!attr || TREE_STRING_LENGTH (attr) < 1)
- return 0;
-
- switch (TREE_STRING_POINTER (attr)[0])
- {
- case '1':
- case '2':
- case '3':
- case '4':
- return ERF_RETURNS_ARG | (TREE_STRING_POINTER (attr)[0] - '1');
+ attr_fnspec fnspec (TREE_VALUE (TREE_VALUE (attr)));
- case 'm':
- return ERF_NOALIAS;
+ unsigned int arg;
+ if (fnspec.returns_arg (&arg))
+ return ERF_RETURNS_ARG | arg;
- case '.':
- default:
- return 0;
- }
+ if (fnspec.returns_noalias_p ())
+ return ERF_NOALIAS;
+ return 0;
}
/* Return nonzero when FNDECL represents a call to setjmp. */