aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.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/tree-ssa-alias.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/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 9e5c3ee..52aeaeb 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -40,6 +40,8 @@ along with GCC; see the file COPYING3. If not see
#include "varasm.h"
#include "ipa-modref-tree.h"
#include "ipa-modref.h"
+#include "attr-fnspec.h"
+#include "errors.h"
/* Broad overview of how alias analysis on gimple works:
@@ -4012,3 +4014,42 @@ walk_aliased_vdefs (ao_ref *ref, tree vdef,
return ret;
}
+/* Verify validity of the fnspec string.
+ See attr-fnspec.h for details. */
+
+void
+attr_fnspec::verify ()
+{
+ /* FIXME: Fortran trans-decl.c contains multiple wrong fnspec strings.
+ re-enable verification after these are fixed. */
+ return;
+ bool err = false;
+
+ /* Check return value specifier. */
+ if (len < return_desc_size)
+ err = true;
+ else if ((str[0] < '1' || str[0] > '4')
+ && str[0] != '.' && str[0] != 'm')
+ err = true;
+
+ /* Now check all parameters. */
+ for (unsigned int i = 0; arg_specified_p (i); i++)
+ {
+ unsigned int idx = arg_idx (i);
+ switch (str[idx])
+ {
+ case 'x':
+ case 'X':
+ case 'r':
+ case 'R':
+ case 'w':
+ case 'W':
+ case '.':
+ break;
+ default:
+ err = true;
+ }
+ }
+ if (err)
+ internal_error ("invalid fn spec attribute %s", str);
+}