diff options
Diffstat (limited to 'gcc/calls.h')
-rw-r--r-- | gcc/calls.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/gcc/calls.h b/gcc/calls.h index b084270..38ab6ef 100644 --- a/gcc/calls.h +++ b/gcc/calls.h @@ -20,6 +20,77 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_CALLS_H #define GCC_CALLS_H +/* Describes a function argument. + + Each argument conceptually has a gimple-level type. Usually this type + is available directly as a tree via the TYPE field, but when calling + libgcc support functions it might instead be inferred from a mode, + in which case the type isn't available directly. + + This gimple-level type might go through promotion before being passed to + the target function. Depending on the context, the MODE field is either + the mode of the gimple-level type (whether explicitly given or not) + or the mode after promotion has been performed. */ +class function_arg_info +{ +public: + function_arg_info () : type (NULL_TREE), mode (VOIDmode), named (false) {} + + /* Initialize an argument of mode MODE, either before or after promotion. */ + function_arg_info (machine_mode mode, bool named) + : type (NULL_TREE), mode (mode), named (named) + {} + + /* Initialize an unpromoted argument of type TYPE. */ + function_arg_info (tree type, bool named) + : type (type), mode (TYPE_MODE (type)), named (named) + {} + + /* Initialize an argument with explicit properties. */ + function_arg_info (tree type, machine_mode mode, bool named) + : type (type), mode (mode), named (named) + {} + + /* Return true if the gimple-level type is an aggregate. */ + bool aggregate_type_p () const { return type && AGGREGATE_TYPE_P (type); } + + /* Return the size of the gimple-level type, or -1 if the size is + variable or otherwise not representable as a poly_int64. + + Use this function when MODE is the mode of the type before promotion, + or in any context if the target never promotes function arguments. */ + poly_int64 type_size_in_bytes () const + { + if (type) + return int_size_in_bytes (type); + return GET_MODE_SIZE (mode); + } + + /* Return the size of the argument after promotion, or -1 if the size + is variable or otherwise not representable as a poly_int64. + + Use this function when MODE is the mode of the type after promotion. */ + poly_int64 promoted_size_in_bytes () const + { + if (mode == BLKmode) + return int_size_in_bytes (type); + return GET_MODE_SIZE (mode); + } + + /* The type of the argument, or null if not known (which is true for + libgcc support functions). */ + tree type; + + /* The mode of the argument. Depending on context, this might be + the mode of the argument type or the mode after promotion. */ + machine_mode mode; + + /* True if the argument is treated as a named argument, false if it is + treated as an unnamed variadic argument (i.e. one passed through + "..."). See also TARGET_STRICT_ARGUMENT_NAMING. */ + unsigned int named : 1; +}; + extern int flags_from_decl_or_type (const_tree); extern int call_expr_flags (const_tree); extern int setjmp_call_p (const_tree); |