From 25583c4f453910e4bf35cc55b692dea60007f673 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 20 Apr 2011 08:21:25 +0000 Subject: Makefile.in (INTERNAL_FN_DEF, [...]): Define. gcc/ * Makefile.in (INTERNAL_FN_DEF, INTERNAL_FN_H): Define. (GIMPLE_H): Include $(INTERNAL_FN_H). (OBJS-common): Add internal-fn.o. (internal-fn.o): New rule. * internal-fn.def: New file. * internal-fn.h: Likewise. * internal-fn.c: Likewise. * gimple.h: Include internal-fn.h. (GF_CALL_INTERNAL): New gf_mask. (gimple_statement_call): Put fntype into a union with a new internal_fn field. (gimple_build_call_internal): Declare. (gimple_build_call_internal_vec): Likewise. (gimple_call_same_target_p): Likewise. (gimple_call_internal_p): New function. (gimple_call_internal_fn): Likewise. (gimple_call_fntype): Return null for internal calls. (gimple_call_set_fntype): Assert that the function is not internal. (gimple_call_set_fn): Likewise. (gimple_call_set_fndecl): Likewise. (gimple_call_set_internal_fn): New function. (gimple_call_addr_fndecl): Handle null functions. (gimple_call_return_type): Likewise null types. * gimple.c (gimple_build_call_internal_1): New function. (gimple_build_call_internal): Likewise. (gimple_build_call_internal_vec): Likewise. (gimple_call_same_target_p): Likewise. (gimple_call_flags): Handle calls to internal functions. (gimple_call_fnspec): New function. (gimple_call_arg_flags, gimple_call_return_flags): Use it. (gimple_has_side_effects): Handle null functions. (gimple_rhs_has_side_effects): Likewise. (gimple_call_copy_skip_args): Handle calls to internal functions. * cfgexpand.c (expand_call_stmt): Likewise. * expr.c (expand_expr_real_1): Assert that the call isn't internal. * gimple-fold.c (gimple_fold_call): Handle null functions. (gimple_fold_stmt_to_constant_1): Don't fold calls to internal functions. * gimple-low.c (gimple_check_call_args): Handle calls to internal functions. * gimple-pretty-print.c (dump_gimple_call): Likewise. * ipa-prop.c (ipa_analyze_call_uses): Handle null functions. * tree-cfg.c (verify_gimple_call): Handle calls to internal functions. (do_warn_unused_result): Likewise. * tree-eh.c (same_handler_p): Use gimple_call_same_target_p. * tree-ssa-ccp.c (ccp_fold_stmt): Handle calls to internal functions. * tree-ssa-dom.c (hashable_expr): Use the gimple statement to record the target of a call. (initialize_hash_element): Update accordingly. (hashable_expr_equal_p): Use gimple_call_same_target_p. (iterative_hash_hashable_expr): Handle calls to internal functions. (print_expr_hash_elt): Likewise. * tree-ssa-pre.c (can_value_number_call): Likewise. (eliminate): Handle null functions. * tree-ssa-sccvn.c (visit_use): Handle calls to internal functions. * tree-ssa-structalias.c (get_fi_for_callee): Likewise. (find_func_aliases): Likewise. * value-prof.c (gimple_ic_transform): Likewise. (gimple_indirect_call_to_profile): Likewise. * lto-streamer-in.c (input_gimple_stmt): Likewise. * lto-streamer-out.c (output_gimple_stmt): Likewise. From-SVN: r172758 --- gcc/internal-fn.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 gcc/internal-fn.c (limited to 'gcc/internal-fn.c') diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c new file mode 100644 index 0000000..9f087b8 --- /dev/null +++ b/gcc/internal-fn.c @@ -0,0 +1,64 @@ +/* Internal functions. + Copyright (C) 2011 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, 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 +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "internal-fn.h" +#include "tree.h" +#include "expr.h" +#include "optabs.h" +#include "gimple.h" + +/* The names of each internal function, indexed by function number. */ +const char *const internal_fn_name_array[] = { +#define DEF_INTERNAL_FN(CODE, FLAGS) #CODE, +#include "internal-fn.def" +#undef DEF_INTERNAL_FN + "" +}; + +/* The ECF_* flags of each internal function, indexed by function number. */ +const int internal_fn_flags_array[] = { +#define DEF_INTERNAL_FN(CODE, FLAGS) FLAGS, +#include "internal-fn.def" +#undef DEF_INTERNAL_FN + 0 +}; + +/* Routines to expand each internal function, indexed by function number. + Each routine has the prototype: + + expand_ (gimple stmt) + + where STMT is the statement that performs the call. */ +static void (*const internal_fn_expanders[]) (gimple) = { +#define DEF_INTERNAL_FN(CODE, FLAGS) expand_##CODE, +#include "internal-fn.def" +#undef DEF_INTERNAL_FN + 0 +}; + +/* Expand STMT, which is a call to internal function FN. */ + +void +expand_internal_call (gimple stmt) +{ + internal_fn_expanders[(int) gimple_call_internal_fn (stmt)] (stmt); +} -- cgit v1.1