Hi,

it seems that ".L_FrameOffset_" __FUNCTION__
gets calculated wrong if "far Data" is enabled - the compiler generates
pushm.a instructions, but does not take the extra stack space into account.
The effect: _BI?_SR_IRQ(x) macros do not work.


The attached patch corrects this behaviour.

diff -ruNp gcc-3.2.3-orig/gcc/config/msp430/msp430.c 
gcc-3.2.3/gcc/config/msp430/msp430.c
--- gcc/gcc-3.3/gcc/config/msp430/msp430.c      2009-04-16 18:56:58.375793000 
+0200
+++ gcc/gcc-3.3/gcc/config/msp430/msp430.c      2009-05-08 18:39:52.188591800 
+0200
@@ -2520,6 +2520,7 @@ initial_elimination_offset (from, to)
       int cfp = msp430_critical_function_p (current_function_decl);
       int leaf_func_p = leaf_function_p ();
       int offset = interrupt_func_p ? 0 : (cfp ? 2 : 0);
+      int regsize =  target_mcu.regs_size==REGS_16BITS? 2:4 ;
 
       for (reg = 4; reg < 16; ++reg)
        {
@@ -2527,7 +2528,7 @@ initial_elimination_offset (from, to)
              || (regs_ever_live[reg]
                  && (!call_used_regs[reg] || interrupt_func_p)))
            {
-             offset += 2;
+             offset += regsize;
            }
        }
       return get_frame_size () + offset + 2;

Reply via email to