summaryrefslogtreecommitdiff
path: root/gcc/config/avr
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-27 12:45:13 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-27 12:45:13 +0000
commit268b9e9e95f56a59a8817b28ad59b53f40fc668d (patch)
tree5e9529982daf11d5b3ab800d4c58bc3fbee99d28 /gcc/config/avr
parente1910362719612f58bd1ea5050fa7a5175036abc (diff)
downloadgcc-268b9e9e95f56a59a8817b28ad59b53f40fc668d.tar.gz
2009-04-27 Basile Starynkevitch <basile@starynkevitch.net>
MERGED WITH TRUNK r146824:: * gcc/basilys.h: all GTY goes before the identifiers. * gcc/basilys.c: removed errors.h include. * gcc/run-basilys.h: ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@146839 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/avr')
-rw-r--r--gcc/config/avr/avr-protos.h1
-rw-r--r--gcc/config/avr/avr.c3
-rw-r--r--gcc/config/avr/avr.h6
-rw-r--r--gcc/config/avr/avr.md77
-rw-r--r--gcc/config/avr/libgcc.S23
-rw-r--r--gcc/config/avr/t-avr19
6 files changed, 89 insertions, 40 deletions
diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index cb936efb6fd..2df4a16d1cf 100644
--- a/gcc/config/avr/avr-protos.h
+++ b/gcc/config/avr/avr-protos.h
@@ -39,7 +39,6 @@ extern int avr_simple_epilogue (void);
extern void gas_output_limited_string (FILE *file, const char *str);
extern void gas_output_ascii (FILE *file, const char *str, size_t length);
extern int avr_hard_regno_rename_ok (unsigned int, unsigned int);
-extern unsigned int avr_case_values_threshold (void);
#ifdef TREE_CODE
extern void asm_output_external (FILE *file, tree decl, char *name);
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index e868a97bed4..40835c70f51 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -87,6 +87,7 @@ static bool avr_return_in_memory (const_tree, const_tree);
static struct machine_function * avr_init_machine_status (void);
static rtx avr_builtin_setjmp_frame_value (void);
static bool avr_hard_regno_scratch_ok (unsigned int);
+static unsigned int avr_case_values_threshold (void);
/* Allocate registers from r25 to r8 for parameters for function calls. */
#define FIRST_CUM_REG 26
@@ -359,6 +360,8 @@ static const struct mcu_type_s avr_mcu_types[] = {
#undef TARGET_HARD_REGNO_SCRATCH_OK
#define TARGET_HARD_REGNO_SCRATCH_OK avr_hard_regno_scratch_ok
+#undef TARGET_CASE_VALUES_THRESHOLD
+#define TARGET_CASE_VALUES_THRESHOLD avr_case_values_threshold
struct gcc_target targetm = TARGET_INITIALIZER;
diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index f09e8ecaa59..5d50827144b 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -494,8 +494,6 @@ do { \
} \
} while(0)
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
-
#define LEGITIMATE_CONSTANT_P(X) 1
#define REGISTER_MOVE_COST(MODE, FROM, TO) ((FROM) == STACK_REG ? 6 \
@@ -734,8 +732,6 @@ fprintf (STREAM, "\t.skip %lu,0\n", (unsigned long)(N))
#define CASE_VECTOR_MODE HImode
-#define CASE_VALUES_THRESHOLD avr_case_values_threshold ()
-
#undef WORD_REGISTER_OPERATIONS
#define MOVE_MAX 4
@@ -1092,7 +1088,7 @@ mmcu=*:-mmcu=%*}"
/* A C structure for machine-specific, per-function data.
This is added to the cfun structure. */
-struct machine_function GTY(())
+struct GTY(()) machine_function
{
/* 'true' - if the current function is a leaf function. */
int is_leaf;
diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md
index 309b028589d..269e2c5ddb5 100644
--- a/gcc/config/avr/avr.md
+++ b/gcc/config/avr/avr.md
@@ -1478,7 +1478,7 @@
(rotate:SI (match_operand:SI 1 "register_operand" "r")
(const_int 16)))]
""
- "{mov __tmp_reg__,%A0\;mov %A0,%D0\;mov %D0, __tmp_reg__\;mov __tmp_reg__,%B0\;mov %B0,%C0\;mov %C0, __tmp_reg__|movw __tmp_reg__,%A0\;movw %A0,%C0\;movw %C0, __tmp_reg__\;clr __zero_reg__}"
+ "{mov __tmp_reg__,%A1\;mov %A0,%C1\;mov %C0, __tmp_reg__\;mov __tmp_reg__,%B1\;mov %B0,%D1\;mov %D0, __tmp_reg__|movw __tmp_reg__,%A1\;movw %A0,%C1\;movw %C0, __tmp_reg__\;clr __zero_reg__}"
"reload_completed
&& REGNO (operands[0]) != REGNO (operands[1])"
[(set (match_dup 2) (match_dup 5))
@@ -1490,7 +1490,18 @@
operands[3] = simplify_gen_subreg (HImode, operands[0], SImode, si_hi_off);
operands[4] = simplify_gen_subreg (HImode, operands[1], SImode, si_lo_off);
- operands[5] = simplify_gen_subreg (HImode, operands[1], SImode, si_hi_off);"
+ operands[5] = simplify_gen_subreg (HImode, operands[1], SImode, si_hi_off);
+
+ if (REGNO (operands[0]) == REGNO(operands[1]) + 2)
+ {
+ emit_move_insn (operands[3], operands[4]);
+ DONE;
+ }
+ else if (REGNO (operands[0]) == REGNO(operands[1]) - 2)
+ {
+ emit_move_insn (operands[2], operands[5]);
+ DONE;
+ }"
[(set (attr "length") (if_then_else (eq_attr "mcu_have_movw" "yes")
(const_int 4)
(const_int 6)))
@@ -1503,17 +1514,14 @@
(rotate:SI (match_operand:SI 1 "register_operand" "r")
(const_int 8)))]
""
- "mov __tmp_reg__,%D0
- mov %D0,%C0
- mov %C0,%B0
- mov %B0,%A0
+ "mov __tmp_reg__,%D1
+ mov %D0,%C1
+ mov %C0,%B1
+ mov %B0,%A1
mov %A0, __tmp_reg__"
"reload_completed
&& REGNO (operands[0]) != REGNO (operands[1])"
- [(set (match_dup 2) (match_dup 9))
- (set (match_dup 3) (match_dup 6))
- (set (match_dup 4) (match_dup 7))
- (set (match_dup 5) (match_dup 8))]
+ [(const_int 0)]
"unsigned int si_lo_off = subreg_lowpart_offset (HImode, SImode);
unsigned int si_hi_off = subreg_highpart_offset (HImode, SImode);
unsigned int hi_lo_off = subreg_lowpart_offset (QImode, HImode);
@@ -1531,7 +1539,23 @@
operands[7] = simplify_gen_subreg (QImode, operands[6], HImode, hi_hi_off);
operands[6] = simplify_gen_subreg (QImode, operands[6], HImode, hi_lo_off);
operands[9] = simplify_gen_subreg (QImode, operands[8], HImode, hi_hi_off);
- operands[8] = simplify_gen_subreg (QImode, operands[8], HImode, hi_lo_off);"
+ operands[8] = simplify_gen_subreg (QImode, operands[8], HImode, hi_lo_off);
+
+ if (REGNO (operands[0]) < REGNO(operands[1]))
+ {
+ emit_move_insn (operands[2], operands[9]);
+ emit_move_insn (operands[3], operands[6]);
+ emit_move_insn (operands[4], operands[7]);
+ emit_move_insn (operands[5], operands[8]);
+ }
+ else
+ {
+ emit_move_insn (operands[5], operands[8]);
+ emit_move_insn (operands[2], operands[9]);
+ emit_move_insn (operands[4], operands[7]);
+ emit_move_insn (operands[3], operands[6]);
+ }
+ DONE;"
[(set_attr "length" "5")
(set_attr "cc" "none")])
@@ -1540,17 +1564,14 @@
(rotate:SI (match_operand:SI 1 "register_operand" "r")
(const_int 24)))]
""
- "mov __tmp_reg__,%A0
- mov %A0,%B0
- mov %B0,%C0
- mov %C0,%D0
+ "mov __tmp_reg__,%A1
+ mov %A0,%B1
+ mov %B0,%C1
+ mov %C0,%D1
mov %D0, __tmp_reg__"
"reload_completed
&& REGNO (operands[0]) != REGNO (operands[1])"
- [(set (match_dup 2) (match_dup 7))
- (set (match_dup 3) (match_dup 8))
- (set (match_dup 4) (match_dup 9))
- (set (match_dup 5) (match_dup 6))]
+ [(const_int 0)]
"unsigned int si_lo_off = subreg_lowpart_offset (HImode, SImode);
unsigned int si_hi_off = subreg_highpart_offset (HImode, SImode);
unsigned int hi_lo_off = subreg_lowpart_offset (QImode, HImode);
@@ -1568,7 +1589,23 @@
operands[7] = simplify_gen_subreg (QImode, operands[6], HImode, hi_hi_off);
operands[6] = simplify_gen_subreg (QImode, operands[6], HImode, hi_lo_off);
operands[9] = simplify_gen_subreg (QImode, operands[8], HImode, hi_hi_off);
- operands[8] = simplify_gen_subreg (QImode, operands[8], HImode, hi_lo_off);"
+ operands[8] = simplify_gen_subreg (QImode, operands[8], HImode, hi_lo_off);
+
+ if (REGNO (operands[0]) < REGNO(operands[1]))
+ {
+ emit_move_insn (operands[2], operands[7]);
+ emit_move_insn (operands[5], operands[6]);
+ emit_move_insn (operands[3], operands[8]);
+ emit_move_insn (operands[4], operands[9]);
+ }
+ else
+ {
+ emit_move_insn (operands[5], operands[6]);
+ emit_move_insn (operands[4], operands[9]);
+ emit_move_insn (operands[3], operands[8]);
+ emit_move_insn (operands[2], operands[7]);
+ }
+ DONE;"
[(set_attr "length" "5")
(set_attr "cc" "none")])
diff --git a/gcc/config/avr/libgcc.S b/gcc/config/avr/libgcc.S
index 14bd1d37a50..b6262b338dd 100644
--- a/gcc/config/avr/libgcc.S
+++ b/gcc/config/avr/libgcc.S
@@ -5,27 +5,22 @@
This file is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2, or (at your option) any
+Free Software Foundation; either version 3, or (at your option) any
later version.
-In addition to the permissions in the GNU General Public License, the
-Free Software Foundation gives you unlimited permission to link the
-compiled version of this file into combinations with other programs,
-and to distribute those combinations without any restriction coming
-from the use of this file. (The General Public License restrictions
-do apply in other respects; for example, they cover modification of
-the file, and distribution when not linked into a combine
-executable.)
-
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. */
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
#define __zero_reg__ r1
#define __tmp_reg__ r0
diff --git a/gcc/config/avr/t-avr b/gcc/config/avr/t-avr
index 7513b3d4afb..c78b00db9a9 100644
--- a/gcc/config/avr/t-avr
+++ b/gcc/config/avr/t-avr
@@ -1,3 +1,22 @@
+# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+# 2009 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
LIB1ASMSRC = avr/libgcc.S
LIB1ASMFUNCS = \
_mulqi3 \