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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [common/] [config/] [sh/] [sh-common.c] - Blame information for rev 758

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

Line No. Rev Author Line
1 708 jeremybenn
/* Common hooks for Renesas / SuperH SH.
2
   Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
3
   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
4
   Free Software Foundation, Inc.
5
 
6
This file is part of GCC.
7
 
8
GCC is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 3, or (at your option)
11
any later version.
12
 
13
GCC is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
GNU General Public License for more details.
17
 
18
You should have received a copy of the GNU General Public License
19
along with GCC; see the file COPYING3.  If not see
20
<http://www.gnu.org/licenses/>.  */
21
 
22
#include "config.h"
23
#include "system.h"
24
#include "coretypes.h"
25
#include "tm.h"
26
#include "common/common-target.h"
27
#include "common/common-target-def.h"
28
#include "opts.h"
29
#include "flags.h"
30
#include "params.h"
31
 
32
/* Set default optimization options.  */
33
static const struct default_options sh_option_optimization_table[] =
34
  {
35
    { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 },
36
    { OPT_LEVELS_1_PLUS_SPEED_ONLY, OPT_mdiv_, "inv:minlat", 1 },
37
    { OPT_LEVELS_SIZE, OPT_mdiv_, SH_DIV_STR_FOR_SIZE, 1 },
38
    { OPT_LEVELS_0_ONLY, OPT_mdiv_, "", 1 },
39
    { OPT_LEVELS_SIZE, OPT_mcbranchdi, NULL, 0 },
40
    /* We can't meaningfully test TARGET_SHMEDIA here, because -m
41
       options haven't been parsed yet, hence we'd read only the
42
       default.  sh_target_reg_class will return NO_REGS if this is
43
       not SHMEDIA, so it's OK to always set
44
       flag_branch_target_load_optimize.  */
45
    { OPT_LEVELS_2_PLUS, OPT_fbranch_target_load_optimize, NULL, 1 },
46
    { OPT_LEVELS_NONE, 0, NULL, 0 }
47
  };
48
 
49
/* Implement TARGET_HANDLE_OPTION.  */
50
 
51
static bool
52
sh_handle_option (struct gcc_options *opts,
53
                  struct gcc_options *opts_set ATTRIBUTE_UNUSED,
54
                  const struct cl_decoded_option *decoded,
55
                  location_t loc ATTRIBUTE_UNUSED)
56
{
57
  size_t code = decoded->opt_index;
58
 
59
  switch (code)
60
    {
61
    case OPT_m1:
62
      opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH1;
63
      return true;
64
 
65
    case OPT_m2:
66
      opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2;
67
      return true;
68
 
69
    case OPT_m2a:
70
      opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2A;
71
      return true;
72
 
73
    case OPT_m2a_nofpu:
74
      opts->x_target_flags
75
        = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2A_NOFPU;
76
      return true;
77
 
78
    case OPT_m2a_single:
79
      opts->x_target_flags
80
        = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2A_SINGLE;
81
      return true;
82
 
83
    case OPT_m2a_single_only:
84
      opts->x_target_flags
85
        = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2A_SINGLE_ONLY;
86
      return true;
87
 
88
    case OPT_m2e:
89
      opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH2E;
90
      return true;
91
 
92
    case OPT_m3:
93
      opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH3;
94
      return true;
95
 
96
    case OPT_m3e:
97
      opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH3E;
98
      return true;
99
 
100
    case OPT_m4:
101
    case OPT_m4_100:
102
    case OPT_m4_200:
103
    case OPT_m4_300:
104
      opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4;
105
      return true;
106
 
107
    case OPT_m4_nofpu:
108
    case OPT_m4_100_nofpu:
109
    case OPT_m4_200_nofpu:
110
    case OPT_m4_300_nofpu:
111
    case OPT_m4_340:
112
    case OPT_m4_400:
113
    case OPT_m4_500:
114
      opts->x_target_flags
115
        = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4_NOFPU;
116
      return true;
117
 
118
    case OPT_m4_single:
119
    case OPT_m4_100_single:
120
    case OPT_m4_200_single:
121
    case OPT_m4_300_single:
122
      opts->x_target_flags
123
        = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4_SINGLE;
124
      return true;
125
 
126
    case OPT_m4_single_only:
127
    case OPT_m4_100_single_only:
128
    case OPT_m4_200_single_only:
129
    case OPT_m4_300_single_only:
130
      opts->x_target_flags
131
        = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4_SINGLE_ONLY;
132
      return true;
133
 
134
    case OPT_m4a:
135
      opts->x_target_flags = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4A;
136
      return true;
137
 
138
    case OPT_m4a_nofpu:
139
    case OPT_m4al:
140
      opts->x_target_flags
141
        = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4A_NOFPU;
142
      return true;
143
 
144
    case OPT_m4a_single:
145
      opts->x_target_flags
146
        = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4A_SINGLE;
147
      return true;
148
 
149
    case OPT_m4a_single_only:
150
      opts->x_target_flags
151
        = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH4A_SINGLE_ONLY;
152
      return true;
153
 
154
    case OPT_m5_32media:
155
      opts->x_target_flags
156
        = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH5_32MEDIA;
157
      return true;
158
 
159
    case OPT_m5_32media_nofpu:
160
      opts->x_target_flags
161
        = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH5_32MEDIA_NOFPU;
162
      return true;
163
 
164
    case OPT_m5_64media:
165
      opts->x_target_flags
166
        = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH5_64MEDIA;
167
      return true;
168
 
169
    case OPT_m5_64media_nofpu:
170
      opts->x_target_flags
171
        = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH5_64MEDIA_NOFPU;
172
      return true;
173
 
174
    case OPT_m5_compact:
175
      opts->x_target_flags
176
        = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH5_COMPACT;
177
      return true;
178
 
179
    case OPT_m5_compact_nofpu:
180
      opts->x_target_flags
181
        = (opts->x_target_flags & ~MASK_ARCH) | SELECT_SH5_COMPACT_NOFPU;
182
      return true;
183
 
184
    default:
185
      return true;
186
    }
187
}
188
 
189
/* Implement TARGET_OPTION_INIT_STRUCT.  */
190
static void
191
sh_option_init_struct (struct gcc_options *opts)
192
{
193
  /* We can't meaningfully test TARGET_SH2E / TARGET_IEEE
194
     here, so leave it to TARGET_OPTION_OVERRIDE to set
195
     flag_finite_math_only.  We set it to 2 here so we know if the user
196
     explicitly requested this to be on or off.  */
197
  opts->x_flag_finite_math_only = 2;
198
}
199
 
200
/* Implement TARGET_OPTION_DEFAULT_PARAMS.  */
201
static void
202
sh_option_default_params (void)
203
{
204
  set_default_param_value (PARAM_SIMULTANEOUS_PREFETCHES, 2);
205
}
206
 
207
#undef TARGET_OPTION_OPTIMIZATION_TABLE
208
#define TARGET_OPTION_OPTIMIZATION_TABLE sh_option_optimization_table
209
#undef TARGET_OPTION_INIT_STRUCT
210
#define TARGET_OPTION_INIT_STRUCT sh_option_init_struct
211
#undef TARGET_OPTION_DEFAULT_PARAMS
212
#define TARGET_OPTION_DEFAULT_PARAMS sh_option_default_params
213
#undef TARGET_DEFAULT_TARGET_FLAGS
214
#define TARGET_DEFAULT_TARGET_FLAGS TARGET_DEFAULT
215
#undef TARGET_HANDLE_OPTION
216
#define TARGET_HANDLE_OPTION sh_handle_option
217
 
218
struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;

powered by: WebSVN 2.1.0

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