diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fc844b829b0..59c5f77e761 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2000-11-18 Marek Michalkiewicz + + * config/avr/avr-protos.h (avr_output_addr_vec_elt): Prototype. + * config/avr/avr.c (jump_tables_size): New variable. + (function_prologue): Initialize it as 0. + (function_epilogue): Add it to function_size. + (avr_output_addr_vec_elt): New function. Count words in jump + tables in jump_tables_size. Move code ... + * config/avr/avr.h (ASM_OUTPUT_ADDR_VEC_ELT): ... from here. + Call avr_output_addr_vec_elt instead. + * config/avr/avr.md (tablejump): Remove disabled define_expand. + 2000-11-18 Mark Mitchell * configure.in: Make --enable-new-gxx-abi the default. diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index 14d34d18d61..4fa887a5fd4 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -110,6 +110,7 @@ extern const char * lshrhi3_out PARAMS ((rtx insn, rtx operands[], int *len)); extern const char * lshrsi3_out PARAMS ((rtx insn, rtx operands[], int *len)); extern void avr_output_bld PARAMS ((rtx operands[], int bit_nr)); +extern void avr_output_addr_vec_elt PARAMS ((FILE *stream, int value)); extern enum reg_class preferred_reload_class PARAMS ((rtx x, enum reg_class class)); diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 38cd07819e1..9427de76519 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -88,6 +88,9 @@ static int commands_in_epilogues; static int prologue_size; static int epilogue_size; +/* Size of all jump tables in the current function, in words. */ +static int jump_tables_size; + /* Initial stack value specified by the `-minit-stack=' option */ const char *avr_init_stack = "__stack"; @@ -549,6 +552,7 @@ function_prologue (file, size) && !interrupt_func_p && !signal_func_p && live_seq); last_insn_address = 0; + jump_tables_size = 0; prologue_size = 0; fprintf (file, "/* prologue: frame size=%d */\n", size); @@ -683,6 +687,7 @@ function_epilogue (file, size) main_p = MAIN_NAME_P (DECL_NAME (current_function_decl)); function_size = (INSN_ADDRESSES (INSN_UID (get_last_insn ())) - INSN_ADDRESSES (INSN_UID (get_insns ()))); + function_size += jump_tables_size; live_seq = sequent_regs_live (); minimize = (TARGET_CALL_PROLOGUES && !interrupt_func_p && !signal_func_p && live_seq); @@ -5296,3 +5301,16 @@ avr_output_bld (operands, bit_nr) output_asm_insn (s, operands); } +void +avr_output_addr_vec_elt (stream, value) + FILE *stream; + int value; +{ + if (AVR_MEGA) + fprintf (stream, "\t.word pm(.L%d)\n", value); + else + fprintf (stream, "\trjmp .L%d\n", value); + + jump_tables_size++; +} + diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index f5116a92a17..897dffee267 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -2713,12 +2713,7 @@ sprintf (STRING, "*.%s%d", PREFIX, NUM) not be optimal, since this macro is used only when profiling. */ #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \ -do { \ - if (AVR_MEGA) \ - fprintf (STREAM, "\t.word pm(.L%d)\n", VALUE); \ - else \ - fprintf (STREAM, "\trjmp .L%d\n", VALUE); \ -} while (0) + avr_output_addr_vec_elt(STREAM, VALUE) /* This macro should be provided on machines where the addresses in a dispatch table are absolute. diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index 325a545fcd8..57972e61566 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -1849,11 +1849,6 @@ (set_attr "cc" "none,none")]) ;; table jump -(define_expand "tablejump" - [(parallel [(set (pc) (match_operand:HI 0 "register_operand" "")) - (use (label_ref (match_operand 1 "" "")))])] - "0 && optimize" - "") ;; Note: the (mem:HI (...)) memory references here are special - actually ;; the data is read from a word address in program memory (r31:r30 is the