diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2015-11-17 18:34:47 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2015-11-17 18:34:47 +0000 |
commit | 00175cb22a6ec9029f64044a9665c7390d53e5f6 (patch) | |
tree | b256b1ce82752ff2bfe63d20fcfd0cc3bdde69f8 /gcc/tree.h | |
parent | 3e44547c936be9e741411e812fc1565f539641c1 (diff) | |
download | gcc-00175cb22a6ec9029f64044a9665c7390d53e5f6.zip gcc-00175cb22a6ec9029f64044a9665c7390d53e5f6.tar.gz gcc-00175cb22a6ec9029f64044a9665c7390d53e5f6.tar.bz2 |
Add a combined_fn enum
I'm working on a patch series that needs to be able to treat built-in
functions and internal functions in a similar way. This patch adds a
new enum, combined_fn, that combines the two together. It also adds
utility functions for seeing which combined_fn (if any) is called by
a given CALL_EXPR or gcall.
Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi.
gcc/
* tree-core.h (internal_fn): Move immediately after the definition
of built_in_function.
(combined_fn): New enum.
* tree.h (as_combined_fn, builtin_fn_p, as_builtin_fn)
(internal_fn_p, as_internal_fn): New functions.
(get_call_combined_fn, combined_fn_name): Declare.
* tree.c (get_call_combined_fn): New function.
(combined_fn_name): Likewise.
* gimple.h (gimple_call_combined_fn): Declare.
* gimple.c (gimple_call_combined_fn): New function.
From-SVN: r230472
Diffstat (limited to 'gcc/tree.h')
-rw-r--r-- | gcc/tree.h | 54 |
1 files changed, 54 insertions, 0 deletions
@@ -22,6 +22,58 @@ along with GCC; see the file COPYING3. If not see #include "tree-core.h" +/* Convert a target-independent built-in function code to a combined_fn. */ + +inline combined_fn +as_combined_fn (built_in_function fn) +{ + return combined_fn (int (fn)); +} + +/* Convert an internal function code to a combined_fn. */ + +inline combined_fn +as_combined_fn (internal_fn fn) +{ + return combined_fn (int (fn) + int (END_BUILTINS)); +} + +/* Return true if CODE is a target-independent built-in function. */ + +inline bool +builtin_fn_p (combined_fn code) +{ + return int (code) < int (END_BUILTINS); +} + +/* Return the target-independent built-in function represented by CODE. + Only valid if builtin_fn_p (CODE). */ + +inline built_in_function +as_builtin_fn (combined_fn code) +{ + gcc_checking_assert (builtin_fn_p (code)); + return built_in_function (int (code)); +} + +/* Return true if CODE is an internal function. */ + +inline bool +internal_fn_p (combined_fn code) +{ + return int (code) >= int (END_BUILTINS); +} + +/* Return the internal function represented by CODE. Only valid if + internal_fn_p (CODE). */ + +inline internal_fn +as_internal_fn (combined_fn code) +{ + gcc_checking_assert (internal_fn_p (code)); + return internal_fn (int (code) - int (END_BUILTINS)); +} + /* Macros for initializing `tree_contains_struct'. */ #define MARK_TS_BASE(C) \ do { \ @@ -4529,6 +4581,7 @@ extern unsigned crc32_unsigned (unsigned, unsigned); extern void clean_symbol_name (char *); extern tree get_file_function_name (const char *); extern tree get_callee_fndecl (const_tree); +extern combined_fn get_call_combined_fn (const_tree); extern int type_num_arguments (const_tree); extern bool associative_tree_code (enum tree_code); extern bool commutative_tree_code (enum tree_code); @@ -4554,6 +4607,7 @@ extern tree lhd_gcc_personality (void); extern void assign_assembler_name_if_neeeded (tree); extern void warn_deprecated_use (tree, tree); extern void cache_integer_cst (tree); +extern const char *combined_fn_name (combined_fn); /* Return the memory model from a host integer. */ static inline enum memmodel |