OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [target.h] - Blame information for rev 304

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* Data structure definitions for a generic GCC target.
2
   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
3
   Free Software Foundation, Inc.
4
 
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.
9
 
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.
14
 
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/>.
18
 
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!  */
22
 
23
 
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.
28
 
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.
32
 
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:
39
 
40
   struct gcc_target targetm = TARGET_INITIALIZER;
41
 
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.  */
48
 
49
#ifndef GCC_TARGET_H
50
#define GCC_TARGET_H
51
 
52
#include "tm.h"
53
#include "insn-modes.h"
54
 
55
struct stdarg_info;
56
struct spec_info_def;
57
 
58
/* The struct used by the secondary_reload target hook.  */
59
typedef struct secondary_reload_info
60
{
61
  /* icode is actually an enum insn_code, but we don't want to force every
62
     file that includes target.h to include optabs.h .  */
63
  int icode;
64
  int extra_cost; /* Cost for using (a) scratch register(s) to be taken
65
                     into account by copy_cost.  */
66
  /* The next two members are for the use of the backward
67
     compatibility hook.  */
68
  struct secondary_reload_info *prev_sri;
69
  int t_icode; /* Actually an enum insn_code - see above.  */
70
} secondary_reload_info;
71
 
72
 
73
struct gcc_target
74
{
75
  /* Functions that output assembler for the target.  */
76
  struct asm_out
77
  {
78
    /* Opening and closing parentheses for asm expression grouping.  */
79
    const char *open_paren, *close_paren;
80
 
81
    /* Assembler instructions for creating various kinds of integer object.  */
82
    const char *byte_op;
83
    struct asm_int_op
84
    {
85
      const char *hi;
86
      const char *si;
87
      const char *di;
88
      const char *ti;
89
    } aligned_op, unaligned_op;
90
 
91
    /* Try to output the assembler code for an integer object whose
92
       value is given by X.  SIZE is the size of the object in bytes and
93
       ALIGNED_P indicates whether it is aligned.  Return true if
94
       successful.  Only handles cases for which BYTE_OP, ALIGNED_OP
95
       and UNALIGNED_OP are NULL.  */
96
    bool (* integer) (rtx x, unsigned int size, int aligned_p);
97
 
98
    /* Output code that will globalize a label.  */
99
    void (* globalize_label) (FILE *, const char *);
100
 
101
    /* Output code that will emit a label for unwind info, if this
102
       target requires such labels.  Second argument is the decl the
103
       unwind info is associated with, third is a boolean: true if
104
       this is for exception handling, fourth is a boolean: true if
105
       this is only a placeholder for an omitted FDE.  */
106
    void (* unwind_label) (FILE *, tree, int, int);
107
 
108
    /* Output code that will emit a label to divide up the exception
109
       table.  */
110
    void (* except_table_label) (FILE *);
111
 
112
    /* Emit any directives required to unwind this instruction.  */
113
    void (* unwind_emit) (FILE *, rtx);
114
 
115
    /* Output an internal label.  */
116
    void (* internal_label) (FILE *, const char *, unsigned long);
117
 
118
    /* Emit a ttype table reference to a typeinfo object.  */
119
    bool (* ttype) (rtx);
120
 
121
    /* Emit an assembler directive to set visibility for the symbol
122
       associated with the tree decl.  */
123
    void (* visibility) (tree, int);
124
 
125
    /* Output the assembler code for entry to a function.  */
126
    void (* function_prologue) (FILE *, HOST_WIDE_INT);
127
 
128
    /* Output the assembler code for end of prologue.  */
129
    void (* function_end_prologue) (FILE *);
130
 
131
    /* Output the assembler code for start of epilogue.  */
132
    void (* function_begin_epilogue) (FILE *);
133
 
134
    /* Output the assembler code for function exit.  */
135
    void (* function_epilogue) (FILE *, HOST_WIDE_INT);
136
 
137
    /* Initialize target-specific sections.  */
138
    void (* init_sections) (void);
139
 
140
    /* Tell assembler to change to section NAME with attributes FLAGS.
141
       If DECL is non-NULL, it is the VAR_DECL or FUNCTION_DECL with
142
       which this section is associated.  */
143
    void (* named_section) (const char *name, unsigned int flags, tree decl);
144
 
145
    /* Return a mask describing how relocations should be treated when
146
       selecting sections.  Bit 1 should be set if global relocations
147
       should be placed in a read-write section; bit 0 should be set if
148
       local relocations should be placed in a read-write section.  */
149
    int (*reloc_rw_mask) (void);
150
 
151
    /* Return a section for EXP.  It may be a DECL or a constant.  RELOC
152
       is nonzero if runtime relocations must be applied; bit 1 will be
153
       set if the runtime relocations require non-local name resolution.
154
       ALIGN is the required alignment of the data.  */
155
    section *(* select_section) (tree, int, unsigned HOST_WIDE_INT);
156
 
157
    /* Return a section for X.  MODE is X's mode and ALIGN is its
158
       alignment in bits.  */
159
    section *(* select_rtx_section) (enum machine_mode, rtx,
160
                                     unsigned HOST_WIDE_INT);
161
 
162
    /* Select a unique section name for DECL.  RELOC is the same as
163
       for SELECT_SECTION.  */
164
    void (* unique_section) (tree, int);
165
 
166
    /* Return the readonly data section associated with function DECL.  */
167
    section *(* function_rodata_section) (tree);
168
 
169
    /* Output a constructor for a symbol with a given priority.  */
170
    void (* constructor) (rtx, int);
171
 
172
    /* Output a destructor for a symbol with a given priority.  */
173
    void (* destructor) (rtx, int);
174
 
175
    /* Output the assembler code for a thunk function.  THUNK_DECL is the
176
       declaration for the thunk function itself, FUNCTION is the decl for
177
       the target function.  DELTA is an immediate constant offset to be
178
       added to THIS.  If VCALL_OFFSET is nonzero, the word at
179
       *(*this + vcall_offset) should be added to THIS.  */
180
    void (* output_mi_thunk) (FILE *file, tree thunk_decl,
181
                              HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset,
182
                              tree function_decl);
183
 
184
    /* Determine whether output_mi_thunk would succeed.  */
185
    /* ??? Ideally, this hook would not exist, and success or failure
186
       would be returned from output_mi_thunk directly.  But there's
187
       too much undo-able setup involved in invoking output_mi_thunk.
188
       Could be fixed by making output_mi_thunk emit rtl instead of
189
       text to the output file.  */
190
    bool (* can_output_mi_thunk) (tree thunk_decl, HOST_WIDE_INT delta,
191
                                  HOST_WIDE_INT vcall_offset,
192
                                  tree function_decl);
193
 
194
    /* Output any boilerplate text needed at the beginning of a
195
       translation unit.  */
196
    void (*file_start) (void);
197
 
198
    /* Output any boilerplate text needed at the end of a
199
       translation unit.  */
200
    void (*file_end) (void);
201
 
202
    /* Output an assembler pseudo-op to declare a library function name
203
       external.  */
204
    void (*external_libcall) (rtx);
205
 
206
     /* Output an assembler directive to mark decl live. This instructs
207
        linker to not dead code strip this symbol.  */
208
    void (*mark_decl_preserved) (const char *);
209
 
210
    /* Output the definition of a section anchor.  */
211
    void (*output_anchor) (rtx);
212
 
213
    /* Output a DTP-relative reference to a TLS symbol.  */
214
    void (*output_dwarf_dtprel) (FILE *file, int size, rtx x);
215
 
216
  } asm_out;
217
 
218
  /* Functions relating to instruction scheduling.  */
219
  struct sched
220
  {
221
    /* Given the current cost, COST, of an insn, INSN, calculate and
222
       return a new cost based on its relationship to DEP_INSN through
223
       the dependence LINK.  The default is to make no adjustment.  */
224
    int (* adjust_cost) (rtx insn, rtx link, rtx def_insn, int cost);
225
 
226
    /* Adjust the priority of an insn as you see fit.  Returns the new
227
       priority.  */
228
    int (* adjust_priority) (rtx, int);
229
 
230
    /* Function which returns the maximum number of insns that can be
231
       scheduled in the same machine cycle.  This must be constant
232
       over an entire compilation.  The default is 1.  */
233
    int (* issue_rate) (void);
234
 
235
    /* Calculate how much this insn affects how many more insns we
236
       can emit this cycle.  Default is they all cost the same.  */
237
    int (* variable_issue) (FILE *, int, rtx, int);
238
 
239
    /* Initialize machine-dependent scheduling code.  */
240
    void (* md_init) (FILE *, int, int);
241
 
242
    /* Finalize machine-dependent scheduling code.  */
243
    void (* md_finish) (FILE *, int);
244
 
245
    /* Initialize machine-dependent function while scheduling code.  */
246
    void (* md_init_global) (FILE *, int, int);
247
 
248
    /* Finalize machine-dependent function wide scheduling code.  */
249
    void (* md_finish_global) (FILE *, int);
250
 
251
    /* Reorder insns in a machine-dependent fashion, in two different
252
       places.  Default does nothing.  */
253
    int (* reorder) (FILE *, int, rtx *, int *, int);
254
    int (* reorder2) (FILE *, int, rtx *, int *, int);
255
 
256
    /* The following member value is a pointer to a function called
257
       after evaluation forward dependencies of insns in chain given
258
       by two parameter values (head and tail correspondingly).  */
259
    void (* dependencies_evaluation_hook) (rtx, rtx);
260
 
261
    /* The values of the following four members are pointers to
262
       functions used to simplify the automaton descriptions.
263
       dfa_pre_cycle_insn and dfa_post_cycle_insn give functions
264
       returning insns which are used to change the pipeline hazard
265
       recognizer state when the new simulated processor cycle
266
       correspondingly starts and finishes.  The function defined by
267
       init_dfa_pre_cycle_insn and init_dfa_post_cycle_insn are used
268
       to initialize the corresponding insns.  The default values of
269
       the members result in not changing the automaton state when
270
       the new simulated processor cycle correspondingly starts and
271
       finishes.  */
272
    void (* init_dfa_pre_cycle_insn) (void);
273
    rtx (* dfa_pre_cycle_insn) (void);
274
    void (* init_dfa_post_cycle_insn) (void);
275
    rtx (* dfa_post_cycle_insn) (void);
276
 
277
    /* The following member value is a pointer to a function returning value
278
       which defines how many insns in queue `ready' will we try for
279
       multi-pass scheduling.  If the member value is nonzero and the
280
       function returns positive value, the DFA based scheduler will make
281
       multi-pass scheduling for the first cycle.  In other words, we will
282
       try to choose ready insn which permits to start maximum number of
283
       insns on the same cycle.  */
284
    int (* first_cycle_multipass_dfa_lookahead) (void);
285
 
286
    /* The following member value is pointer to a function controlling
287
       what insns from the ready insn queue will be considered for the
288
       multipass insn scheduling.  If the hook returns zero for insn
289
       passed as the parameter, the insn will be not chosen to be
290
       issued.  */
291
    int (* first_cycle_multipass_dfa_lookahead_guard) (rtx);
292
 
293
    /* The following member value is pointer to a function called by
294
       the insn scheduler before issuing insn passed as the third
295
       parameter on given cycle.  If the hook returns nonzero, the
296
       insn is not issued on given processors cycle.  Instead of that,
297
       the processor cycle is advanced.  If the value passed through
298
       the last parameter is zero, the insn ready queue is not sorted
299
       on the new cycle start as usually.  The first parameter passes
300
       file for debugging output.  The second one passes the scheduler
301
       verbose level of the debugging output.  The forth and the fifth
302
       parameter values are correspondingly processor cycle on which
303
       the previous insn has been issued and the current processor
304
       cycle.  */
305
    int (* dfa_new_cycle) (FILE *, int, rtx, int, int, int *);
306
 
307
    /* The following member value is a pointer to a function called
308
       by the insn scheduler.  It should return true if there exists a
309
       dependence which is considered costly by the target, between
310
       the insn passed as the first parameter, and the insn passed as
311
       the second parameter.  The third parameter is the INSN_DEPEND
312
       link that represents the dependence between the two insns.  The
313
       fourth argument is the cost of the dependence as estimated by
314
       the scheduler.  The last argument is the distance in cycles
315
       between the already scheduled insn (first parameter) and the
316
       the second insn (second parameter).  */
317
    bool (* is_costly_dependence) (rtx, rtx, rtx, int, int);
318
 
319
    /* Given the current cost, COST, of an insn, INSN, calculate and
320
       return a new cost based on its relationship to DEP_INSN through the
321
       dependence of type DEP_TYPE.  The default is to make no adjustment.  */
322
    int (* adjust_cost_2) (rtx insn, int, rtx def_insn, int cost);
323
 
324
    /* The following member value is a pointer to a function called
325
       by the insn scheduler. This hook is called to notify the backend
326
       that new instructions were emitted.  */
327
    void (* h_i_d_extended) (void);
328
 
329
    /* The following member value is a pointer to a function called
330
       by the insn scheduler.
331
       The first parameter is an instruction, the second parameter is the type
332
       of the requested speculation, and the third parameter is a pointer to the
333
       speculative pattern of the corresponding type (set if return value == 1).
334
       It should return
335
       -1, if there is no pattern, that will satisfy the requested speculation
336
       type,
337
       0, if current pattern satisfies the requested speculation type,
338
       1, if pattern of the instruction should be changed to the newly
339
       generated one.  */
340
    int (* speculate_insn) (rtx, int, rtx *);
341
 
342
    /* The following member value is a pointer to a function called
343
       by the insn scheduler.  It should return true if the check instruction
344
       corresponding to the instruction passed as the parameter needs a
345
       recovery block.  */
346
    bool (* needs_block_p) (rtx);
347
 
348
    /* The following member value is a pointer to a function called
349
       by the insn scheduler.  It should return a pattern for the check
350
       instruction.
351
       The first parameter is a speculative instruction, the second parameter
352
       is the label of the corresponding recovery block (or null, if it is a
353
       simple check).  If the mutation of the check is requested (e.g. from
354
       ld.c to chk.a), the third parameter is true - in this case the first
355
       parameter is the previous check.  */
356
    rtx (* gen_check) (rtx, rtx, bool);
357
 
358
    /* The following member value is a pointer to a function controlling
359
       what insns from the ready insn queue will be considered for the
360
       multipass insn scheduling.  If the hook returns zero for the insn
361
       passed as the parameter, the insn will not be chosen to be
362
       issued.  This hook is used to discard speculative instructions,
363
       that stand at the first position of the ready list.  */
364
    bool (* first_cycle_multipass_dfa_lookahead_guard_spec) (rtx);
365
 
366
    /* The following member value is a pointer to a function that provides
367
       information about the speculation capabilities of the target.
368
       The parameter is a pointer to spec_info variable.  */
369
    void (* set_sched_flags) (struct spec_info_def *);
370
  } sched;
371
 
372
  /* Functions relating to vectorization.  */
373
  struct vectorize
374
  {
375
    /* The following member value is a pointer to a function called
376
       by the vectorizer, and return the decl of the target builtin
377
       function.  */
378
    tree (* builtin_mask_for_load) (void);
379
 
380
    /* Return true if vector alignment is reachable (by peeling N
381
      interations) for the given type.  */
382
     bool (* vector_alignment_reachable) (tree, bool);
383
  } vectorize;
384
 
385
  /* The initial value of target_flags.  */
386
  int default_target_flags;
387
 
388
  /* Handle target switch CODE (an OPT_* value).  ARG is the argument
389
     passed to the switch; it is NULL if no argument was.  VALUE is the
390
     value of ARG if CODE specifies a UInteger option, otherwise it is
391
     1 if the positive form of the switch was used and 0 if the negative
392
     form was.  Return true if the switch was valid.  */
393
  bool (* handle_option) (size_t code, const char *arg, int value);
394
 
395
  /* Return machine mode for filter value.  */
396
  enum machine_mode (* eh_return_filter_mode) (void);
397
 
398
  /* Given two decls, merge their attributes and return the result.  */
399
  tree (* merge_decl_attributes) (tree, tree);
400
 
401
  /* Given two types, merge their attributes and return the result.  */
402
  tree (* merge_type_attributes) (tree, tree);
403
 
404
  /* Table of machine attributes and functions to handle them.
405
     Ignored if NULL.  */
406
  const struct attribute_spec *attribute_table;
407
 
408
  /* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
409
     one if they are compatible and two if they are nearly compatible
410
     (which causes a warning to be generated).  */
411
  int (* comp_type_attributes) (tree type1, tree type2);
412
 
413
  /* Assign default attributes to the newly defined TYPE.  */
414
  void (* set_default_type_attributes) (tree type);
415
 
416
  /* Insert attributes on the newly created DECL.  */
417
  void (* insert_attributes) (tree decl, tree *attributes);
418
 
419
  /* Return true if FNDECL (which has at least one machine attribute)
420
     can be inlined despite its machine attributes, false otherwise.  */
421
  bool (* function_attribute_inlinable_p) (tree fndecl);
422
 
423
  /* Return true if bitfields in RECORD_TYPE should follow the
424
     Microsoft Visual C++ bitfield layout rules.  */
425
  bool (* ms_bitfield_layout_p) (tree record_type);
426
 
427
  /* True if the target supports decimal floating point.  */
428
  bool (* decimal_float_supported_p) (void);
429
 
430
  /* Return true if anonymous bitfields affect structure alignment.  */
431
  bool (* align_anon_bitfield) (void);
432
 
433
  /* Return true if volatile bitfields should use the narrowest type possible.
434
     Return false if they should use the container type.  */
435
  bool (* narrow_volatile_bitfield) (void);
436
 
437
  /* Set up target-specific built-in functions.  */
438
  void (* init_builtins) (void);
439
 
440
  /* Expand a target-specific builtin.  */
441
  rtx (* expand_builtin) (tree exp, rtx target, rtx subtarget,
442
                          enum machine_mode mode, int ignore);
443
 
444
  /* Select a replacement for a target-specific builtin.  This is done
445
     *before* regular type checking, and so allows the target to implement
446
     a crude form of function overloading.  The result is a complete
447
     expression that implements the operation.  */
448
  tree (*resolve_overloaded_builtin) (tree decl, tree params);
449
 
450
  /* Fold a target-specific builtin.  */
451
  tree (* fold_builtin) (tree fndecl, tree arglist, bool ignore);
452
 
453
  /* For a vendor-specific fundamental TYPE, return a pointer to
454
     a statically-allocated string containing the C++ mangling for
455
     TYPE.  In all other cases, return NULL.  */
456
  const char * (* mangle_fundamental_type) (tree type);
457
 
458
  /* Make any adjustments to libfunc names needed for this target.  */
459
  void (* init_libfuncs) (void);
460
 
461
  /* Given a decl, a section name, and whether the decl initializer
462
     has relocs, choose attributes for the section.  */
463
  /* ??? Should be merged with SELECT_SECTION and UNIQUE_SECTION.  */
464
  unsigned int (* section_type_flags) (tree, const char *, int);
465
 
466
  /* True if new jumps cannot be created, to replace existing ones or
467
     not, at the current point in the compilation.  */
468
  bool (* cannot_modify_jumps_p) (void);
469
 
470
  /* Return a register class for which branch target register
471
     optimizations should be applied.  */
472
  int (* branch_target_register_class) (void);
473
 
474
  /* Return true if branch target register optimizations should include
475
     callee-saved registers that are not already live during the current
476
     function.  AFTER_PE_GEN is true if prologues and epilogues have
477
     already been generated.  */
478
  bool (* branch_target_register_callee_saved) (bool after_pe_gen);
479
 
480
  /* True if the constant X cannot be placed in the constant pool.  */
481
  bool (* cannot_force_const_mem) (rtx);
482
 
483
  /* True if the insn X cannot be duplicated.  */
484
  bool (* cannot_copy_insn_p) (rtx);
485
 
486
  /* True if X is considered to be commutative.  */
487
  bool (* commutative_p) (rtx, int);
488
 
489
  /* Given an address RTX, undo the effects of LEGITIMIZE_ADDRESS.  */
490
  rtx (* delegitimize_address) (rtx);
491
 
492
  /* True if the given constant can be put into an object_block.  */
493
  bool (* use_blocks_for_constant_p) (enum machine_mode, rtx);
494
 
495
  /* The minimum and maximum byte offsets for anchored addresses.  */
496
  HOST_WIDE_INT min_anchor_offset;
497
  HOST_WIDE_INT max_anchor_offset;
498
 
499
  /* True if section anchors can be used to access the given symbol.  */
500
  bool (* use_anchors_for_symbol_p) (rtx);
501
 
502
  /* True if it is OK to do sibling call optimization for the specified
503
     call expression EXP.  DECL will be the called function, or NULL if
504
     this is an indirect call.  */
505
  bool (*function_ok_for_sibcall) (tree decl, tree exp);
506
 
507
  /* True if EXP should be placed in a "small data" section.  */
508
  bool (* in_small_data_p) (tree);
509
 
510
  /* True if EXP names an object for which name resolution must resolve
511
     to the current module.  */
512
  bool (* binds_local_p) (tree);
513
 
514
  /* Do something target-specific to record properties of the DECL into
515
     the associated SYMBOL_REF.  */
516
  void (* encode_section_info) (tree, rtx, int);
517
 
518
  /* Undo the effects of encode_section_info on the symbol string.  */
519
  const char * (* strip_name_encoding) (const char *);
520
 
521
  /* If shift optabs for MODE are known to always truncate the shift count,
522
     return the mask that they apply.  Return 0 otherwise.  */
523
  unsigned HOST_WIDE_INT (* shift_truncation_mask) (enum machine_mode mode);
524
 
525
  /* Return the number of divisions in the given MODE that should be present,
526
     so that it is profitable to turn the division into a multiplication by
527
     the reciprocal.  */
528
  unsigned int (* min_divisions_for_recip_mul) (enum machine_mode mode);
529
 
530
  /* If the representation of integral MODE is such that values are
531
     always sign-extended to a wider mode MODE_REP then return
532
     SIGN_EXTEND.  Return UNKNOWN otherwise.  */
533
  /* Note that the return type ought to be RTX_CODE, but that's not
534
     necessarily defined at this point.  */
535
  int (* mode_rep_extended) (enum machine_mode mode,
536
                             enum machine_mode mode_rep);
537
 
538
  /* True if MODE is valid for a pointer in __attribute__((mode("MODE"))).  */
539
  bool (* valid_pointer_mode) (enum machine_mode mode);
540
 
541
  /* True if MODE is valid for the target.  By "valid", we mean able to
542
     be manipulated in non-trivial ways.  In particular, this means all
543
     the arithmetic is supported.  */
544
  bool (* scalar_mode_supported_p) (enum machine_mode mode);
545
 
546
  /* Similarly for vector modes.  "Supported" here is less strict.  At
547
     least some operations are supported; need to check optabs or builtins
548
     for further details.  */
549
  bool (* vector_mode_supported_p) (enum machine_mode mode);
550
 
551
  /* True if a vector is opaque.  */
552
  bool (* vector_opaque_p) (tree);
553
 
554
  /* Compute a (partial) cost for rtx X.  Return true if the complete
555
     cost has been computed, and false if subexpressions should be
556
     scanned.  In either case, *TOTAL contains the cost result.  */
557
  /* Note that CODE and OUTER_CODE ought to be RTX_CODE, but that's
558
     not necessarily defined at this point.  */
559
  bool (* rtx_costs) (rtx x, int code, int outer_code, int *total);
560
 
561
  /* Compute the cost of X, used as an address.  Never called with
562
     invalid addresses.  */
563
  int (* address_cost) (rtx x);
564
 
565
  /* Return where to allocate pseudo for a given hard register initial
566
     value.  */
567
  rtx (* allocate_initial_value) (rtx x);
568
 
569
  /* Given a register, this hook should return a parallel of registers
570
     to represent where to find the register pieces.  Define this hook
571
     if the register and its mode are represented in Dwarf in
572
     non-contiguous locations, or if the register should be
573
     represented in more than one register in Dwarf.  Otherwise, this
574
     hook should return NULL_RTX.  */
575
  rtx (* dwarf_register_span) (rtx);
576
 
577
  /* Fetch the fixed register(s) which hold condition codes, for
578
     targets where it makes sense to look for duplicate assignments to
579
     the condition codes.  This should return true if there is such a
580
     register, false otherwise.  The arguments should be set to the
581
     fixed register numbers.  Up to two condition code registers are
582
     supported.  If there is only one for this target, the int pointed
583
     at by the second argument should be set to -1.  */
584
  bool (* fixed_condition_code_regs) (unsigned int *, unsigned int *);
585
 
586
  /* If two condition code modes are compatible, return a condition
587
     code mode which is compatible with both, such that a comparison
588
     done in the returned mode will work for both of the original
589
     modes.  If the condition code modes are not compatible, return
590
     VOIDmode.  */
591
  enum machine_mode (* cc_modes_compatible) (enum machine_mode,
592
                                             enum machine_mode);
593
 
594
  /* Do machine-dependent code transformations.  Called just before
595
     delayed-branch scheduling.  */
596
  void (* machine_dependent_reorg) (void);
597
 
598
  /* Create the __builtin_va_list type.  */
599
  tree (* build_builtin_va_list) (void);
600
 
601
  /* Gimplifies a VA_ARG_EXPR.  */
602
  tree (* gimplify_va_arg_expr) (tree valist, tree type, tree *pre_p,
603
                                 tree *post_p);
604
 
605
  /* Validity-checking routines for PCH files, target-specific.
606
     get_pch_validity returns a pointer to the data to be stored,
607
     and stores the size in its argument.  pch_valid_p gets the same
608
     information back and returns NULL if the PCH is valid,
609
     or an error message if not.
610
  */
611
  void * (* get_pch_validity) (size_t *);
612
  const char * (* pch_valid_p) (const void *, size_t);
613
 
614
  /* If nonnull, this function checks whether a PCH file with the
615
     given set of target flags can be used.  It returns NULL if so,
616
     otherwise it returns an error message.  */
617
  const char *(*check_pch_target_flags) (int);
618
 
619
  /* True if the compiler should give an enum type only as many
620
     bytes as it takes to represent the range of possible values of
621
     that type.  */
622
  bool (* default_short_enums) (void);
623
 
624
  /* This target hook returns an rtx that is used to store the address
625
     of the current frame into the built-in setjmp buffer.  */
626
  rtx (* builtin_setjmp_frame_value) (void);
627
 
628
  /* This target hook should add STRING_CST trees for any hard regs
629
     the port wishes to automatically clobber for an asm.  */
630
  tree (* md_asm_clobbers) (tree, tree, tree);
631
 
632
  /* This target hook allows the backend to specify a calling convention
633
     in the debug information.  This function actually returns an
634
     enum dwarf_calling_convention, but because of forward declarations
635
     and not wanting to include dwarf2.h everywhere target.h is included
636
     the function is being declared as an int.  */
637
  int (* dwarf_calling_convention) (tree);
638
 
639
  /* This target hook allows the backend to emit frame-related insns that
640
     contain UNSPECs or UNSPEC_VOLATILEs.  The call frame debugging info
641
     engine will invoke it on insns of the form
642
       (set (reg) (unspec [...] UNSPEC_INDEX))
643
     and
644
       (set (reg) (unspec_volatile [...] UNSPECV_INDEX))
645
     to let the backend emit the call frame instructions.  */
646
  void (* dwarf_handle_frame_unspec) (const char *, rtx, int);
647
 
648
  /* Perform architecture specific checking of statements gimplified
649
     from VA_ARG_EXPR.  LHS is left hand side of MODIFY_EXPR, RHS
650
     is right hand side.  Returns true if the statements doesn't need
651
     to be checked for va_list references.  */
652
  bool (* stdarg_optimize_hook) (struct stdarg_info *ai, tree lhs, tree rhs);
653
 
654
  /* This target hook allows the operating system to override the DECL
655
     that represents the external variable that contains the stack
656
     protection guard variable.  The type of this DECL is ptr_type_node.  */
657
  tree (* stack_protect_guard) (void);
658
 
659
  /* This target hook allows the operating system to override the CALL_EXPR
660
     that is invoked when a check vs the guard variable fails.  */
661
  tree (* stack_protect_fail) (void);
662
 
663
  /* Returns NULL if target supports the insn within a doloop block,
664
     otherwise it returns an error message.  */
665
  const char * (*invalid_within_doloop) (rtx);
666
 
667
  /* DECL is a variable or function with __attribute__((dllimport))
668
     specified.  Use this hook if the target needs to add extra validation
669
     checks to  handle_dll_attribute ().  */
670
  bool (* valid_dllimport_attribute_p) (tree decl);
671
 
672
  /* Functions relating to calls - argument passing, returns, etc.  */
673
  struct calls {
674
    bool (*promote_function_args) (tree fntype);
675
    bool (*promote_function_return) (tree fntype);
676
    bool (*promote_prototypes) (tree fntype);
677
    rtx (*struct_value_rtx) (tree fndecl, int incoming);
678
    bool (*return_in_memory) (tree type, tree fndecl);
679
    bool (*return_in_msb) (tree type);
680
 
681
    /* Return true if a parameter must be passed by reference.  TYPE may
682
       be null if this is a libcall.  CA may be null if this query is
683
       from __builtin_va_arg.  */
684
    bool (*pass_by_reference) (CUMULATIVE_ARGS *ca, enum machine_mode mode,
685
                               tree type, bool named_arg);
686
 
687
    rtx (*expand_builtin_saveregs) (void);
688
    /* Returns pretend_argument_size.  */
689
    void (*setup_incoming_varargs) (CUMULATIVE_ARGS *ca, enum machine_mode mode,
690
                                    tree type, int *pretend_arg_size,
691
                                    int second_time);
692
    bool (*strict_argument_naming) (CUMULATIVE_ARGS *ca);
693
    /* Returns true if we should use
694
       targetm.calls.setup_incoming_varargs() and/or
695
       targetm.calls.strict_argument_naming().  */
696
    bool (*pretend_outgoing_varargs_named) (CUMULATIVE_ARGS *ca);
697
 
698
    /* Given a complex type T, return true if a parameter of type T
699
       should be passed as two scalars.  */
700
    bool (* split_complex_arg) (tree type);
701
 
702
    /* Return true if type T, mode MODE, may not be passed in registers,
703
       but must be passed on the stack.  */
704
    /* ??? This predicate should be applied strictly after pass-by-reference.
705
       Need audit to verify that this is the case.  */
706
    bool (* must_pass_in_stack) (enum machine_mode mode, tree t);
707
 
708
    /* Return true if type TYPE, mode MODE, which is passed by reference,
709
       should have the object copy generated by the callee rather than
710
       the caller.  It is never called for TYPE requiring constructors.  */
711
    bool (* callee_copies) (CUMULATIVE_ARGS *ca, enum machine_mode mode,
712
                            tree type, bool named);
713
 
714
    /* Return zero for arguments passed entirely on the stack or entirely
715
       in registers.  If passed in both, return the number of bytes passed
716
       in registers; the balance is therefore passed on the stack.  */
717
    int (* arg_partial_bytes) (CUMULATIVE_ARGS *ca, enum machine_mode mode,
718
                               tree type, bool named);
719
 
720
    /* Return the diagnostic message string if function without a prototype
721
       is not allowed for this 'val' argument; NULL otherwise. */
722
    const char *(*invalid_arg_for_unprototyped_fn) (tree typelist,
723
                                                    tree funcdecl, tree val);
724
 
725
    /* Return an rtx for the return value location of the function
726
       specified by FN_DECL_OR_TYPE with a return type of RET_TYPE.  */
727
    rtx (*function_value) (tree ret_type, tree fn_decl_or_type,
728
                           bool outgoing);
729
 
730
    /* Return an rtx for the argument pointer incoming to the
731
       current function.  */
732
    rtx (*internal_arg_pointer) (void);
733
  } calls;
734
 
735
  /* Return the diagnostic message string if conversion from FROMTYPE
736
     to TOTYPE is not allowed, NULL otherwise.  */
737
  const char *(*invalid_conversion) (tree fromtype, tree totype);
738
 
739
  /* Return the diagnostic message string if the unary operation OP is
740
     not permitted on TYPE, NULL otherwise.  */
741
  const char *(*invalid_unary_op) (int op, tree type);
742
 
743
  /* Return the diagnostic message string if the binary operation OP
744
     is not permitted on TYPE1 and TYPE2, NULL otherwise.  */
745
  const char *(*invalid_binary_op) (int op, tree type1, tree type2);
746
 
747
  /* Return the class for a secondary reload, and fill in extra information.  */
748
  enum reg_class (*secondary_reload) (bool, rtx, enum reg_class,
749
                                      enum machine_mode,
750
                                      struct secondary_reload_info *);
751
 
752
  /* Functions specific to the C++ frontend.  */
753
  struct cxx {
754
    /* Return the integer type used for guard variables.  */
755
    tree (*guard_type) (void);
756
    /* Return true if only the low bit of the guard should be tested.  */
757
    bool (*guard_mask_bit) (void);
758
    /* Returns the size of the array cookie for an array of type.  */
759
    tree (*get_cookie_size) (tree);
760
    /* Returns true if the element size should be stored in the
761
       array cookie.  */
762
    bool (*cookie_has_size) (void);
763
    /* Allows backends to perform additional processing when
764
       deciding if a class should be exported or imported.  */
765
    int (*import_export_class) (tree, int);
766
    /* Returns true if constructors and destructors return "this".  */
767
    bool (*cdtor_returns_this) (void);
768
    /* Returns true if the key method for a class can be an inline
769
       function, so long as it is not declared inline in the class
770
       itself.  Returning true is the behavior required by the Itanium
771
       C++ ABI.  */
772
    bool (*key_method_may_be_inline) (void);
773
    /* DECL is a virtual table, virtual table table, typeinfo object,
774
       or other similar implicit class data object that will be
775
       emitted with external linkage in this translation unit.  No ELF
776
       visibility has been explicitly specified.  If the target needs
777
       to specify a visibility other than that of the containing class,
778
       use this hook to set DECL_VISIBILITY and
779
       DECL_VISIBILITY_SPECIFIED.  */
780
    void (*determine_class_data_visibility) (tree decl);
781
    /* Returns true (the default) if virtual tables and other
782
       similar implicit class data objects are always COMDAT if they
783
       have external linkage.  If this hook returns false, then
784
       class data for classes whose virtual table will be emitted in
785
       only one translation unit will not be COMDAT.  */
786
    bool (*class_data_always_comdat) (void);
787
    /* Returns true if __aeabi_atexit should be used to register static
788
       destructors.  */
789
    bool (*use_aeabi_atexit) (void);
790
    /* TYPE is a C++ class (i.e., RECORD_TYPE or UNION_TYPE) that
791
       has just been defined.  Use this hook to make adjustments to the
792
       class  (eg, tweak visibility or perform any other required
793
       target modifications).  */
794
    void (*adjust_class_at_definition) (tree type);
795
  } cxx;
796
 
797
  /* For targets that need to mark extra registers as live on entry to
798
     the function, they should define this target hook and set their
799
     bits in the bitmap passed in. */
800
  void (*live_on_entry) (bitmap);
801
 
802
  /* True if unwinding tables should be generated by default.  */
803
  bool unwind_tables_default;
804
 
805
  /* Leave the boolean fields at the end.  */
806
 
807
  /* True if arbitrary sections are supported.  */
808
  bool have_named_sections;
809
 
810
  /* True if we can create zeroed data by switching to a BSS section
811
     and then using ASM_OUTPUT_SKIP to allocate the space.  */
812
  bool have_switchable_bss_sections;
813
 
814
  /* True if "native" constructors and destructors are supported,
815
     false if we're using collect2 for the job.  */
816
  bool have_ctors_dtors;
817
 
818
  /* True if thread-local storage is supported.  */
819
  bool have_tls;
820
 
821
  /* True if a small readonly data section is supported.  */
822
  bool have_srodata_section;
823
 
824
  /* True if EH frame info sections should be zero-terminated.  */
825
  bool terminate_dw2_eh_frame_info;
826
 
827
  /* True if #NO_APP should be emitted at the beginning of
828
     assembly output.  */
829
  bool file_start_app_off;
830
 
831
  /* True if output_file_directive should be called for main_input_filename
832
     at the beginning of assembly output.  */
833
  bool file_start_file_directive;
834
 
835
  /* True if #pragma redefine_extname is to be supported.  */
836
  bool handle_pragma_redefine_extname;
837
 
838
  /* True if #pragma extern_prefix is to be supported.  */
839
  bool handle_pragma_extern_prefix;
840
 
841
  /* True if the target is allowed to reorder memory accesses unless
842
     synchronization is explicitly requested.  */
843
  bool relaxed_ordering;
844
 
845
  /* Returns true if we should generate exception tables for use with the
846
     ARM EABI.  The effects the encoding of function exception specifications.
847
   */
848
  bool arm_eabi_unwinder;
849
 
850
  /* Leave the boolean fields at the end.  */
851
};
852
 
853
extern struct gcc_target targetm;
854
 
855
#endif /* GCC_TARGET_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.