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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 708 jeremybenn
/* Common hooks for NEC V850 series.
2
   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
3
   2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
4
 
5
   This file is part of GCC.
6
 
7
   GCC is free software; you can redistribute it and/or modify it
8
   under the terms of the GNU General Public License as published by
9
   the Free Software Foundation; either version 3, or (at your option)
10
   any later version.
11
 
12
   GCC is distributed in the hope that it will be useful, but WITHOUT
13
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15
   for more details.
16
 
17
   You should have received a copy of the GNU General Public License
18
   along with GCC; see the file COPYING3.  If not see
19
   <http://www.gnu.org/licenses/>.  */
20
 
21
#include "config.h"
22
#include "system.h"
23
#include "coretypes.h"
24
#include "diagnostic-core.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
 
31
/* Information about the various small memory areas.  */
32
static const int small_memory_physical_max[(int) SMALL_MEMORY_max] =
33
{
34
  256,
35
  65536,
36
  32768,
37
};
38
 
39
/* Set the maximum size of small memory area TYPE to the value given
40
   by SIZE in structure OPTS (option text OPT passed at location LOC).  */
41
 
42
static void
43
v850_handle_memory_option (enum small_memory_type type,
44
                           struct gcc_options *opts, const char *opt,
45
                           int size, location_t loc)
46
{
47
  if (size > small_memory_physical_max[type])
48
    error_at (loc, "value passed in %qs is too large", opt);
49
  else
50
    opts->x_small_memory_max[type] = size;
51
}
52
 
53
/* Implement TARGET_HANDLE_OPTION.  */
54
 
55
static bool
56
v850_handle_option (struct gcc_options *opts,
57
                    struct gcc_options *opts_set ATTRIBUTE_UNUSED,
58
                    const struct cl_decoded_option *decoded,
59
                    location_t loc)
60
{
61
  size_t code = decoded->opt_index;
62
  int value = decoded->value;
63
 
64
  switch (code)
65
    {
66
    case OPT_mspace:
67
      opts->x_target_flags |= MASK_EP | MASK_PROLOG_FUNCTION;
68
      return true;
69
 
70
    case OPT_mv850:
71
      opts->x_target_flags &= ~(MASK_CPU ^ MASK_V850);
72
      return true;
73
 
74
    case OPT_mv850e:
75
    case OPT_mv850e1:
76
    case OPT_mv850es:
77
      opts->x_target_flags &= ~(MASK_CPU ^ MASK_V850E);
78
      return true;
79
 
80
    case OPT_mv850e2:
81
      opts->x_target_flags &= ~(MASK_CPU ^ MASK_V850E2);
82
      return true;
83
 
84
    case OPT_mv850e2v3:
85
      opts->x_target_flags &= ~(MASK_CPU ^ MASK_V850E2V3);
86
      return true;
87
 
88
    case OPT_mtda_:
89
      v850_handle_memory_option (SMALL_MEMORY_TDA, opts,
90
                                 decoded->orig_option_with_args_text,
91
                                 value, loc);
92
      return true;
93
 
94
    case OPT_msda_:
95
      v850_handle_memory_option (SMALL_MEMORY_SDA, opts,
96
                                 decoded->orig_option_with_args_text,
97
                                 value, loc);
98
      return true;
99
 
100
    case OPT_mzda_:
101
      v850_handle_memory_option (SMALL_MEMORY_ZDA, opts,
102
                                 decoded->orig_option_with_args_text,
103
                                 value, loc);
104
      return true;
105
 
106
    default:
107
      return true;
108
    }
109
}
110
 
111
/* Implement TARGET_OPTION_OPTIMIZATION_TABLE.  */
112
 
113
static const struct default_options v850_option_optimization_table[] =
114
  {
115
    { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 },
116
    /* Note - we no longer enable MASK_EP when optimizing.  This is
117
       because of a hardware bug which stops the SLD and SST instructions
118
       from correctly detecting some hazards.  If the user is sure that
119
       their hardware is fixed or that their program will not encounter
120
       the conditions that trigger the bug then they can enable -mep by
121
       hand.  */
122
    { OPT_LEVELS_1_PLUS, OPT_mprolog_function, NULL, 1 },
123
    { OPT_LEVELS_NONE, 0, NULL, 0 }
124
  };
125
 
126
#undef  TARGET_DEFAULT_TARGET_FLAGS
127
#define TARGET_DEFAULT_TARGET_FLAGS (MASK_DEFAULT | MASK_APP_REGS)
128
#undef  TARGET_HANDLE_OPTION
129
#define TARGET_HANDLE_OPTION v850_handle_option
130
#undef  TARGET_OPTION_OPTIMIZATION_TABLE
131
#define TARGET_OPTION_OPTIMIZATION_TABLE v850_option_optimization_table
132
 
133
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.