avr.c (avr_mcu_types): Update for new devices.
authorMarek Michalkiewicz <marekm@amelek.gda.pl>
Sun, 9 Jun 2002 18:06:10 +0000 (20:06 +0200)
committerMarek Michalkiewicz <marekm@gcc.gnu.org>
Sun, 9 Jun 2002 18:06:10 +0000 (18:06 +0000)
* config/avr/avr.c (avr_mcu_types): Update for new devices.
* config/avr/avr.h (TARGET_SWITCHES, AVR_MEGA): Add -mshort-calls.
(LINK_SPEC, CRT_BINUTILS_SPECS): Update for new devices.
* config/avr/avr.md ("type" and "length" attributes): New type
"xcall", length 1 or 2 if AVR_MEGA.  Use in all patterns that
output a single "call" or "rcall" insn depending on device size.
* config/avr/t-avr (MULTILIB_MATCHES): Update for new devices.

From-SVN: r54410

gcc/ChangeLog
gcc/config/avr/avr.c
gcc/config/avr/avr.h
gcc/config/avr/avr.md
gcc/config/avr/t-avr

index 1cb51465e94e9cce6083678cf817843f4e92fa60..79b875c127d3604a30b8874d1d5179bfb8609960 100644 (file)
@@ -1,3 +1,13 @@
+2002-06-09  Marek Michalkiewicz  <marekm@amelek.gda.pl>
+
+       * config/avr/avr.c (avr_mcu_types): Update for new devices.
+       * config/avr/avr.h (TARGET_SWITCHES, AVR_MEGA): Add -mshort-calls.
+       (LINK_SPEC, CRT_BINUTILS_SPECS): Update for new devices.
+       * config/avr/avr.md ("type" and "length" attributes): New type
+       "xcall", length 1 or 2 if AVR_MEGA.  Use in all patterns that
+       output a single "call" or "rcall" insn depending on device size.
+       * config/avr/t-avr (MULTILIB_MATCHES): Update for new devices.
+
 2002-06-09  David Edelsohn  <edelsohn@gnu.org>
 
        * config/rs6000/{aix43.h,aix5.1} (ASM_CPU_SPEC): Add power3
index 56900ae73303bc41187d3bf759a4780b7db7c17e..1f51c038b4065fd6175ddbc64f0b1f51f46b859d 100644 (file)
@@ -171,6 +171,7 @@ static const struct mcu_type_s avr_mcu_types[] = {
   { "at90s8515", 2, "__AVR_AT90S8515__" },
   { "at90c8534", 2, "__AVR_AT90C8534__" },
   { "at90s8535", 2, "__AVR_AT90S8535__" },
+  { "at86rf401", 2, "__AVR_AT86RF401__" },
     /* Classic, > 8K.  */
   { "avr3",      3, NULL },
   { "atmega103", 3, "__AVR_ATmega103__" },
@@ -182,12 +183,14 @@ static const struct mcu_type_s avr_mcu_types[] = {
   { "avr4",      4, NULL },
   { "atmega8",   4, "__AVR_ATmega8__" },
   { "atmega8515", 4, "__AVR_ATmega8515__" },
+  { "atmega8535", 4, "__AVR_ATmega8535__" },
     /* Enhanced, > 8K.  */
   { "avr5",      5, NULL },
   { "atmega16",  5, "__AVR_ATmega16__" },
   { "atmega161", 5, "__AVR_ATmega161__" },
   { "atmega162", 5, "__AVR_ATmega162__" },
   { "atmega163", 5, "__AVR_ATmega163__" },
+  { "atmega169", 5, "__AVR_ATmega169__" },
   { "atmega32",  5, "__AVR_ATmega32__" },
   { "atmega323", 5, "__AVR_ATmega323__" },
   { "atmega64",  5, "__AVR_ATmega64__" },
index d26bafdf98ec702076f3667b7ace14c223e86b7e..5148f3ee8dc36f63144dfda4a100d104509f512d 100644 (file)
@@ -58,6 +58,7 @@ extern int target_flags;
 #define MASK_NO_INTERRUPTS     0x00020000
 #define MASK_CALL_PROLOGUES    0x00040000
 #define MASK_TINY_STACK                0x00080000
+#define MASK_SHORT_CALLS       0x00100000
 
 #define TARGET_ORDER_1         (target_flags & MASK_ORDER_1)
 #define TARGET_ORDER_2         (target_flags & MASK_ORDER_2)
@@ -67,6 +68,7 @@ extern int target_flags;
 #define TARGET_CALL_PROLOGUES  (target_flags & MASK_CALL_PROLOGUES)
 #define TARGET_TINY_STACK      (target_flags & MASK_TINY_STACK)
 #define TARGET_NO_TABLEJUMP    (target_flags & MASK_NO_TABLEJUMP)
+#define TARGET_SHORT_CALLS     (target_flags & MASK_SHORT_CALLS)
 
 /* Dump each assembler insn's rtl into the output file.
    This is for debugging the compiler itself.  */
@@ -86,6 +88,8 @@ extern int target_flags;
     N_("Change only the low 8 bits of the stack pointer") },           \
   { "no-tablejump", MASK_NO_TABLEJUMP,                                 \
     N_("Do not generate tablejump insns") },                           \
+  { "short-calls", MASK_SHORT_CALLS,                                   \
+    N_("Use rjmp/rcall (limited range) on >8K devices") },             \
   { "rtl", MASK_RTL_DUMP, NULL },                                      \
   { "size", MASK_INSN_SIZE_DUMP,                                       \
     N_("Output instruction sizes to the asm file") },                  \
@@ -101,7 +105,7 @@ extern int avr_mega_p;
 extern int avr_enhanced_p;
 extern int avr_asm_only_p;
 
-#define AVR_MEGA (avr_mega_p)
+#define AVR_MEGA (avr_mega_p && !TARGET_SHORT_CALLS)
 #define AVR_ENHANCED (avr_enhanced_p)
 
 #define TARGET_OPTIONS {                                                     \
@@ -2585,11 +2589,11 @@ extern int avr_case_values_threshold;
 
 #define LINK_SPEC " %{!mmcu*:-m avr2}\
 %{mmcu=at90s1200|mmcu=attiny1*|mmcu=attiny28:-m avr1} \
-%{mmcu=attiny22|mmcu=attiny26|mmcu=at90s2*|mmcu=at90s4*|mmcu=at90s8*|mmcu=at90c8*:-m avr2}\
+%{mmcu=attiny22|mmcu=attiny26|mmcu=at90s2*|mmcu=at90s4*|mmcu=at90s8*|mmcu=at90c8*|mmcu=at86rf401:-m avr2}\
 %{mmcu=atmega103|mmcu=atmega603|mmcu=at43*|mmcu=at76*:-m avr3}\
 %{mmcu=atmega8*:-m avr4}\
 %{mmcu=atmega16*|mmcu=atmega32*|mmcu=atmega64|mmcu=atmega128|mmcu=at94k:-m avr5}\
-%{mmcu=atmega64|mmcu=atmega128|mmcu=atmega162: -Tdata 0x800100} "
+%{mmcu=atmega64|mmcu=atmega128|mmcu=atmega162|mmcu=atmega169: -Tdata 0x800100} "
 
 /* A C string constant that tells the GNU CC driver program options to
    pass to the linker.  It can also specify how to translate options
@@ -2653,6 +2657,7 @@ extern int avr_case_values_threshold;
 %{mmcu=at90s4434:crts4434.o%s} \
 %{mmcu=at90c8534:crtc8534.o%s} \
 %{mmcu=at90s8535:crts8535.o%s} \
+%{mmcu=at86rf401:crt86401.o%s} \
 %{mmcu=atmega103|mmcu=avr3:crtm103.o%s} \
 %{mmcu=atmega603:crtm603.o%s} \
 %{mmcu=at43usb320:crt43320.o%s} \
@@ -2660,10 +2665,12 @@ extern int avr_case_values_threshold;
 %{mmcu=at76c711:crt76711.o%s} \
 %{mmcu=atmega8|mmcu=avr4:crtm8.o%s} \
 %{mmcu=atmega8515:crtm8515.o%s} \
+%{mmcu=atmega8535:crtm8535.o%s} \
 %{mmcu=atmega16:crtm16.o%s} \
 %{mmcu=atmega161|mmcu=avr5:crtm161.o%s} \
 %{mmcu=atmega162:crtm162.o%s} \
 %{mmcu=atmega163:crtm163.o%s} \
+%{mmcu=atmega169:crtm169.o%s} \
 %{mmcu=atmega32:crtm32.o%s} \
 %{mmcu=atmega323:crtm323.o%s} \
 %{mmcu=atmega64:crtm64.o%s} \
index 08a468aa40bce020210e5e30e5ea30f07fa5e6e3..017b8a2c8c2cf97da9259cde84d09f67a9c5496b 100644 (file)
@@ -39,7 +39,7 @@
 (define_attr "cc" "none,set_czn,set_zn,set_n,compare,clobber"
   (const_string "none"))
 
-(define_attr "type" "branch,branch1,arith"
+(define_attr "type" "branch,branch1,arith,xcall"
   (const_string "arith"))
 
 (define_attr "mcu_enhanced" "yes,no"
                                           (le (minus (pc) (match_dup 0))
                                               (const_int 2043)))
                                      (const_int 3)
-                                     (const_int 4)))]
+                                     (const_int 4)))
+        (eq_attr "type" "xcall")
+        (if_then_else (eq_attr "mcu_mega" "no")
+                      (const_int 1)
+                      (const_int 2))]
         (const_int 2)))
 
 (define_insn "*pop1"
    (clobber (reg:QI 22))]
   "!AVR_ENHANCED"
   "%~call __mulqi3"
-  [(set (attr "length") (if_then_else (eq_attr "mcu_mega" "no")
-                                     (const_int 1)
-                                     (const_int 2)))
+  [(set_attr "type" "xcall")
    (set_attr "cc" "clobber")])
 
 (define_insn "mulqihi3"
    (clobber (reg:QI 21))]
   "!AVR_ENHANCED"
   "%~call __mulhi3"
-  [(set (attr "length") (if_then_else (eq_attr "mcu_mega" "no")
-                                     (const_int 1)
-                                     (const_int 2)))
+  [(set_attr "type" "xcall")
    (set_attr "cc" "clobber")])
 
 ;; Operand 2 (reg:SI 18) not clobbered on the enhanced core.
    (clobber (reg:HI 30))]
   "AVR_ENHANCED"
   "%~call __mulsi3"
-  [(set (attr "length") (if_then_else (eq_attr "mcu_mega" "no")
-                                     (const_int 1)
-                                     (const_int 2)))
+  [(set_attr "type" "xcall")
    (set_attr "cc" "clobber")])
 
 ; / % / % / % / % / % / % / % / % / % / % / % / % / % / % / % / % / % / % / %
    (clobber (reg:QI 23))]
   ""
   "%~call __divmodqi4"
-  [(set (attr "length") (if_then_else (eq_attr "mcu_mega" "no")
-                                     (const_int 1)
-                                     (const_int 2)))
+  [(set_attr "type" "xcall")
    (set_attr "cc" "clobber")])
 
 (define_expand "udivmodqi4"
    (clobber (reg:QI 23))]
   ""
   "%~call __udivmodqi4"
-  [(set (attr "length") (if_then_else (eq_attr "mcu_mega" "no")
-                                     (const_int 1)
-                                     (const_int 2)))
+  [(set_attr "type" "xcall")
    (set_attr "cc" "clobber")])
 
 (define_expand "divmodhi4"
    (clobber (reg:QI 21))]
   ""
   "%~call __divmodhi4"
-  [(set (attr "length") (if_then_else (eq_attr "mcu_mega" "no")
-                                     (const_int 1)
-                                     (const_int 2)))
+  [(set_attr "type" "xcall")
    (set_attr "cc" "clobber")])
 
 (define_expand "udivmodhi4"
    (clobber (reg:QI 21))]
   ""
   "%~call __udivmodhi4"
-  [(set (attr "length") (if_then_else (eq_attr "mcu_mega" "no")
-                                     (const_int 1)
-                                     (const_int 2)))
+  [(set_attr "type" "xcall")
    (set_attr "cc" "clobber")])
 
 (define_expand "divmodsi4"
    (clobber (reg:HI 30))]
   ""
   "%~call __divmodsi4"
-  [(set (attr "length") (if_then_else (eq_attr "mcu_mega" "no")
-                                     (const_int 1)
-                                     (const_int 2)))
+  [(set_attr "type" "xcall")
    (set_attr "cc" "clobber")])
 
 (define_expand "udivmodsi4"
    (clobber (reg:HI 30))]
   ""
   "%~call __udivmodsi4"
-  [(set (attr "length") (if_then_else (eq_attr "mcu_mega" "no")
-                                     (const_int 1)
-                                     (const_int 2)))
+  [(set_attr "type" "xcall")
    (set_attr "cc" "clobber")])
 
 ;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
index 769085ba7d55b5d861680f68c2d92c95b1e0b068..9df673e3f17cd24b45603365af02dce5f8b16d54 100644 (file)
@@ -49,9 +49,11 @@ MULTILIB_MATCHES = \
        mmcu?avr3=mmcu?atmega103 mmcu?avr3=mmcu?atmega603 \
        mmcu?avr3=mmcu?at43usb320 mmcu?avr3=at43usb355 \
        mmcu?avr3=mmcu?at76c711 \
-       mmcu?avr4=mmcu?atmega8515 mmcu?avr4=mmcu?atmega8 \
+       mmcu?avr4=mmcu?atmega8515 mmcu?avr4=mmcu?atmega8535 \
+       mmcu?avr4=mmcu?atmega8 \
        mmcu?avr5=mmcu?atmega161 mmcu?avr5=mmcu?atmega162 \
-       mmcu?avr5=mmcu?atmega163 mmcu?avr5=mmcu?atmega16 \
+       mmcu?avr5=mmcu?atmega163 mmcu?avr5=mmcu?atmega169 \
+       mmcu?avr5=mmcu?atmega16 \
        mmcu?avr5=mmcu?atmega323 mmcu?avr5=mmcu?atmega32 \
        mmcu?avr5=mmcu?atmega64  mmcu?avr5=mmcu?atmega128 \
        mmcu?avr5=mmcu?at94k