From: Anatoly Sokolov Date: Sun, 16 Aug 2009 16:22:59 +0000 (+0400) Subject: avr.h (AVR_HAVE_8BIT_SP): New macros. X-Git-Tag: releases/gcc-4.5.0~4001 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=164709cfe671e51fcf6c687847549f01a51366c4;p=thirdparty%2Fgcc.git avr.h (AVR_HAVE_8BIT_SP): New macros. * config/avr/avr.h (AVR_HAVE_8BIT_SP): New macros. * config/avr/avr.c (avr_override_options): Initialize avr_current_arch variable. (avr_cpu_cpp_builtins): Define __AVR_HAVE_8BIT_SP__ or __AVR_HAVE_16BIT_SP__ according to the device type. (expand_prologue, output_movhi): Use AVR_HAVE_8BIT_SP instead of TARGET_TINY_STACK. (expand_epilogue): Use correct QI mode frame pointer for tiny stack. Use AVR_HAVE_8BIT_SP instead of TARGET_TINY_STACK. From-SVN: r150801 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 43bcfb0a511c..f1317f0ba64a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2009-08-16 Anatoly Sokolov + + * config/avr/avr.h (AVR_HAVE_8BIT_SP): New macros. + * config/avr/avr.c (avr_override_options): Initialize + avr_current_arch variable. + (avr_cpu_cpp_builtins): Define __AVR_HAVE_8BIT_SP__ or + __AVR_HAVE_16BIT_SP__ according to the device type. + (expand_prologue, output_movhi): Use AVR_HAVE_8BIT_SP instead of + TARGET_TINY_STACK. + (expand_epilogue): Use correct QI mode frame pointer for tiny stack. + Use AVR_HAVE_8BIT_SP instead of TARGET_TINY_STACK. + 2009-08-16 Dodji Seketeli PR debug/37801 diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index e715e39fe382..d08d89fb697f 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -213,8 +213,9 @@ avr_override_options (void) fprintf (stderr," %s\n", t->name); } - avr_current_arch = &avr_arch_types[t->arch]; - avr_extra_arch_macro = t->macro; + avr_current_device = t; + avr_current_arch = &avr_arch_types[avr_current_device->arch]; + avr_extra_arch_macro = avr_current_device->macro; tmp_reg_rtx = gen_rtx_REG (QImode, TMP_REGNO); zero_reg_rtx = gen_rtx_REG (QImode, ZERO_REGNO); @@ -265,6 +266,12 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile) { cpp_define (pfile, "__AVR_2_BYTE_PC__"); } + + if (avr_current_device->short_sp) + cpp_define (pfile, "__AVR_HAVE_8BIT_SP__"); + else + cpp_define (pfile, "__AVR_HAVE_16BIT_SP__"); + if (TARGET_NO_INTERRUPTS) cpp_define (pfile, "__NO_INTERRUPTS__"); } @@ -672,7 +679,7 @@ expand_prologue (void) rtx fp_plus_insns; rtx sp_plus_insns = NULL_RTX; - if (TARGET_TINY_STACK) + if (AVR_HAVE_8BIT_SP) { /* The high byte (r29) doesn't change - prefer 'subi' (1 cycle) over 'sbiw' (2 cycles, same size). */ @@ -698,7 +705,7 @@ expand_prologue (void) RTX_FRAME_RELATED_P (insn) = 1; /* Copy to stack pointer. */ - if (TARGET_TINY_STACK) + if (AVR_HAVE_8BIT_SP) { insn = emit_move_insn (stack_pointer_rtx, frame_pointer_rtx); RTX_FRAME_RELATED_P (insn) = 1; @@ -852,7 +859,7 @@ expand_epilogue (void) rtx fp_plus_insns; rtx sp_plus_insns = NULL_RTX; - if (TARGET_TINY_STACK) + if (AVR_HAVE_8BIT_SP) { /* The high byte (r29) doesn't change - prefer 'subi' (1 cycle) over 'sbiw' (2 cycles, same size). */ @@ -868,12 +875,12 @@ expand_epilogue (void) start_sequence (); emit_move_insn (myfp, - gen_rtx_PLUS (HImode, myfp, + gen_rtx_PLUS (GET_MODE (myfp), myfp, gen_int_mode (size, GET_MODE(myfp)))); /* Copy to stack pointer. */ - if (TARGET_TINY_STACK) + if (AVR_HAVE_8BIT_SP) { emit_move_insn (stack_pointer_rtx, frame_pointer_rtx); } @@ -1686,7 +1693,7 @@ output_movhi (rtx insn, rtx operands[], int *l) { if (test_hard_reg_class (STACK_REG, dest)) { - if (TARGET_TINY_STACK) + if (AVR_HAVE_8BIT_SP) return *l = 1, AS2 (out,__SP_L__,%A1); /* Use simple load of stack pointer if no interrupts are used. */ diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index 73752467e086..7100ad17fe8c 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -114,6 +114,7 @@ extern GTY(()) section *progmem_section; #define AVR_HAVE_LPMX (avr_current_arch->have_movw_lpmx) #define AVR_HAVE_RAMPZ (avr_current_arch->have_elpm) #define AVR_HAVE_EIJMP_EICALL (avr_current_arch->have_eijmp_eicall) +#define AVR_HAVE_8BIT_SP (avr_current_device->short_sp || TARGET_TINY_STACK) #define AVR_2_BYTE_PC (!AVR_HAVE_EIJMP_EICALL) #define AVR_3_BYTE_PC (AVR_HAVE_EIJMP_EICALL)