aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatoly Sokolov <aesok@post.ru>2009-08-16 20:22:59 +0400
committerAnatoly Sokolov <aesok@gcc.gnu.org>2009-08-16 20:22:59 +0400
commit164709cfe671e51fcf6c687847549f01a51366c4 (patch)
tree0cdb00299fb3e8a4e891564994fd9d7be7ad49c0
parent354ebf88ee1806c4d9b279c765d2d344303ffc66 (diff)
downloadgcc-164709cfe671e51fcf6c687847549f01a51366c4.zip
gcc-164709cfe671e51fcf6c687847549f01a51366c4.tar.gz
gcc-164709cfe671e51fcf6c687847549f01a51366c4.tar.bz2
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
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/config/avr/avr.c23
-rw-r--r--gcc/config/avr/avr.h1
3 files changed, 28 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 43bcfb0..f1317f0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2009-08-16 Anatoly Sokolov <aesok@post.ru>
+
+ * 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 <dodji@redhat.com>
PR debug/37801
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index e715e39..d08d89f 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 7375246..7100ad1 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)