]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/langhooks.c
langhooks.c: Include rtl.h, insn-config.h and integrate.h.
[thirdparty/gcc.git] / gcc / langhooks.c
1 /* Default language-specific hooks.
2 Copyright 2001 Free Software Foundation, Inc.
3 Contributed by Alexandre Oliva <aoliva@redhat.com>
4
5 This file is part of GNU CC.
6
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.
11
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.
16
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. */
21
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
31 /* lang_hooks.tree_inlining.walk_subtrees is called by walk_tree()
32 after handling common cases, but before walking code-specific
33 sub-trees. If this hook is overridden for a language, it should
34 handle language-specific tree codes, as well as language-specific
35 information associated to common tree codes. If a tree node is
36 completely handled within this function, it should set *SUBTREES to
37 0, so that generic handling isn't attempted. For language-specific
38 tree codes, generic handling would abort(), so make sure it is set
39 properly. Both SUBTREES and *SUBTREES is guaranteed to be non-zero
40 when the function is called. */
41
42 tree
43 tree_inlining_default_hook_walk_subtrees (tp,subtrees,func,data,htab)
44 tree *tp ATTRIBUTE_UNUSED;
45 int *subtrees ATTRIBUTE_UNUSED;
46 walk_tree_fn func ATTRIBUTE_UNUSED;
47 void *data ATTRIBUTE_UNUSED;
48 void *htab ATTRIBUTE_UNUSED;
49 {
50 return NULL_TREE;
51 }
52
53 /* lang_hooks.tree_inlining.cannot_inline_tree_fn is called to
54 determine whether there are language-specific reasons for not
55 inlining a given function. */
56
57 int
58 tree_inlining_default_hook_cannot_inline_tree_fn (fnp)
59 tree *fnp ATTRIBUTE_UNUSED;
60 {
61 return 0;
62 }
63
64 /* lang_hooks.tree_inlining.disregard_inline_limits is called to
65 determine whether a function should be considered for inlining even
66 if it would exceed inlining limits. */
67
68 int
69 tree_inlining_default_hook_disregard_inline_limits (fn)
70 tree fn ATTRIBUTE_UNUSED;
71 {
72 return 0;
73 }
74
75 /* lang_hooks.tree_inlining.add_pending_fn_decls is called before
76 starting to inline a function, to push any language-specific
77 functions that should not be inlined into the current function,
78 into VAFNP. PFN is the top of varray, and should be returned if no
79 functions are pushed into VAFNP. The top of the varray should be
80 returned. */
81
82 tree
83 tree_inlining_default_hook_add_pending_fn_decls (vafnp, pfn)
84 void *vafnp ATTRIBUTE_UNUSED;
85 tree pfn;
86 {
87 return pfn;
88 }
89
90 /* lang_hooks.tree_inlining.tree_chain_matters_p indicates whether the
91 TREE_CHAIN of a language-specific tree node is relevant, i.e.,
92 whether it should be walked, copied and preserved across copies. */
93
94 int
95 tree_inlining_default_hook_tree_chain_matters_p (t)
96 tree t ATTRIBUTE_UNUSED;
97 {
98 return 0;
99 }
100
101 /* lang_hooks.tree_inlining.auto_var_in_fn_p is called to determine
102 whether VT is an automatic variable defined in function FT. */
103
104 int
105 tree_inlining_default_hook_auto_var_in_fn_p (var, fn)
106 tree var, fn;
107 {
108 return (DECL_P (var) && DECL_CONTEXT (var) == fn
109 && (((TREE_CODE (var) == VAR_DECL || TREE_CODE (var) == PARM_DECL)
110 && ! TREE_STATIC (var))
111 || TREE_CODE (var) == LABEL_DECL
112 || TREE_CODE (var) == RESULT_DECL));
113 }
114
115 /* lang_hooks.tree_inlining.copy_res_decl_for_inlining should return a
116 declaration for the result RES of function FN to be inlined into
117 CALLER. NDP points to an integer that should be set in case a new
118 declaration wasn't created (presumably because RES was of aggregate
119 type, such that a TARGET_EXPR is used for the result). TEXPS is a
120 pointer to a varray with the stack of TARGET_EXPRs seen while
121 inlining functions into caller; the top of TEXPS is supposed to
122 match RES. */
123
124 tree
125 tree_inlining_default_hook_copy_res_decl_for_inlining (res, fn, caller,
126 dm, ndp, texps)
127 tree res, fn, caller;
128 void *dm ATTRIBUTE_UNUSED;
129 int *ndp ATTRIBUTE_UNUSED;
130 void *texps ATTRIBUTE_UNUSED;
131 {
132 return copy_decl_for_inlining (res, fn, caller);
133 }
134
135 /* lang_hooks.tree_inlining.anon_aggr_type_p determines whether T is a
136 type node representing an anonymous aggregate (union, struct, etc),
137 i.e., one whose members are in the same scope as the union itself. */
138
139 int
140 tree_inlining_default_hook_anon_aggr_type_p (t)
141 tree t ATTRIBUTE_UNUSED;
142 {
143 return 0;
144 }
145