2010-07-27 Paolo Carlini <paolo.carlini@oracle.com>
[official-gcc/alias-decl.git] / gcc / target.h
blob99dd1eea99871eed4ae5194828a05f2f91f42bb1
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 /* Assembler instructions for creating various kinds of integer object. */
105 struct asm_int_op
107 const char *hi;
108 const char *si;
109 const char *di;
110 const char *ti;
113 /* Types of costs for vectorizer cost model. */
114 enum vect_cost_for_stmt
116 scalar_stmt,
117 scalar_load,
118 scalar_store,
119 vector_stmt,
120 vector_load,
121 unaligned_load,
122 unaligned_store,
123 vector_store,
124 vec_to_scalar,
125 scalar_to_vec,
126 cond_branch_not_taken,
127 cond_branch_taken,
128 vec_perm
131 /* The target structure. This holds all the backend hooks. */
132 #define DEFHOOKPOD(NAME, DOC, TYPE, INIT) TYPE NAME;
133 #define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) TYPE (* NAME) PARAMS;
134 #define DEFHOOK_UNDOC DEFHOOK
135 #define HOOKSTRUCT(FRAGMENT) FRAGMENT
137 #include "target.def"
139 extern struct gcc_target targetm;
141 /* Each target can provide their own. */
142 extern struct gcc_targetcm targetcm;
144 #endif /* GCC_TARGET_H */