From 05d39f0de9ee0455d7b2b60f314f4231bc9a87c1 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Fri, 2 Oct 2020 13:31:05 +0200 Subject: 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. --- gcc/calls.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'gcc/calls.c') 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. */ -- cgit v1.1