View | Details | Return to bug 92055 | Differences between
and this patch

Collapse All | Expand All

(-)common/config/avr/avr-common.c (+26 lines)
Lines 23-28 Link Here
23
#include "tm.h"
23
#include "tm.h"
24
#include "common/common-target.h"
24
#include "common/common-target.h"
25
#include "common/common-target-def.h"
25
#include "common/common-target-def.h"
26
#include "opts.h"
26
27
27
/* Implement TARGET_OPTION_OPTIMIZATION_TABLE.  */
28
/* Implement TARGET_OPTION_OPTIMIZATION_TABLE.  */
28
static const struct default_options avr_option_optimization_table[] =
29
static const struct default_options avr_option_optimization_table[] =
Lines 41-46 static const struct default_options avr_ Link Here
41
    { OPT_LEVELS_NONE, 0, NULL, 0 }
42
    { OPT_LEVELS_NONE, 0, NULL, 0 }
42
  };
43
  };
43
44
45
46
/* Implement `TARGET_HANDLE_OPTION'.  */
47
48
static bool
49
avr_handle_option (struct gcc_options*, struct gcc_options*,
50
                   const struct cl_decoded_option *decoded, location_t)
51
{
52
  size_t code = decoded->opt_index;
53
54
  switch (code)
55
    {
56
    case OPT_mdouble64:
57
      // Only accept -mdouble64 if configured --with-double64.
58
#if !defined (WITH_DOUBLE64)
59
      return false;
60
#endif
61
      break;
62
    }
63
64
  return true;
65
}
66
67
#undef TARGET_HANDLE_OPTION
68
#define TARGET_HANDLE_OPTION avr_handle_option
69
44
#undef TARGET_OPTION_OPTIMIZATION_TABLE
70
#undef TARGET_OPTION_OPTIMIZATION_TABLE
45
#define TARGET_OPTION_OPTIMIZATION_TABLE avr_option_optimization_table
71
#define TARGET_OPTION_OPTIMIZATION_TABLE avr_option_optimization_table
46
72
(-)config/avr/avr-arch.h (+3 lines)
Lines 81-86 typedef struct Link Here
81
     and thus also the RAMPX, RAMPY and RAMPZ registers.  */
81
     and thus also the RAMPX, RAMPY and RAMPZ registers.  */
82
  int have_rampd;
82
  int have_rampd;
83
83
84
  /* whether we support a double64 multilib variant for this family. */
85
  int have_double64;
86
84
  /* This is a TINY core. */
87
  /* This is a TINY core. */
85
  int tiny_p;
88
  int tiny_p;
86
89
(-)config/avr/avr-devices.c (-23 / +23 lines)
Lines 36-66 const avr_arch_t Link Here
36
avr_arch_types[] =
36
avr_arch_types[] =
37
{
37
{
38
  /* unknown device specified */
38
  /* unknown device specified */
39
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 0,      32, NULL, AVR_MMCU_DEFAULT },
39
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 0,      32, NULL, AVR_MMCU_DEFAULT },
40
  /*
40
  /*
41
    A  M  J  LM E  E  E  X  R  T  d S     FPO     S O   A
41
    A  M  J  LM E  E  E  X  R  D  T  d S     FPO     S O   A
42
    S  U  M  PO L  L  I  M  A  I  a t     lMff    F ff  r
42
    S  U  M  PO L  L  I  M  A  B  I  a t     lMff    F ff  r
43
    M  L  P  MV P  P  J  E  M  N  t a     a s     R s   c
43
    M  L  P  MV P  P  J  E  M  L  N  t a     a s     R s   c
44
             XW M  M  M  G  P  Y  a r     s e       e   h
44
             XW M  M  M  G  P  6  Y  a r     s e       e   h
45
                   X  P  A  D       t     h t       t   ID   */
45
                   X  P  A  D  4       t     h t       t   ID   */
46
  { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 0,      32, "1",   "avr1"  },
46
  { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 0,      32, "1",   "avr1"  },
47
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 0,      32, "2",   "avr2"  },
47
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 0,      32, "2",   "avr2"  },
48
  { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0x0060, 0,      32, "25",  "avr25" },
48
  { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0x0060, 0,      32, "25",  "avr25" },
49
  { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0x0060, 0,      32, "3",   "avr3"  },
49
  { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 0,      32, "3",   "avr3"  },
50
  { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0x0060, 0,      32, "31",  "avr31" },
50
  { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0x0060, 0,      32, "31",  "avr31" },
51
  { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0x0060, 0,      32, "35",  "avr35" },
51
  { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0x0060, 0,      32, "35",  "avr35" },
52
  { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0x0060, 0,      32, "4",   "avr4"  },
52
  { 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0x0060, 0,      32, "4",   "avr4"  },
53
  { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0x0060, 0,      32, "5",   "avr5"  },
53
  { 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0x0060, 0,      32, "5",   "avr5"  },
54
  { 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0x0060, 0,      32, "51",  "avr51" },
54
  { 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0x0060, 0,      32, "51",  "avr51" },
55
  { 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0x0060, 0,      32, "6",   "avr6"  },
55
  { 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0x0060, 0,      32, "6",   "avr6"  },
56
56
57
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x0040, 0x4000, 0, "100", "avrtiny" },
57
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x0040, 0x4000, 0, "100", "avrtiny" },
58
  { 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0x2000, 0,      0, "102", "avrxmega2" },
58
  { 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0x2000, 0,      0, "102", "avrxmega2" },
59
  { 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0x2000, 0x8000, 0, "103", "avrxmega3" },
59
  { 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0x2000, 0x8000, 0, "103", "avrxmega3" },
60
  { 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0x2000, 0,      0, "104", "avrxmega4" },
60
  { 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0x2000, 0,      0, "104", "avrxmega4" },
61
  { 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0x2000, 0,      0, "105", "avrxmega5" },
61
  { 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0x2000, 0,      0, "105", "avrxmega5" },
62
  { 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0x2000, 0,      0, "106", "avrxmega6" },
62
  { 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0x2000, 0,      0, "106", "avrxmega6" },
63
  { 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0x2000, 0,      0, "107", "avrxmega7" }
63
  { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0x2000, 0,      0, "107", "avrxmega7" }
64
};
64
};
65
65
66
const avr_arch_info_t
66
const avr_arch_info_t
(-)config/avr/avr.h (-2 / +6 lines)
Lines 140-147 These two properties are reflected by bu Link Here
140
#define LONG_TYPE_SIZE (INT_TYPE_SIZE == 8 ? 16 : 32)
140
#define LONG_TYPE_SIZE (INT_TYPE_SIZE == 8 ? 16 : 32)
141
#define LONG_LONG_TYPE_SIZE (INT_TYPE_SIZE == 8 ? 32 : 64)
141
#define LONG_LONG_TYPE_SIZE (INT_TYPE_SIZE == 8 ? 32 : 64)
142
#define FLOAT_TYPE_SIZE 32
142
#define FLOAT_TYPE_SIZE 32
143
#define DOUBLE_TYPE_SIZE 32
143
#if defined (WITH_DOUBLE64)
144
#define LONG_DOUBLE_TYPE_SIZE 32
144
#define DOUBLE_TYPE_SIZE (avr_double64 ? 64 : FLOAT_TYPE_SIZE)
145
#else
146
#define DOUBLE_TYPE_SIZE FLOAT_TYPE_SIZE
147
#endif
148
#define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE
145
#define LONG_LONG_ACCUM_TYPE_SIZE 64
149
#define LONG_LONG_ACCUM_TYPE_SIZE 64
146
150
147
#define DEFAULT_SIGNED_CHAR 1
151
#define DEFAULT_SIGNED_CHAR 1
(-)config/avr/avr.opt (+4 lines)
Lines 115-120 mabsdata Link Here
115
Target Report Mask(ABSDATA)
115
Target Report Mask(ABSDATA)
116
Assume that all data in static storage can be accessed by LDS / STS.  This option is only useful for reduced Tiny devices.
116
Assume that all data in static storage can be accessed by LDS / STS.  This option is only useful for reduced Tiny devices.
117
117
118
mdouble64
119
Target Report Var(avr_double64) Init(0)
120
Use 64-bit double type.
121
118
nodevicelib
122
nodevicelib
119
Driver Target Report RejectNegative
123
Driver Target Report RejectNegative
120
Do not link against the device-specific library lib<MCU>.a.
124
Do not link against the device-specific library lib<MCU>.a.
(-)config/avr/gen-avr-mmcu-specs.c (+28 lines)
Lines 111-116 "# AVR-LibC, you can now define the hook Link Here
111
  "\n";
111
  "\n";
112
#endif // WITH_AVRLIBC
112
#endif // WITH_AVRLIBC
113
113
114
static const char help_double64[] =
115
  "# This incarnation of avr-gcc was configured with --with-double64.\n"
116
  "# However, not for each end every AVR family there is a multilib\n"
117
  "# that supports IEEE double.  If no multilib is supplied per default,\n"
118
  "# remove '-mdouble64' here and now.  That way, a non-existing multilib\n"
119
  "# won't be mapped to default.\n"
120
  "#    If you want to supply your own 64-bit double implementation for\n"
121
  "# this multilib variant, just ditch the removal of '-mdouble64' from\n"
122
  "# self_spec and the info message which lead you here.\n"
123
  "\n";
124
125
static const char info_double64[] = "no IEEE double multilib variant "
126
  "available, removing '-mdouble64' from the command line";
127
114
static void
128
static void
115
print_mcu (const avr_mcu_t *mcu)
129
print_mcu (const avr_mcu_t *mcu)
116
{
130
{
Lines 166-171 bool is_arch = mcu->macro == NULL; Link Here
166
      rcall_spec = rcall ? "-mshort-calls" : "%<mshort-calls";
180
      rcall_spec = rcall ? "-mshort-calls" : "%<mshort-calls";
167
    }
181
    }
168
182
183
  bool double64_p = true;
184
185
#if defined (WITH_DOUBLE64)
186
  double64_p = arch->have_double64;
187
#endif // --with-double64
188
169
  fprintf (f, "#\n"
189
  fprintf (f, "#\n"
170
           "# Auto-generated specs for AVR ");
190
           "# Auto-generated specs for AVR ");
171
  if (is_arch)
191
  if (is_arch)
Lines 287-292 bool is_arch = mcu->macro == NULL; Link Here
287
      fprintf (f, "\t-D%s -D__AVR_DEVICE_NAME__=%s", mcu->macro, mcu->name);
307
      fprintf (f, "\t-D%s -D__AVR_DEVICE_NAME__=%s", mcu->macro, mcu->name);
288
      fprintf (f, "\n\n");
308
      fprintf (f, "\n\n");
289
    }
309
    }
310
  else if (!double64_p)
311
    {
312
      fprintf (f, "%s", help_double64);
313
      fprintf (f, "*self_spec:\n");
314
      fprintf (f, "\t%%{mdouble64:%%nspecs-%s: %s} %%<mdouble64",
315
               arch_mcu->name, info_double64);
316
      fprintf (f, "\n\n");
317
    }
290
318
291
  fprintf (f, "# End of file\n");
319
  fprintf (f, "# End of file\n");
292
320
(-)config/avr/genmultilib.awk (-2 / +23 lines)
Lines 38-43 BEGIN { Link Here
38
    dir_rcall = "short-calls"
38
    dir_rcall = "short-calls"
39
    opt_rcall = "mshort-calls"
39
    opt_rcall = "mshort-calls"
40
40
41
    dir_double64 = "double64"
42
    opt_double64 = "mdouble64"
43
41
    #    awk Variable         Makefile Variable  
44
    #    awk Variable         Makefile Variable  
42
    #  ------------------------------------------
45
    #  ------------------------------------------
43
    #    m_options     <->    MULTILIB_OPTIONS
46
    #    m_options     <->    MULTILIB_OPTIONS
Lines 47-52 BEGIN { Link Here
47
    m_options    = "\nMULTILIB_OPTIONS = "
50
    m_options    = "\nMULTILIB_OPTIONS = "
48
    m_dirnames   = "\nMULTILIB_DIRNAMES ="
51
    m_dirnames   = "\nMULTILIB_DIRNAMES ="
49
    m_required   = "\nMULTILIB_REQUIRED ="
52
    m_required   = "\nMULTILIB_REQUIRED ="
53
54
    with_double64 = (with_double64 == "WITH_DOUBLE64")
55
56
    split (mcus_double64, mmcu_double64, ":")
50
}
57
}
51
58
52
##################################################################
59
##################################################################
Lines 130-136 BEGIN { Link Here
130
	# leading "mmcu=avr2/" in order not to confuse genmultilib.
137
	# leading "mmcu=avr2/" in order not to confuse genmultilib.
131
	gsub (/^mmcu=avr2\//, "", opts)
138
	gsub (/^mmcu=avr2\//, "", opts)
132
	if (opts != "mmcu=avr2")
139
	if (opts != "mmcu=avr2")
140
	{
133
	    m_required = m_required " \\\n\t" opts
141
	    m_required = m_required " \\\n\t" opts
142
143
	    for (m in mmcu_double64)
144
		if (core == mmcu_double64[m])
145
		    m_required = m_required " \\\n\t" opts "/" opt_double64
146
	}
134
    }
147
    }
135
}
148
}
136
149
Lines 144-151 END { Link Here
144
    ############################################################
157
    ############################################################
145
158
146
    # Intended Target: ./gcc/config/avr/t-multilib
159
    # Intended Target: ./gcc/config/avr/t-multilib
160
    if (with_double64)
161
    {
162
	print m_options  " " opt_tiny " " opt_rcall " " opt_double64
163
	print m_dirnames " " dir_tiny " " dir_rcall " " dir_double64
164
    }
165
    else
166
    {
167
	print m_options  " " opt_tiny " " opt_rcall
168
	print m_dirnames " " dir_tiny " " dir_rcall
169
    }
147
170
148
    print m_options  " " opt_tiny " " opt_rcall
149
    print m_dirnames " " dir_tiny " " dir_rcall
150
    print m_required
171
    print m_required
151
}
172
}
(-)config/avr/t-avr (-1 / +12 lines)
Lines 16-21 Link Here
16
# along with GCC; see the file COPYING3.  If not see
16
# along with GCC; see the file COPYING3.  If not see
17
# <http://www.gnu.org/licenses/>.
17
# <http://www.gnu.org/licenses/>.
18
18
19
WITH_DOUBLE64 = $(findstring WITH_DOUBLE64, $(tm_defines))
20
19
PASSES_EXTRA += $(srcdir)/config/avr/avr-passes.def
21
PASSES_EXTRA += $(srcdir)/config/avr/avr-passes.def
20
22
21
driver-avr.o: $(srcdir)/config/avr/driver-avr.c \
23
driver-avr.o: $(srcdir)/config/avr/driver-avr.c \
Lines 96-101 install-device-specs: s-device-specs ins Link Here
96
98
97
s-mlib: $(srcdir)/config/avr/t-multilib
99
s-mlib: $(srcdir)/config/avr/t-multilib
98
100
101
# Only support 64-bit double for devices where this might be used / useful.
102
# The following variable is in sync with avr_arch.have_double64.
103
104
mcus_double64 = avr4:avr5:avr51:avr6
105
mcus_double64 := $(mcus_double64):avrxmega2:avrxmega3:avrxmega4
106
mcus_double64 := $(mcus_double64):avrxmega5:avrxmega6:avrxmega7
107
99
$(srcdir)/config/avr/t-multilib: $(srcdir)/config/avr/genmultilib.awk \
108
$(srcdir)/config/avr/t-multilib: $(srcdir)/config/avr/genmultilib.awk \
100
				 $(AVR_MCUS)
109
				 $(AVR_MCUS)
101
	$(AWK) -f $< $< $(AVR_MCUS) > $@
110
	$(AWK) 	-v with_double64=$(WITH_DOUBLE64) \
111
	       	-v mcus_double64=$(mcus_double64) \
112
		-f $< $< $(AVR_MCUS) > $@
(-)config/avr/t-multilib (-2 / +13 lines)
Lines 21-29 Link Here
21
# along with GCC; see the file COPYING3.  If not see
21
# along with GCC; see the file COPYING3.  If not see
22
# <http://www.gnu.org/licenses/>.
22
# <http://www.gnu.org/licenses/>.
23
23
24
MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr31/mmcu=avr35/mmcu=avr4/mmcu=avr5/mmcu=avr51/mmcu=avr6/mmcu=avrxmega2/mmcu=avrxmega3/mmcu=avrxmega4/mmcu=avrxmega5/mmcu=avrxmega6/mmcu=avrxmega7/mmcu=avrtiny msp8 mshort-calls
24
MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr31/mmcu=avr35/mmcu=avr4/mmcu=avr5/mmcu=avr51/mmcu=avr6/mmcu=avrxmega2/mmcu=avrxmega3/mmcu=avrxmega4/mmcu=avrxmega5/mmcu=avrxmega6/mmcu=avrxmega7/mmcu=avrtiny msp8 mshort-calls mdouble64
25
25
26
MULTILIB_DIRNAMES = avr2 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega2 avrxmega3 avrxmega4 avrxmega5 avrxmega6 avrxmega7 avrtiny tiny-stack short-calls
26
MULTILIB_DIRNAMES = avr2 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega2 avrxmega3 avrxmega4 avrxmega5 avrxmega6 avrxmega7 avrtiny tiny-stack short-calls double64
27
27
28
MULTILIB_REQUIRED = \
28
MULTILIB_REQUIRED = \
29
	msp8 \
29
	msp8 \
Lines 33-46 MULTILIB_REQUIRED = \ Link Here
33
	mmcu=avr31 \
33
	mmcu=avr31 \
34
	mmcu=avr35 \
34
	mmcu=avr35 \
35
	mmcu=avr4 \
35
	mmcu=avr4 \
36
	mmcu=avr4/mdouble64 \
36
	mmcu=avr5 \
37
	mmcu=avr5 \
38
	mmcu=avr5/mdouble64 \
37
	mmcu=avr51 \
39
	mmcu=avr51 \
40
	mmcu=avr51/mdouble64 \
38
	mmcu=avr6 \
41
	mmcu=avr6 \
42
	mmcu=avr6/mdouble64 \
39
	mmcu=avrxmega2 \
43
	mmcu=avrxmega2 \
44
	mmcu=avrxmega2/mdouble64 \
40
	mmcu=avrxmega3/mshort-calls \
45
	mmcu=avrxmega3/mshort-calls \
46
	mmcu=avrxmega3/mshort-calls/mdouble64 \
41
	mmcu=avrxmega3 \
47
	mmcu=avrxmega3 \
48
	mmcu=avrxmega3/mdouble64 \
42
	mmcu=avrxmega4 \
49
	mmcu=avrxmega4 \
50
	mmcu=avrxmega4/mdouble64 \
43
	mmcu=avrxmega5 \
51
	mmcu=avrxmega5 \
52
	mmcu=avrxmega5/mdouble64 \
44
	mmcu=avrxmega6 \
53
	mmcu=avrxmega6 \
54
	mmcu=avrxmega6/mdouble64 \
45
	mmcu=avrxmega7 \
55
	mmcu=avrxmega7 \
56
	mmcu=avrxmega7/mdouble64 \
46
	mmcu=avrtiny
57
	mmcu=avrtiny
(-)config.gcc (+3 lines)
Lines 1287-1292 avr-*-*) Link Here
1287
	    tm_file="${tm_file} ${cpu_type}/avrlibc.h"
1287
	    tm_file="${tm_file} ${cpu_type}/avrlibc.h"
1288
	    tm_defines="${tm_defines} WITH_AVRLIBC"
1288
	    tm_defines="${tm_defines} WITH_AVRLIBC"
1289
	fi
1289
	fi
1290
	if test x${with_double64} = xyes; then
1291
	    tm_defines="${tm_defines} WITH_DOUBLE64"
1292
	fi
1290
	tmake_file="${tmake_file} avr/t-avr avr/t-multilib"
1293
	tmake_file="${tmake_file} avr/t-avr avr/t-multilib"
1291
	use_gcc_stdint=wrap
1294
	use_gcc_stdint=wrap
1292
	extra_gcc_objs="driver-avr.o avr-devices.o"
1295
	extra_gcc_objs="driver-avr.o avr-devices.o"

Return to bug 92055