diff options
Diffstat (limited to 'gcc/attr-fnspec.h')
-rw-r--r-- | gcc/attr-fnspec.h | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/gcc/attr-fnspec.h b/gcc/attr-fnspec.h index 28135328..b4b49e9 100644 --- a/gcc/attr-fnspec.h +++ b/gcc/attr-fnspec.h @@ -41,6 +41,9 @@ written and does not escape 'w' or 'W' specifies that the memory pointed to by the parameter does not escape + '1'....'9' specifies that the memory pointed to by the parameter is + copied to memory pointed to by different parameter + (as in memcpy). '.' specifies that nothing is known. The uppercase letter in addition specifies that the memory pointed to by the parameter is not dereferenced. For 'r' only read applies @@ -51,8 +54,8 @@ ' ' nothing is known 't' the size of value written/read corresponds to the size of of the pointed-to type of the argument type - '1'...'9' the size of value written/read is given by the specified - argument + '1'...'9' specifies the size of value written/read is given by the + specified argument */ #ifndef ATTR_FNSPEC_H @@ -122,7 +125,8 @@ public: { unsigned int idx = arg_idx (i); gcc_checking_assert (arg_specified_p (i)); - return str[idx] == 'R' || str[idx] == 'O' || str[idx] == 'W'; + return str[idx] == 'R' || str[idx] == 'O' + || str[idx] == 'W' || (str[idx] >= '1' && str[idx] <= '9'); } /* True if argument is used. */ @@ -161,6 +165,7 @@ public: unsigned int idx = arg_idx (i); gcc_checking_assert (arg_specified_p (i)); return str[idx] != 'r' && str[idx] != 'R' + && (str[idx] < '1' || str[idx] > '9') && str[idx] != 'x' && str[idx] != 'X'; } @@ -190,6 +195,21 @@ public: return str[idx + 1] == 't'; } + /* Return true if memory pointer to by argument is copied to a memory + pointed to by a different argument (as in memcpy). + In this case set ARG. */ + bool + arg_copied_to_arg_p (unsigned int i, unsigned int *arg) + { + unsigned int idx = arg_idx (i); + gcc_checking_assert (arg_specified_p (i)); + if (str[idx] < '1' || str[idx] > '9') + return false; + *arg = str[idx] - '1'; + return true; + } + + /* True if the argument does not escape. */ bool arg_noescape_p (unsigned int i) @@ -230,7 +250,7 @@ public: return str[1] != 'c' && str[1] != 'C'; } - /* Return true if all memory written by the function + /* Return true if all memory written by the function is specified by fnspec. */ bool global_memory_written_p () |