diff options
author | Joern Rennecke <amylaar@spamcop.net> | 2010-11-12 10:09:39 +0000 |
---|---|---|
committer | Joern Rennecke <amylaar@gcc.gnu.org> | 2010-11-12 10:09:39 +0000 |
commit | 3f02a5f3d3c8609d617dee98f8945b4f1a1a4367 (patch) | |
tree | fefbbb6697b3066a3b199ee42edf4a9c0280cf77 /gcc | |
parent | 4e0084e4383a20c08ddc72177aca77c195261137 (diff) | |
download | gcc-3f02a5f3d3c8609d617dee98f8945b4f1a1a4367.zip gcc-3f02a5f3d3c8609d617dee98f8945b4f1a1a4367.tar.gz gcc-3f02a5f3d3c8609d617dee98f8945b4f1a1a4367.tar.bz2 |
re PR target/46430 (avr-elf --enable-werror-always build fails)
PR target/46430
* config/avr/avr-protos.h (avr_return_addr_rtx): Update prototype.
* config/avr/driver-avr.c (avr_device_to_arch): Always return value.
(avr_device_to_data_start, avr_device_to_startfiles): Likewise.
(avr_device_to_devicelib): Likewise.
* config/avr/avr.md (zero_extendqihi2): Put variable declarations
into block.
(zero_extendqisi2, zero_extendhisi2, zero_extendqidi2): Likewise.
(zero_extendhidi2, zero_extendsidi2): Likewise.
* config/avr/avr.c (avr_num_arg_regs): Constify type.
(avr_return_addr_rtx): De-constify tem.
(avr_rotate_bytes): Move declarations to start of block.
Don't use variable length array.
Put nested if/else into block.
From-SVN: r166647
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 17 | ||||
-rw-r--r-- | gcc/config/avr/avr-protos.h | 2 | ||||
-rw-r--r-- | gcc/config/avr/avr.c | 48 | ||||
-rw-r--r-- | gcc/config/avr/avr.md | 78 | ||||
-rwxr-xr-x | gcc/config/avr/driver-avr.c | 8 |
5 files changed, 92 insertions, 61 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5607e75..b6afd94 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +2010-11-12 Joern Rennecke <amylaar@spamcop.net> + + PR target/46430 + * config/avr/avr-protos.h (avr_return_addr_rtx): Update prototype. + * config/avr/driver-avr.c (avr_device_to_arch): Always return value. + (avr_device_to_data_start, avr_device_to_startfiles): Likewise. + (avr_device_to_devicelib): Likewise. + * config/avr/avr.md (zero_extendqihi2): Put variable declarations + into block. + (zero_extendqisi2, zero_extendhisi2, zero_extendqidi2): Likewise. + (zero_extendhidi2, zero_extendsidi2): Likewise. + * config/avr/avr.c (avr_num_arg_regs): Constify type. + (avr_return_addr_rtx): De-constify tem. + (avr_rotate_bytes): Move declarations to start of block. + Don't use variable length array. + Put nested if/else into block. + 2010-11-12 Eric Botcazou <ebotcazou@adacore.com> PR debug/46375 diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index 7469856..4569359 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -33,7 +33,7 @@ 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 rtx avr_return_addr_rtx (int count, const_rtx tem); +extern rtx avr_return_addr_rtx (int count, rtx tem); #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 2af5cbf..9e18b00 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -60,7 +60,7 @@ static int get_sequence_length (rtx insns); static int sequent_regs_live (void); static const char *ptrreg_to_str (int); static const char *cond_string (enum rtx_code); -static int avr_num_arg_regs (enum machine_mode, tree); +static int avr_num_arg_regs (enum machine_mode, const_tree); static RTX_CODE compare_condition (rtx insn); static rtx avr_legitimize_address (rtx, rtx, enum machine_mode); @@ -436,7 +436,7 @@ rtx avr_builtin_setjmp_frame_value (void) /* Return contents of MEM at frame pointer + stack size + 1 (+2 if 3 byte PC). This is return address of function. */ rtx -avr_return_addr_rtx (int count, const_rtx tem) +avr_return_addr_rtx (int count, rtx tem) { rtx r; @@ -1566,7 +1566,7 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype, rtx libname, /* Returns the number of registers to allocate for a function argument. */ static int -avr_num_arg_regs (enum machine_mode mode, tree type) +avr_num_arg_regs (enum machine_mode mode, const_tree type) { int size; @@ -4256,6 +4256,8 @@ avr_rotate_bytes (rtx operands[]) /* Work out if byte or word move is needed. Odd byte rotates need QImode. Word move if no scratch is needed, otherwise use size of scratch. */ enum machine_mode move_mode = QImode; + int move_size, offset, size; + if (num & 0xf) move_mode = QImode; else if ((mode == SImode && !same_reg) || !overlapped) @@ -4271,11 +4273,11 @@ avr_rotate_bytes (rtx operands[]) if (GET_MODE (scratch) == HImode && move_mode == QImode) scratch = simplify_gen_subreg (move_mode, scratch, HImode, 0); - int move_size = GET_MODE_SIZE (move_mode); + move_size = GET_MODE_SIZE (move_mode); /* Number of bytes/words to rotate. */ - int offset = (num >> 3) / move_size; + offset = (num >> 3) / move_size; /* Number of moves needed. */ - int size = GET_MODE_SIZE (mode) / move_size; + size = GET_MODE_SIZE (mode) / move_size; /* Himode byte swap is special case to avoid a scratch register. */ if (mode == HImode && same_reg) { @@ -4292,12 +4294,15 @@ avr_rotate_bytes (rtx operands[]) } else { +#define MAX_SIZE 8 /* GET_MODE_SIZE (DImode) / GET_MODE_SIZE (QImode) */ /* Create linked list of moves to determine move order. */ struct { rtx src, dst; int links; - } move[size + 8]; + } move[MAX_SIZE + 8]; + int blocked, moves; + gcc_assert (size <= MAX_SIZE); /* Generate list of subreg moves. */ for (i = 0; i < size; i++) { @@ -4323,8 +4328,8 @@ avr_rotate_bytes (rtx operands[]) break; } - int blocked = -1; - int moves = 0; + blocked = -1; + moves = 0; /* Go through move list and perform non-conflicting moves. As each non-overlapping move is made, it may remove other conflicts so the process is repeated until no conflicts remain. */ @@ -4336,18 +4341,21 @@ avr_rotate_bytes (rtx operands[]) src already. */ for (i = 0; i < size; i++) if (move[i].src != NULL_RTX) - if (move[i].links == -1 || move[move[i].links].src == NULL_RTX) - { - moves++; - /* Ignore NOP moves to self. */ - if (!rtx_equal_p (move[i].dst, move[i].src)) - emit_move_insn (move[i].dst, move[i].src); + { + if (move[i].links == -1 + || move[move[i].links].src == NULL_RTX) + { + moves++; + /* Ignore NOP moves to self. */ + if (!rtx_equal_p (move[i].dst, move[i].src)) + emit_move_insn (move[i].dst, move[i].src); - /* Remove conflict from list. */ - move[i].src = NULL_RTX; - } - else - blocked = i; + /* Remove conflict from list. */ + move[i].src = NULL_RTX; + } + else + blocked = i; + } /* Check for deadlock. This is when no moves occurred and we have at least one blocked move. */ diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index 70b7735..f086e80 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -2077,12 +2077,13 @@ "reload_completed" [(set (match_dup 2) (match_dup 1)) (set (match_dup 3) (const_int 0))] - "unsigned int low_off = subreg_lowpart_offset (QImode, HImode); - unsigned int high_off = subreg_highpart_offset (QImode, HImode); - - operands[2] = simplify_gen_subreg (QImode, operands[0], HImode, low_off); - operands[3] = simplify_gen_subreg (QImode, operands[0], HImode, high_off); - ") +{ + unsigned int low_off = subreg_lowpart_offset (QImode, HImode); + unsigned int high_off = subreg_highpart_offset (QImode, HImode); + + operands[2] = simplify_gen_subreg (QImode, operands[0], HImode, low_off); + operands[3] = simplify_gen_subreg (QImode, operands[0], HImode, high_off); +}) (define_insn_and_split "zero_extendqisi2" [(set (match_operand:SI 0 "register_operand" "=r") @@ -2092,12 +2093,13 @@ "reload_completed" [(set (match_dup 2) (zero_extend:HI (match_dup 1))) (set (match_dup 3) (const_int 0))] - "unsigned int low_off = subreg_lowpart_offset (HImode, SImode); - unsigned int high_off = subreg_highpart_offset (HImode, SImode); - - operands[2] = simplify_gen_subreg (HImode, operands[0], SImode, low_off); - operands[3] = simplify_gen_subreg (HImode, operands[0], SImode, high_off); - ") +{ + unsigned int low_off = subreg_lowpart_offset (HImode, SImode); + unsigned int high_off = subreg_highpart_offset (HImode, SImode); + + operands[2] = simplify_gen_subreg (HImode, operands[0], SImode, low_off); + operands[3] = simplify_gen_subreg (HImode, operands[0], SImode, high_off); +}) (define_insn_and_split "zero_extendhisi2" [(set (match_operand:SI 0 "register_operand" "=r") @@ -2107,12 +2109,13 @@ "reload_completed" [(set (match_dup 2) (match_dup 1)) (set (match_dup 3) (const_int 0))] - "unsigned int low_off = subreg_lowpart_offset (HImode, SImode); - unsigned int high_off = subreg_highpart_offset (HImode, SImode); - - operands[2] = simplify_gen_subreg (HImode, operands[0], SImode, low_off); - operands[3] = simplify_gen_subreg (HImode, operands[0], SImode, high_off); - ") +{ + unsigned int low_off = subreg_lowpart_offset (HImode, SImode); + unsigned int high_off = subreg_highpart_offset (HImode, SImode); + + operands[2] = simplify_gen_subreg (HImode, operands[0], SImode, low_off); + operands[3] = simplify_gen_subreg (HImode, operands[0], SImode, high_off); +}) (define_insn_and_split "zero_extendqidi2" [(set (match_operand:DI 0 "register_operand" "=r") @@ -2122,12 +2125,13 @@ "reload_completed" [(set (match_dup 2) (zero_extend:SI (match_dup 1))) (set (match_dup 3) (const_int 0))] - "unsigned int low_off = subreg_lowpart_offset (SImode, DImode); - unsigned int high_off = subreg_highpart_offset (SImode, DImode); - - operands[2] = simplify_gen_subreg (SImode, operands[0], DImode, low_off); - operands[3] = simplify_gen_subreg (SImode, operands[0], DImode, high_off); - ") +{ + unsigned int low_off = subreg_lowpart_offset (SImode, DImode); + unsigned int high_off = subreg_highpart_offset (SImode, DImode); + + operands[2] = simplify_gen_subreg (SImode, operands[0], DImode, low_off); + operands[3] = simplify_gen_subreg (SImode, operands[0], DImode, high_off); +}) (define_insn_and_split "zero_extendhidi2" [(set (match_operand:DI 0 "register_operand" "=r") @@ -2137,12 +2141,13 @@ "reload_completed" [(set (match_dup 2) (zero_extend:SI (match_dup 1))) (set (match_dup 3) (const_int 0))] - "unsigned int low_off = subreg_lowpart_offset (SImode, DImode); - unsigned int high_off = subreg_highpart_offset (SImode, DImode); - - operands[2] = simplify_gen_subreg (SImode, operands[0], DImode, low_off); - operands[3] = simplify_gen_subreg (SImode, operands[0], DImode, high_off); - ") +{ + unsigned int low_off = subreg_lowpart_offset (SImode, DImode); + unsigned int high_off = subreg_highpart_offset (SImode, DImode); + + operands[2] = simplify_gen_subreg (SImode, operands[0], DImode, low_off); + operands[3] = simplify_gen_subreg (SImode, operands[0], DImode, high_off); +}) (define_insn_and_split "zero_extendsidi2" [(set (match_operand:DI 0 "register_operand" "=r") @@ -2152,12 +2157,13 @@ "reload_completed" [(set (match_dup 2) (match_dup 1)) (set (match_dup 3) (const_int 0))] - "unsigned int low_off = subreg_lowpart_offset (SImode, DImode); - unsigned int high_off = subreg_highpart_offset (SImode, DImode); - - operands[2] = simplify_gen_subreg (SImode, operands[0], DImode, low_off); - operands[3] = simplify_gen_subreg (SImode, operands[0], DImode, high_off); - ") +{ + unsigned int low_off = subreg_lowpart_offset (SImode, DImode); + unsigned int high_off = subreg_highpart_offset (SImode, DImode); + + operands[2] = simplify_gen_subreg (SImode, operands[0], DImode, low_off); + operands[3] = simplify_gen_subreg (SImode, operands[0], DImode, high_off); +}) ;;<=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=> ;; compare diff --git a/gcc/config/avr/driver-avr.c b/gcc/config/avr/driver-avr.c index 218c406..55af6516d 100755 --- a/gcc/config/avr/driver-avr.c +++ b/gcc/config/avr/driver-avr.c @@ -55,7 +55,7 @@ const char * avr_device_to_arch (int argc, const char **argv) { if (0 == argc) - return; + return NULL; avr_set_current_device (argv[0]); @@ -71,7 +71,7 @@ avr_device_to_data_start (int argc, const char **argv) char data_section_start_str[16]; if (0 == argc) - return; + return NULL; avr_set_current_device (argv[0]); @@ -93,7 +93,7 @@ const char * avr_device_to_startfiles (int argc, const char **argv) { if (0 == argc) - return; + return NULL; avr_set_current_device (argv[0]); @@ -106,7 +106,7 @@ const char * avr_device_to_devicelib (int argc, const char **argv) { if (0 == argc) - return; + return NULL; avr_set_current_device (argv[0]); |