* Makefile.in (rtlanal.o): Depend on $(TM_P_H).
[official-gcc.git] / gcc / langhooks.c
blobea0df90484831d0b0c3ea57eec159f33402c4b69
1 /* Default language-specific hooks.
2 Copyright 2001 Free Software Foundation, Inc.
3 Contributed by Alexandre Oliva <aoliva@redhat.com>
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 #include "config.h"
23 #include "system.h"
24 #include "toplev.h"
25 #include "tree.h"
26 #include "tree-inline.h"
27 #include "rtl.h"
28 #include "insn-config.h"
29 #include "integrate.h"
30 #include "langhooks.h"
33 /* lang_hooks.tree_inlining.walk_subtrees is called by walk_tree()
34 after handling common cases, but before walking code-specific
35 sub-trees. If this hook is overridden for a language, it should
36 handle language-specific tree codes, as well as language-specific
37 information associated to common tree codes. If a tree node is
38 completely handled within this function, it should set *SUBTREES to
39 0, so that generic handling isn't attempted. For language-specific
40 tree codes, generic handling would abort(), so make sure it is set
41 properly. Both SUBTREES and *SUBTREES is guaranteed to be non-zero
42 when the function is called. */
44 tree
45 tree_inlining_default_hook_walk_subtrees (tp,subtrees,func,data,htab)
46 tree *tp ATTRIBUTE_UNUSED;
47 int *subtrees ATTRIBUTE_UNUSED;
48 walk_tree_fn func ATTRIBUTE_UNUSED;
49 void *data ATTRIBUTE_UNUSED;
50 void *htab ATTRIBUTE_UNUSED;
52 return NULL_TREE;
55 /* lang_hooks.tree_inlining.cannot_inline_tree_fn is called to
56 determine whether there are language-specific reasons for not
57 inlining a given function. */
59 int
60 tree_inlining_default_hook_cannot_inline_tree_fn (fnp)
61 tree *fnp ATTRIBUTE_UNUSED;
63 return 0;
66 /* lang_hooks.tree_inlining.disregard_inline_limits is called to
67 determine whether a function should be considered for inlining even
68 if it would exceed inlining limits. */
70 int
71 tree_inlining_default_hook_disregard_inline_limits (fn)
72 tree fn ATTRIBUTE_UNUSED;
74 return 0;
77 /* lang_hooks.tree_inlining.add_pending_fn_decls is called before
78 starting to inline a function, to push any language-specific
79 functions that should not be inlined into the current function,
80 into VAFNP. PFN is the top of varray, and should be returned if no
81 functions are pushed into VAFNP. The top of the varray should be
82 returned. */
84 tree
85 tree_inlining_default_hook_add_pending_fn_decls (vafnp, pfn)
86 void *vafnp ATTRIBUTE_UNUSED;
87 tree pfn;
89 return pfn;
92 /* lang_hooks.tree_inlining.tree_chain_matters_p indicates whether the
93 TREE_CHAIN of a language-specific tree node is relevant, i.e.,
94 whether it should be walked, copied and preserved across copies. */
96 int
97 tree_inlining_default_hook_tree_chain_matters_p (t)
98 tree t ATTRIBUTE_UNUSED;
100 return 0;
103 /* lang_hooks.tree_inlining.auto_var_in_fn_p is called to determine
104 whether VT is an automatic variable defined in function FT. */
107 tree_inlining_default_hook_auto_var_in_fn_p (var, fn)
108 tree var, fn;
110 return (DECL_P (var) && DECL_CONTEXT (var) == fn
111 && (((TREE_CODE (var) == VAR_DECL || TREE_CODE (var) == PARM_DECL)
112 && ! TREE_STATIC (var))
113 || TREE_CODE (var) == LABEL_DECL
114 || TREE_CODE (var) == RESULT_DECL));
117 /* lang_hooks.tree_inlining.copy_res_decl_for_inlining should return a
118 declaration for the result RES of function FN to be inlined into
119 CALLER. NDP points to an integer that should be set in case a new
120 declaration wasn't created (presumably because RES was of aggregate
121 type, such that a TARGET_EXPR is used for the result). TEXPS is a
122 pointer to a varray with the stack of TARGET_EXPRs seen while
123 inlining functions into caller; the top of TEXPS is supposed to
124 match RES. */
126 tree
127 tree_inlining_default_hook_copy_res_decl_for_inlining (res, fn, caller,
128 dm, ndp, texps)
129 tree res, fn, caller;
130 void *dm ATTRIBUTE_UNUSED;
131 int *ndp ATTRIBUTE_UNUSED;
132 void *texps ATTRIBUTE_UNUSED;
134 return copy_decl_for_inlining (res, fn, caller);
137 /* lang_hooks.tree_inlining.anon_aggr_type_p determines whether T is a
138 type node representing an anonymous aggregate (union, struct, etc),
139 i.e., one whose members are in the same scope as the union itself. */
142 tree_inlining_default_hook_anon_aggr_type_p (t)
143 tree t ATTRIBUTE_UNUSED;
145 return 0;