CVS: gcc/gcc-3.3/gcc/config/msp430 msp430.c, 1.99.2.5, 1.99.2.6 msp430.h, 1.49.2.2, 1.49.2.3 msp430.md, 1.64.2.1, 1.64.2.2 t-msp430, 1.28.2.1, 1.28.2.2

"Roman Lim" <[email protected]> Tue, 19 May 2009 09:13:25 +0000
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.cvs
Message-ID <[email protected]>
Update of /cvsroot/mspgcc/gcc/gcc-3.3/gcc/config/msp430
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27472/gcc/gcc-3.3/gcc/config/msp430

Modified Files:
      Tag: MSP430X
	msp430.c msp430.h msp430.md t-msp430 
Log Message:
add support for jumptables (switch/case statement) in functions in mem>64k
fixes a bug for functions where parameters are put on the stack (as calla puts a 4byte return address on the stack, and call only 2 bytes)


Index: msp430.c
===================================================================
RCS file: /cvsroot/mspgcc/gcc/gcc-3.3/gcc/config/msp430/msp430.c,v
retrieving revision 1.99.2.5
retrieving revision 1.99.2.6
diff -u -w -d -r1.99.2.5 -r1.99.2.6
--- msp430.c	12 Feb 2009 13:51:42 -0000	1.99.2.5
+++ msp430.c	19 May 2009 09:13:23 -0000	1.99.2.6
@@ -574,7 +574,7 @@
       static const char *const dsec = ".fartext";
       DECL_SECTION_NAME (decl) = build_string (strlen (dsec), dsec);
     }
-  if (DECL_READONLY_SECTION (decl, 0) && msp430_far_object_p(decl))
+  if (DECL_P(decl) && DECL_READONLY_SECTION (decl, 0) && msp430_far_object_p(decl))
     {
       static const char *const dsec = ".farrodata";
       DECL_SECTION_NAME (decl) = build_string (strlen (dsec), dsec);
@@ -3153,7 +3153,7 @@
      FILE *stream;
      int value;
 {
-  fprintf (stream, "\t.word	.L%d\n", value);
+  fprintf (stream, CHECK_JUMP_SIZE("\t.word	.L%d\n", msp430_in_fartext_section()?"\t.long	.L%d\n":"\t.word	.L%d\n"), value);
   jump_tables_size++;
 }
 
@@ -6782,6 +6782,33 @@
   return "";
 }
 
+enum machine_mode
+msp430_case_vector_mode()
+{
+  if (TARGET_ALL_DEBUG)
+    fprintf (stderr, "DEBUG: Vector mode far = %i\n", msp430_far_object_p(current_function_decl));
+  return CHECK_JUMP_SIZE(HImode, msp430_far_object_p(current_function_decl)?SImode:HImode);
+}
+
+/* only valid for text section. */
+int
+msp430_in_fartext_section ()
+{
+  if (TARGET_ALL_DEBUG)
+    fprintf (stderr, "DEBUG: fartext section output = %i\n", !in_text_section());
+  return !in_text_section();
+}
+
+const char *
+msp430_emit_bra (operands)
+     rtx operands[];
+{
+  if (msp430_in_fartext_section())
+    output_asm_insn ("movx.a\t%0, r0;\t%1", operands); // need 20bit base address
+  else
+    output_asm_insn ("br\t%0;\t%1", operands);
+  return "";
+}
 
 /* SHIFT GUARDS */
 int

Index: msp430.h
===================================================================
RCS file: /cvsroot/mspgcc/gcc/gcc-3.3/gcc/config/msp430/msp430.h,v
retrieving revision 1.49.2.2
retrieving revision 1.49.2.3
diff -u -w -d -r1.49.2.2 -r1.49.2.3
--- msp430.h	5 Feb 2009 01:29:37 -0000	1.49.2.2
+++ msp430.h	19 May 2009 09:13:23 -0000	1.49.2.3
@@ -896,7 +896,7 @@
    If `ARGS_GROW_DOWNWARD', this is the offset to the location above
    the first location at which outgoing arguments are placed.  */
 
-#define FIRST_PARM_OFFSET(FUNDECL) 0
+#define FIRST_PARM_OFFSET(FUNDECL) CHECK_JUMP_SIZE(0,2)
 /* Offset from the argument pointer register to the first argument's
    address.  On some machines it may depend on the data type of the
    function.
@@ -1915,7 +1915,7 @@
    Do not define this macro if you put all constants in the read-only
    data section.  */
 
-#define JUMP_TABLES_IN_TEXT_SECTION 0
+#define JUMP_TABLES_IN_TEXT_SECTION 1
 /* Define this macro if jump tables (for `tablejump' insns) should be
    output in the text section, along with the assembler instructions.
    Otherwise, the readonly data section is used.
@@ -2700,7 +2700,7 @@
    command to advance the location counter to a multiple of 2 to the
    POWER bytes.  POWER will be a C expression of type `int'.  */
 
-#define CASE_VECTOR_MODE HImode
+#define CASE_VECTOR_MODE msp430_case_vector_mode()
 /* An alias for a machine mode name.  This is the machine mode that
    elements of a jump-table should have.  */
 

Index: msp430.md
===================================================================
RCS file: /cvsroot/mspgcc/gcc/gcc-3.3/gcc/config/msp430/msp430.md,v
retrieving revision 1.64.2.1
retrieving revision 1.64.2.2
diff -u -w -d -r1.64.2.1 -r1.64.2.2
--- msp430.md	26 Jan 2009 15:57:17 -0000	1.64.2.1
+++ msp430.md	19 May 2009 09:13:23 -0000	1.64.2.2
@@ -3269,10 +3269,10 @@
 
 ;; Table helper
 (define_insn "tablejump"
-  [(set (pc) (match_operand:HI 0 "general_operand" "rRP,i,m"))
+  [(set (pc) (match_operand 0 "general_operand" "rRP,i,m"))
    (use (label_ref (match_operand 1 "" "")))]
   ""
-  "* return CHECK_JUMP_SIZE(\"br\\t%0\\t;\\t%1\", \"bra\\t%0\\t;\\t%1\"); "
+  "* return CHECK_JUMP_SIZE(\"br\\t%0\\t;\\t%1\", msp430_emit_bra(operands)); "
  [(set_attr "length" "1,2,2")   
    (set_attr "cc" "clobber")])
 

Index: t-msp430
===================================================================
RCS file: /cvsroot/mspgcc/gcc/gcc-3.3/gcc/config/msp430/t-msp430,v
retrieving revision 1.28.2.1
retrieving revision 1.28.2.2
diff -u -w -d -r1.28.2.1 -r1.28.2.2
--- t-msp430	26 Jan 2009 15:57:17 -0000	1.28.2.1
+++ t-msp430	19 May 2009 09:13:23 -0000	1.28.2.2
@@ -180,10 +180,13 @@
 # to achieve the same effect, i.e. to allow compile and link program for different mcu's with the same
 # compile/link options. If we exclude some combination, default library (i.e. msp1 lib from root) 
 # will be linked even for 430Xcore mcu when excluded set of options used.
+# Exceptions are neither built nor linked. Therefore the same compile/link options for different mcu's won't work.
 MULTILIB_EXCEPTIONS += \
     mdisable-hwmul* \
     mmcu=msp430x2232/*mdisable-hwmul* \
-    mmcu=msp430x2416/*mdisable-hwmul* \
+    
+# Actually, msp430x2416 has a hw multiplier
+#   mmcu=msp430x2416/*mdisable-hwmul* \
 
 MULTILIB_EXCLUSIONS = \
 


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects