new tests
[official-gcc.git] / gcc / target.h
blobeae0b76a8995c52912ee622fc6770a1a619598a1
1 /* Data structure definitions for a generic GCC target.
2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
3 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 3, or (at your option) any
8 later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING3. If not see
17 <http://www.gnu.org/licenses/>.
19 In other words, you are welcome to use, share and improve this program.
20 You are forbidden to forbid anyone else to use, share and improve
21 what you give them. Help stamp out software-hoarding! */
24 /* This file contains a data structure that describes a GCC target.
25 At present it is incomplete, but in future it should grow to
26 contain most or all target machine and target O/S specific
27 information.
29 This structure has its initializer declared in target-def.h in the
30 form of large macro TARGET_INITIALIZER that expands to many smaller
31 macros.
33 The smaller macros each initialize one component of the structure,
34 and each has a default. Each target should have a file that
35 includes target.h and target-def.h, and overrides any inappropriate
36 defaults by undefining the relevant macro and defining a suitable
37 replacement. That file should then contain the definition of
38 "targetm" like so:
40 struct gcc_target targetm = TARGET_INITIALIZER;
42 Doing things this way allows us to bring together everything that
43 defines a GCC target. By supplying a default that is appropriate
44 to most targets, we can easily add new items without needing to
45 edit dozens of target configuration files. It should also allow us
46 to gradually reduce the amount of conditional compilation that is
47 scattered throughout GCC. */
49 #ifndef GCC_TARGET_H
50 #define GCC_TARGET_H
52 #include "tm.h"
53 #include "insn-modes.h"
55 /* Types used by the record_gcc_switches() target function. */
56 typedef enum
58 SWITCH_TYPE_PASSED, /* A switch passed on the command line. */
59 SWITCH_TYPE_ENABLED, /* An option that is currently enabled. */
60 SWITCH_TYPE_DESCRIPTIVE, /* Descriptive text, not a switch or option. */
61 SWITCH_TYPE_LINE_START, /* Please emit any necessary text at the start of a line. */
62 SWITCH_TYPE_LINE_END /* Please emit a line terminator. */
64 print_switch_type;
66 typedef int (* print_switch_fn_type) (print_switch_type, const char *);
68 /* An example implementation for ELF targets. Defined in varasm.c */
69 extern int elf_record_gcc_switches (print_switch_type type, const char *);
71 /* Some places still assume that all pointer or address modes are the
72 standard Pmode and ptr_mode. These optimizations become invalid if
73 the target actually supports multiple different modes. For now,
74 we disable such optimizations on such targets, using this function. */
75 extern bool target_default_pointer_address_modes_p (void);
77 struct stdarg_info;
78 struct spec_info_def;
80 /* The struct used by the secondary_reload target hook. */
81 typedef struct secondary_reload_info
83 /* icode is actually an enum insn_code, but we don't want to force every
84 file that includes target.h to include optabs.h . */
85 int icode;
86 int extra_cost; /* Cost for using (a) scratch register(s) to be taken
87 into account by copy_cost. */
88 /* The next two members are for the use of the backward
89 compatibility hook. */
90 struct secondary_reload_info *prev_sri;
91 int t_icode; /* Actually an enum insn_code - see above. */
92 } secondary_reload_info;
94 /* This is defined in sched-int.h . */
95 struct _dep;
97 /* This is defined in ddg.h . */
98 struct ddg;
100 /* This is defined in cfgloop.h . */
101 struct loop;
103 /* This is defined in tree-ssa-alias.h. */
104 struct ao_ref_s;
106 /* Assembler instructions for creating various kinds of integer object. */
108 struct asm_int_op
110 const char *hi;
111 const char *si;
112 const char *di;
113 const char *ti;
116 /* Types of costs for vectorizer cost model. */
117 enum vect_cost_for_stmt
119 scalar_stmt,
120 scalar_load,
121 scalar_store,
122 vector_stmt,
123 vector_load,
124 unaligned_load,
125 unaligned_store,
126 vector_store,
127 vec_to_scalar,
128 scalar_to_vec,
129 cond_branch_not_taken,
130 cond_branch_taken,
131 vec_perm
134 /* Sets of optimization levels at which an option may be enabled by
135 default_options_optimization. */
136 enum opt_levels
138 OPT_LEVELS_NONE, /* No levels (mark end of array). */
139 OPT_LEVELS_ALL, /* All levels (used by targets to disable options
140 enabled in target-independent code). */
141 OPT_LEVELS_0_ONLY, /* -O0 only. */
142 OPT_LEVELS_1_PLUS, /* -O1 and above, including -Os. */
143 OPT_LEVELS_1_PLUS_SPEED_ONLY, /* -O1 and above, but not -Os. */
144 OPT_LEVELS_2_PLUS, /* -O2 and above, including -Os. */
145 OPT_LEVELS_2_PLUS_SPEED_ONLY, /* -O2 and above, but not -Os. */
146 OPT_LEVELS_3_PLUS, /* -O3 and above. */
147 OPT_LEVELS_3_PLUS_AND_SIZE, /* -O3 and above and -Os. */
148 OPT_LEVELS_SIZE, /* -Os only. */
149 OPT_LEVELS_FAST /* -Ofast only. */
152 /* Description of options to enable by default at given levels. */
153 struct default_options
155 /* The levels at which to enable the option. */
156 enum opt_levels levels;
158 /* The option index and argument or enabled/disabled sense of the
159 option, as passed to handle_generated_option. If ARG is NULL and
160 the option allows a negative form, the option is considered to be
161 passed in negative form when the optimization level is not one of
162 those in LEVELS (in order to handle changes to the optimization
163 level with the "optimize" attribute). */
164 size_t opt_index;
165 const char *arg;
166 int value;
169 /* The target structure. This holds all the backend hooks. */
170 #define DEFHOOKPOD(NAME, DOC, TYPE, INIT) TYPE NAME;
171 #define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) TYPE (* NAME) PARAMS;
172 #define DEFHOOK_UNDOC DEFHOOK
173 #define HOOKSTRUCT(FRAGMENT) FRAGMENT
175 #include "target.def"
177 extern struct gcc_target targetm;
179 #endif /* GCC_TARGET_H */