OSDN Git Service

2003-09-04 Eric Christopher <echristo@redhat.com>
[pf3gnuchains/gcc-fork.git] / gcc / targhooks.c
1 /* Default target hook functions.
2    Copyright (C) 2003 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 2, 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 COPYING.  If not, write to the Free
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA.  */
20
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "tm.h"
25 #include "machmode.h"
26 #include "rtl.h"
27 #include "tree.h"
28 #include "expr.h"
29 #include "toplev.h"
30 #include "function.h"
31 #include "target.h"
32 #include "tm_p.h"
33 #include "target-def.h"
34
35 bool
36 default_promote_function_args (fntype)
37      tree fntype ATTRIBUTE_UNUSED;
38 {
39 #ifdef PROMOTE_FUNCTION_ARGS
40   return true;
41 #else
42   return false;
43 #endif
44 }
45
46 bool
47 default_promote_function_return (fntype)
48      tree fntype ATTRIBUTE_UNUSED;
49 {
50 #ifdef PROMOTE_FUNCTION_RETURN
51   return true;
52 #else
53   return false;
54 #endif
55 }
56
57 bool
58 default_promote_prototypes (fntype)
59      tree fntype ATTRIBUTE_UNUSED;
60 {
61   if (PROMOTE_PROTOTYPES)
62     return true;
63   else
64     return false;
65 }
66
67 rtx
68 default_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED, int incoming)
69 {
70   rtx rv = 0;
71   if (incoming)
72     {
73 #ifdef STRUCT_VALUE_INCOMING
74       rv = STRUCT_VALUE_INCOMING;
75 #else
76 #ifdef STRUCT_VALUE_INCOMING_REGNUM
77       rv = gen_rtx_REG (Pmode, STRUCT_VALUE_INCOMING_REGNUM);
78 #else
79 #ifdef STRUCT_VALUE
80       rv = STRUCT_VALUE;
81 #else
82 #ifndef STRUCT_VALUE_REGNUM
83       abort();
84 #else
85       rv = gen_rtx_REG (Pmode, STRUCT_VALUE_REGNUM);
86 #endif
87 #endif
88 #endif
89 #endif
90     }
91   else
92     {
93 #ifdef STRUCT_VALUE
94       rv = STRUCT_VALUE;
95 #else
96 #ifndef STRUCT_VALUE_REGNUM
97       abort();
98 #else
99       rv = gen_rtx_REG (Pmode, STRUCT_VALUE_REGNUM);
100 #endif
101 #endif
102     }
103   return rv;
104 }
105
106 bool
107 default_return_in_memory (tree type,
108                           tree fntype ATTRIBUTE_UNUSED)
109 {
110   return (TYPE_MODE (type) == BLKmode);
111 }
112
113 rtx
114 default_expand_builtin_saveregs (void)
115 {
116 #ifdef EXPAND_BUILTIN_SAVEREGS
117   return EXPAND_BUILTIN_SAVEREGS ();
118 #else
119   error ("__builtin_saveregs not supported by this target");
120   return const0_rtx;
121 #endif
122 }
123
124 void
125 default_setup_incoming_varargs (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
126                                 enum machine_mode mode ATTRIBUTE_UNUSED,
127                                 tree type ATTRIBUTE_UNUSED,
128                                 int *pretend_arg_size ATTRIBUTE_UNUSED,
129                                 int second_time ATTRIBUTE_UNUSED)
130 {
131 #ifdef SETUP_INCOMING_VARARGS
132   SETUP_INCOMING_VARARGS ((*ca), mode, type, (*pretend_arg_size), second_time);
133 #endif
134 }
135
136 bool
137 default_strict_argument_naming (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED)
138 {
139 #ifdef STRICT_ARGUMENT_NAMING
140   return STRICT_ARGUMENT_NAMING;
141 #else
142   return 0;
143 #endif
144 }
145
146 bool
147 default_pretend_outgoing_varargs_named(CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED)
148 {
149 #ifdef PRETEND_OUTGOING_VARARGS_NAMED
150   return PRETEND_OUTGOING_VARARGS_NAMED;
151 #else
152 #ifdef SETUP_INCOMING_VARARGS
153   return 1;
154 #else
155   return (targetm.calls.setup_incoming_varargs != default_setup_incoming_varargs);
156 #endif
157 #endif
158 }