Hi All,

Well I think this patch fixes it..

Does someone want to test it and put it into the CVS?

Regards,

Peter Jansen
diff -rU 3 gcc/gcc-3.3/gcc/config/msp430/msp430.c 
gcc-patched/gcc-3.3/gcc/config/msp430/msp430.c
--- gcc/gcc-3.3/gcc/config/msp430/msp430.c      2005-03-18 01:08:46.000000000 
+1100
+++ gcc-patched/gcc-3.3/gcc/config/msp430/msp430.c      2005-12-17 
19:03:28.000000000 +1100
@@ -1325,6 +1325,10 @@
 
          print_sub_operand (file, XEXP (addr, 1), code);
 
+          /* shift if the indirect pointer register is the stack pointer */
+          if ((code >= 'M' && code <= 'N') && (REGNO (XEXP (addr, 0)) == 1))
+            shift = code - 'M';
+
          if (shift)
            fprintf (file, "+%d", shift * ml);
 
diff -rU 3 gcc/gcc-3.3/gcc/config/msp430/msp430.md 
gcc-patched/gcc-3.3/gcc/config/msp430/msp430.md
--- gcc/gcc-3.3/gcc/config/msp430/msp430.md     2004-08-10 22:59:05.000000000 
+1000
+++ gcc-patched/gcc-3.3/gcc/config/msp430/msp430.md     2005-12-17 
19:03:33.000000000 +1100
@@ -28,6 +28,8 @@
 ;;  D     3                6
 ;;  E  adds nothing to reg but used only with (mem:hi (reg:hi))
 ;;  F  no trim array
+;;  M  Add 0 to address is using stack pointer
+;;  N  Add 2 to address is using stack pointer
 ;;  Extra constarains:
 ;;  P  hardware constants: -1,0,+1,+2,+4,+8
 ;;  Q  Indexed destination register as X(Rn)
@@ -371,7 +373,7 @@
    (call (mem:HI (match_operand:HI 1 "general_operand" "r,P,mi"))
         (match_operand:HI 2 "general_operand" "X,X,X")))]
 ""
- "call\\t%1"
+ "call\\t%N1"
 [ (set_attr "length" "1,1,2")
    (set_attr "cc" "clobber")])
 

Reply via email to