OSDN Git Service

* langhooks.c: Include langhooks.h.
[pf3gnuchains/gcc-fork.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 #include "langhooks.h"
31
32
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.  */
43
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;
51 {
52   return NULL_TREE;
53 }
54
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.  */
58
59 int
60 tree_inlining_default_hook_cannot_inline_tree_fn (fnp)
61      tree *fnp ATTRIBUTE_UNUSED;
62 {
63   return 0;
64 }
65
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.  */
69
70 int
71 tree_inlining_default_hook_disregard_inline_limits (fn)
72      tree fn ATTRIBUTE_UNUSED;
73 {
74   return 0;
75 }
76
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.  */
83
84 tree
85 tree_inlining_default_hook_add_pending_fn_decls (vafnp, pfn)
86      void *vafnp ATTRIBUTE_UNUSED;
87      tree pfn;
88 {
89   return pfn;
90 }
91
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.  */
95
96 int
97 tree_inlining_default_hook_tree_chain_matters_p (t)
98      tree t ATTRIBUTE_UNUSED;
99 {
100   return 0;
101 }
102
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.  */
105
106 int
107 tree_inlining_default_hook_auto_var_in_fn_p (var, fn)
108      tree var, fn;
109 {
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));
115 }
116
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.  */
125
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;
133 {
134   return copy_decl_for_inlining (res, fn, caller);
135 }
136
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.  */
140
141 int
142 tree_inlining_default_hook_anon_aggr_type_p (t)
143      tree t ATTRIBUTE_UNUSED;
144 {
145   return 0;
146 }
147