diff options
Diffstat (limited to 'gcc/target.h')
-rw-r--r-- | gcc/target.h | 83 |
1 files changed, 46 insertions, 37 deletions
diff --git a/gcc/target.h b/gcc/target.h index eae0b76a899..12fd9b085a0 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -1,5 +1,6 @@ /* Data structure definitions for a generic GCC target. - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, + 2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it @@ -49,9 +50,24 @@ #ifndef GCC_TARGET_H #define GCC_TARGET_H -#include "tm.h" #include "insn-modes.h" +#ifdef ENABLE_CHECKING + +typedef struct { void *magic; void *p; } cumulative_args_t; + +#else /* !ENABLE_CHECKING */ + +/* When using a GCC build compiler, we could use + __attribute__((transparent_union)) to get cumulative_args_t function + arguments passed like scalars where the ABI would mandate a less + efficient way of argument passing otherwise. However, that would come + at the cost of less type-safe !ENABLE_CHECKING compilation. */ + +typedef union { void *p; } cumulative_args_t; + +#endif /* !ENABLE_CHECKING */ + /* Types used by the record_gcc_switches() target function. */ typedef enum { @@ -131,41 +147,6 @@ enum vect_cost_for_stmt vec_perm }; -/* Sets of optimization levels at which an option may be enabled by - default_options_optimization. */ -enum opt_levels -{ - OPT_LEVELS_NONE, /* No levels (mark end of array). */ - OPT_LEVELS_ALL, /* All levels (used by targets to disable options - enabled in target-independent code). */ - OPT_LEVELS_0_ONLY, /* -O0 only. */ - OPT_LEVELS_1_PLUS, /* -O1 and above, including -Os. */ - OPT_LEVELS_1_PLUS_SPEED_ONLY, /* -O1 and above, but not -Os. */ - OPT_LEVELS_2_PLUS, /* -O2 and above, including -Os. */ - OPT_LEVELS_2_PLUS_SPEED_ONLY, /* -O2 and above, but not -Os. */ - OPT_LEVELS_3_PLUS, /* -O3 and above. */ - OPT_LEVELS_3_PLUS_AND_SIZE, /* -O3 and above and -Os. */ - OPT_LEVELS_SIZE, /* -Os only. */ - OPT_LEVELS_FAST /* -Ofast only. */ -}; - -/* Description of options to enable by default at given levels. */ -struct default_options -{ - /* The levels at which to enable the option. */ - enum opt_levels levels; - - /* The option index and argument or enabled/disabled sense of the - option, as passed to handle_generated_option. If ARG is NULL and - the option allows a negative form, the option is considered to be - passed in negative form when the optimization level is not one of - those in LEVELS (in order to handle changes to the optimization - level with the "optimize" attribute). */ - size_t opt_index; - const char *arg; - int value; -}; - /* The target structure. This holds all the backend hooks. */ #define DEFHOOKPOD(NAME, DOC, TYPE, INIT) TYPE NAME; #define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) TYPE (* NAME) PARAMS; @@ -176,4 +157,32 @@ struct default_options extern struct gcc_target targetm; +#ifdef GCC_TM_H + +#ifndef CUMULATIVE_ARGS_MAGIC +#define CUMULATIVE_ARGS_MAGIC ((void *) &targetm.calls) +#endif + +static inline CUMULATIVE_ARGS * +get_cumulative_args (cumulative_args_t arg) +{ +#ifdef ENABLE_CHECKING + gcc_assert (arg.magic == CUMULATIVE_ARGS_MAGIC); +#endif /* ENABLE_CHECKING */ + return (CUMULATIVE_ARGS *) arg.p; +} + +static inline cumulative_args_t +pack_cumulative_args (CUMULATIVE_ARGS *arg) +{ + cumulative_args_t ret; + +#ifdef ENABLE_CHECKING + ret.magic = CUMULATIVE_ARGS_MAGIC; +#endif /* ENABLE_CHECKING */ + ret.p = (void *) arg; + return ret; +} +#endif /* GCC_TM_H */ + #endif /* GCC_TARGET_H */ |