OSDN Git Service

2011-04-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / internal-fn.c
1 /* Internal functions.
2    Copyright (C) 2011 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
10
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3.  If not see
18 <http://www.gnu.org/licenses/>.  */
19
20 #include "config.h"
21 #include "system.h"
22 #include "coretypes.h"
23 #include "internal-fn.h"
24 #include "tree.h"
25 #include "expr.h"
26 #include "optabs.h"
27 #include "gimple.h"
28
29 /* The names of each internal function, indexed by function number.  */
30 const char *const internal_fn_name_array[] = {
31 #define DEF_INTERNAL_FN(CODE, FLAGS) #CODE,
32 #include "internal-fn.def"
33 #undef DEF_INTERNAL_FN
34   "<invalid-fn>"
35 };
36
37 /* The ECF_* flags of each internal function, indexed by function number.  */
38 const int internal_fn_flags_array[] = {
39 #define DEF_INTERNAL_FN(CODE, FLAGS) FLAGS,
40 #include "internal-fn.def"
41 #undef DEF_INTERNAL_FN
42   0
43 };
44
45 /* Routines to expand each internal function, indexed by function number.
46    Each routine has the prototype:
47
48        expand_<NAME> (gimple stmt)
49
50    where STMT is the statement that performs the call. */
51 static void (*const internal_fn_expanders[]) (gimple) = {
52 #define DEF_INTERNAL_FN(CODE, FLAGS) expand_##CODE,
53 #include "internal-fn.def"
54 #undef DEF_INTERNAL_FN
55   0
56 };
57
58 /* Expand STMT, which is a call to internal function FN.  */
59
60 void
61 expand_internal_call (gimple stmt)
62 {
63   internal_fn_expanders[(int) gimple_call_internal_fn (stmt)] (stmt);
64 }