2003-09-04 Eric Christopher <echristo@redhat.com>
[official-gcc.git] / gcc / targhooks.c
blob7654e230b839bc054672abfdb47f58a2af60f5c6
1 /* Default target hook functions.
2 Copyright (C) 2003 Free Software Foundation, Inc.
4 This file is part of GCC.
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.
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.
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. */
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"
35 bool
36 default_promote_function_args (fntype)
37 tree fntype ATTRIBUTE_UNUSED;
39 #ifdef PROMOTE_FUNCTION_ARGS
40 return true;
41 #else
42 return false;
43 #endif
46 bool
47 default_promote_function_return (fntype)
48 tree fntype ATTRIBUTE_UNUSED;
50 #ifdef PROMOTE_FUNCTION_RETURN
51 return true;
52 #else
53 return false;
54 #endif
57 bool
58 default_promote_prototypes (fntype)
59 tree fntype ATTRIBUTE_UNUSED;
61 if (PROMOTE_PROTOTYPES)
62 return true;
63 else
64 return false;
67 rtx
68 default_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED, int incoming)
70 rtx rv = 0;
71 if (incoming)
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
91 else
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
103 return rv;
106 bool
107 default_return_in_memory (tree type,
108 tree fntype ATTRIBUTE_UNUSED)
110 #ifndef RETURN_IN_MEMORY
111 return (TYPE_MODE (type) == BLKmode);
112 #else
113 return RETURN_IN_MEMORY (type);
114 #endif
118 default_expand_builtin_saveregs (void)
120 #ifdef EXPAND_BUILTIN_SAVEREGS
121 return EXPAND_BUILTIN_SAVEREGS ();
122 #else
123 error ("__builtin_saveregs not supported by this target");
124 return const0_rtx;
125 #endif
128 void
129 default_setup_incoming_varargs (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
130 enum machine_mode mode ATTRIBUTE_UNUSED,
131 tree type ATTRIBUTE_UNUSED,
132 int *pretend_arg_size ATTRIBUTE_UNUSED,
133 int second_time ATTRIBUTE_UNUSED)
135 #ifdef SETUP_INCOMING_VARARGS
136 SETUP_INCOMING_VARARGS ((*ca), mode, type, (*pretend_arg_size), second_time);
137 #endif
140 bool
141 default_strict_argument_naming (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED)
143 #ifdef STRICT_ARGUMENT_NAMING
144 return STRICT_ARGUMENT_NAMING;
145 #else
146 return 0;
147 #endif
150 bool
151 default_pretend_outgoing_varargs_named(CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED)
153 #ifdef PRETEND_OUTGOING_VARARGS_NAMED
154 return PRETEND_OUTGOING_VARARGS_NAMED;
155 #else
156 #ifdef SETUP_INCOMING_VARARGS
157 return 1;
158 #else
159 return (targetm.calls.setup_incoming_varargs != default_setup_incoming_varargs);
160 #endif
161 #endif