GCC Middle and Back End API Reference
attr_fnspec Class Reference

#include <attr-fnspec.h>

Public Member Functions

 attr_fnspec (const char *str, unsigned len)
 
 attr_fnspec (const char *str)
 
 attr_fnspec (const_tree identifier)
 
 attr_fnspec ()
 
bool known_p ()
 
bool arg_specified_p (unsigned int i)
 
bool arg_direct_p (unsigned int i)
 
bool arg_used_p (unsigned int i)
 
bool arg_readonly_p (unsigned int i)
 
bool arg_maybe_read_p (unsigned int i)
 
bool arg_maybe_written_p (unsigned int i)
 
bool arg_max_access_size_given_by_arg_p (unsigned int i, unsigned int *arg)
 
bool arg_access_size_given_by_type_p (unsigned int i)
 
bool arg_copied_to_arg_p (unsigned int i, unsigned int *arg)
 
bool arg_noescape_p (unsigned int i)
 
bool returns_arg (unsigned int *arg_no)
 
bool returns_noalias_p ()
 
bool global_memory_read_p ()
 
bool global_memory_written_p ()
 
bool errno_maybe_written_p ()
 
int arg_eaf_flags (unsigned int i)
 
void verify ()
 
const char * get_str ()
 

Private Member Functions

unsigned int arg_idx (int i)
 

Private Attributes

const char * str
 
const unsigned len
 
const unsigned int return_desc_size = 2
 
const unsigned int arg_desc_size = 2
 

Detailed Description

Handling of fnspec attribute specifiers
Copyright (C) 2008-2024 Free Software Foundation, Inc.
Contributed by Richard Guenther  <rguenther@suse.de>

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
Parse string of attribute "fn spec".  This is an internal attribute
 describing side effects of a function as follows:

 character 0  specifies properties of return values as follows:
   '1'...'4'  specifies number of argument function returns (as in memset)
   'm'  specifies that returned value is noalias (as in malloc)
   '.'  specifies that nothing is known.
 character 1  specifies additional function properties
   ' '        specifies that nothing is known
   'p' or 'P' specifies that function is pure except for described side
        effects.
   'c' or 'C' specifies that function is const except for described side
        effects.
 The uppercase letter in addition specifies that function clobbers errno.

 character 2+2i specifies properties of argument number i as follows:
   'x' or 'X' specifies that parameter is unused.
   'r' or 'R' specifies that the memory pointed to by the parameter is only
        read and does not escape
   'o' or 'O' specifies that the memory pointed to by the parameter is only
        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
 transitively to pointers read from the pointed-to memory.

 character 3+2i specifies additional properties of argument number i
 as follows:
   ' '        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'  specifies the size of value written/read is bound by the
        specified argument

Constructor & Destructor Documentation

◆ attr_fnspec() [1/4]

attr_fnspec::attr_fnspec ( const char * str,
unsigned len )
inline

References verify().

◆ attr_fnspec() [2/4]

attr_fnspec::attr_fnspec ( const char * str)
inline

References verify().

◆ attr_fnspec() [3/4]

attr_fnspec::attr_fnspec ( const_tree identifier)
inline

References verify().

◆ attr_fnspec() [4/4]

attr_fnspec::attr_fnspec ( )
inline

Member Function Documentation

◆ arg_access_size_given_by_type_p()

bool attr_fnspec::arg_access_size_given_by_type_p ( unsigned int i)
inline

References arg_idx(), arg_specified_p(), gcc_checking_assert, i, and str.

Referenced by check_fnspec().

◆ arg_copied_to_arg_p()

bool attr_fnspec::arg_copied_to_arg_p ( unsigned int i,
unsigned int * arg )
inline

◆ arg_direct_p()

bool attr_fnspec::arg_direct_p ( unsigned int i)
inline

◆ arg_eaf_flags()

◆ arg_idx()

◆ arg_max_access_size_given_by_arg_p()

bool attr_fnspec::arg_max_access_size_given_by_arg_p ( unsigned int i,
unsigned int * arg )
inline

References arg_idx(), arg_specified_p(), gcc_checking_assert, i, and str.

Referenced by check_fnspec().

◆ arg_maybe_read_p()

bool attr_fnspec::arg_maybe_read_p ( unsigned int i)
inline

References arg_idx(), arg_specified_p(), gcc_checking_assert, i, and str.

Referenced by check_fnspec().

◆ arg_maybe_written_p()

bool attr_fnspec::arg_maybe_written_p ( unsigned int i)
inline

References arg_idx(), arg_specified_p(), gcc_checking_assert, i, and str.

Referenced by check_fnspec().

◆ arg_noescape_p()

bool attr_fnspec::arg_noescape_p ( unsigned int i)
inline

◆ arg_readonly_p()

bool attr_fnspec::arg_readonly_p ( unsigned int i)
inline

◆ arg_specified_p()

◆ arg_used_p()

bool attr_fnspec::arg_used_p ( unsigned int i)
inline

◆ errno_maybe_written_p()

bool attr_fnspec::errno_maybe_written_p ( )
inline

References str.

Referenced by check_fnspec().

◆ get_str()

const char * attr_fnspec::get_str ( )
inline

References str.

◆ global_memory_read_p()

bool attr_fnspec::global_memory_read_p ( )
inline

References str.

Referenced by check_fnspec(), and determine_global_memory_access().

◆ global_memory_written_p()

bool attr_fnspec::global_memory_written_p ( )
inline

References str.

Referenced by check_fnspec(), and determine_global_memory_access().

◆ known_p()

◆ returns_arg()

bool attr_fnspec::returns_arg ( unsigned int * arg_no)
inline

◆ returns_noalias_p()

bool attr_fnspec::returns_noalias_p ( )
inline

References str.

Referenced by decl_return_flags(), and gimple_call_return_flags().

◆ verify()

void attr_fnspec::verify ( )
Verify validity of the fnspec string.
See attr-fnspec.h for details.   

References arg_desc_size, arg_idx(), arg_specified_p(), i, internal_error(), len, return_desc_size, and str.

Referenced by attr_fnspec(), attr_fnspec(), and attr_fnspec().

Field Documentation

◆ arg_desc_size

const unsigned int attr_fnspec::arg_desc_size = 2
private

Referenced by arg_idx(), and verify().

◆ len

const unsigned attr_fnspec::len
private

Referenced by arg_specified_p(), known_p(), and verify().

◆ return_desc_size

const unsigned int attr_fnspec::return_desc_size = 2
private

Referenced by arg_idx(), and verify().

◆ str


The documentation for this class was generated from the following files: