This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch to get romp target working


I recently setup a small infrastructure to test cross compiles to lots
of various targets.  I tried to include at least one for each .c file
in the config directory.  I came across a build failure on
romp-unknown-aos:

 > function.c: In function `expand_function_end':
 > function.c:6716: warning: implicit declaration of function `expand_binop'
 > function.c:6716: `add_optab' undeclared (first use in this function)
 > function.c:6716: (Each undeclared identifier is reported only once
 > function.c:6716: for each function it appears in.)
 > function.c:6716: warning: assignment makes pointer from integer without a cast
 > make: *** [function.o] Error 1

The problem was the definition of INITIALIZE_TRAMPOLINE in romp.h
which referenced stuff declared in optabs.h.  So I moved the guts of
that macro into its own function in romp.c, (similar I guess to how
x86_initialize_trampoline is handled.)

Tested by building cc1 in a sparc-sun-solaris2.7->romp-unknown-aos
cross compiler.

Okay to install?

		--Kaveh


2001-10-08  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* romp-protos.h (romp_initialize_trampoline): New function.
	* romp.c: Include optabs.h.
	(romp_initialize_trampoline): New function.
	* romp.h (INITIALIZE_TRAMPOLINE): Define in terms of
	romp_initialize_trampoline.

diff -rup orig/egcs-CVS20011007/gcc/config/romp/romp-protos.h egcs-CVS20011007/gcc/config/romp/romp-protos.h
--- orig/egcs-CVS20011007/gcc/config/romp/romp-protos.h	Fri Jul  6 16:31:19 2001
+++ egcs-CVS20011007/gcc/config/romp/romp-protos.h	Mon Oct  8 14:30:47 2001
@@ -47,6 +47,7 @@ extern int reg_15_operand PARAMS ((rtx, 
 extern int float_binary PARAMS ((rtx, enum machine_mode));
 extern int float_unary PARAMS ((rtx, enum machine_mode));
 extern int float_conversion PARAMS ((rtx, enum machine_mode));
+extern void romp_initialize_trampoline PARAMS ((rtx, rtx, rtx));
 #endif /* RTX_CODE */
 
 extern int first_reg_to_save PARAMS ((void));
diff -rup orig/egcs-CVS20011007/gcc/config/romp/romp.c egcs-CVS20011007/gcc/config/romp/romp.c
--- orig/egcs-CVS20011007/gcc/config/romp/romp.c	Fri Aug 10 16:30:25 2001
+++ egcs-CVS20011007/gcc/config/romp/romp.c	Mon Oct  8 14:32:40 2001
@@ -38,6 +38,7 @@ Boston, MA 02111-1307, USA.  */
 #include "function.h"
 #include "expr.h"
 #include "toplev.h"
+#include "optabs.h"
 #include "tm_p.h"
 #include "target.h"
 #include "target-def.h"
@@ -2045,4 +2046,30 @@ romp_debugger_arg_correction (offset)
      register argument, but we don't handle it here.  */
 
   return (offset - fp_to_argp);
+}
+
+void
+romp_initialize_trampoline (tramp, fnaddr, cxt)
+     rtx tramp, fnaddr, cxt;
+{
+  rtx _addr, _temp;
+  rtx _val;
+
+  _temp = expand_binop (SImode, add_optab, tramp, GEN_INT (4),
+			0, 1, OPTAB_LIB_WIDEN);
+  emit_move_insn (gen_rtx_MEM (SImode, memory_address (SImode, tramp)), _temp);
+
+  _val = force_reg (SImode, cxt);
+  _addr = memory_address (HImode, plus_constant (tramp, 10));
+  emit_move_insn (gen_rtx_MEM (HImode, _addr), gen_lowpart (HImode, _val));
+  _temp = expand_shift (RSHIFT_EXPR, SImode, _val, build_int_2 (16, 0), 0, 1);
+  _addr = memory_address (HImode, plus_constant (tramp, 6));
+  emit_move_insn (gen_rtx_MEM (HImode, _addr), gen_lowpart (HImode, _temp));
+
+  _val = force_reg (SImode, fnaddr);
+  _addr = memory_address (HImode, plus_constant (tramp, 24));
+  emit_move_insn (gen_rtx_MEM (HImode, _addr), gen_lowpart (HImode, _val));
+  _temp = expand_shift (RSHIFT_EXPR, SImode, _val, build_int_2 (16, 0), 0, 1);
+  _addr = memory_address (HImode, plus_constant (tramp, 20));
+  emit_move_insn (gen_rtx_MEM (HImode, _addr), gen_lowpart (HImode, _temp));
 }
diff -rup orig/egcs-CVS20011007/gcc/config/romp/romp.h egcs-CVS20011007/gcc/config/romp/romp.h
--- orig/egcs-CVS20011007/gcc/config/romp/romp.h	Tue Sep 11 13:36:10 2001
+++ egcs-CVS20011007/gcc/config/romp/romp.h	Mon Oct  8 14:29:09 2001
@@ -785,37 +785,7 @@ struct rt_cargs {int gregs, fregs; };
    data area.  */
 
 #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, CXT)		\
-{								\
-  rtx _addr, _temp;						\
-  rtx _val;							\
-								\
-  _temp = expand_binop (SImode, add_optab, ADDR,		\
-			GEN_INT (4),				\
-			0, 1, OPTAB_LIB_WIDEN);			\
-  emit_move_insn (gen_rtx_MEM (SImode,				\
-			       memory_address (SImode, ADDR)), _temp); \
-								\
-  _val = force_reg (SImode, CXT);				\
-  _addr = memory_address (HImode, plus_constant (ADDR, 10));	\
-  emit_move_insn (gen_rtx_MEM (HImode, _addr),			\
-		  gen_lowpart (HImode, _val));			\
-  _temp = expand_shift (RSHIFT_EXPR, SImode, _val,		\
-			build_int_2 (16, 0), 0, 1);		\
-  _addr = memory_address (HImode, plus_constant (ADDR, 6));	\
-  emit_move_insn (gen_rtx_MEM (HImode, _addr),			\
-		  gen_lowpart (HImode, _temp));			\
-								\
-  _val = force_reg (SImode, FNADDR);				\
-  _addr = memory_address (HImode, plus_constant (ADDR, 24));	\
-  emit_move_insn (gen_rtx_MEM (HImode, _addr),			\
-		  gen_lowpart (HImode, _val));			\
-  _temp = expand_shift (RSHIFT_EXPR, SImode, _val,		\
-			build_int_2 (16, 0), 0, 1);		\
-  _addr = memory_address (HImode, plus_constant (ADDR, 20));	\
-  emit_move_insn (gen_rtx_MEM (HImode, _addr),			\
-		  gen_lowpart (HImode, _temp));			\
-								\
-}
+	romp_initialize_trampoline (ADDR, FNADDR, CXT)
 
 /* Definitions for register eliminations.
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]