diff CbC-examples/test_csp1.c @ 27:f9b1a53df341

implemented indirect sibcall for ppc.
author kent@teto.cr.ie.u-ryukyu.ac.jp
date Tue, 10 Nov 2009 16:34:29 +0900
parents 4c6926a2b9bc
children
line wrap: on
line diff
--- a/CbC-examples/test_csp1.c	Thu Oct 29 18:19:02 2009 +0900
+++ b/CbC-examples/test_csp1.c	Tue Nov 10 16:34:29 2009 +0900
@@ -3,6 +3,30 @@
 
 //static __code (*csp)(int, int, int, int);
 
+__code cs_end (int a);
+__code cs0 (int a, int b, int c, int d);
+void* freturn ();
+__code cs_goto (int a, int b, int c, int d);
+int function (double a, float b, int c);
+int main (int argc, char **argv);
+
+
+__code cs_goto(int a, int b, int c, int d){
+	__code (*csp)(int, int, int, int);
+	csp = freturn();
+	printf("csp = %x.\n", csp);
+
+	//printf("cs_goto : a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d.\n", a, b, c, d, e, f, g);
+	//printf("cs_goto : a=%d, b=%d, c=%d, d=%d.\n", a, b, c, d);
+	//printf("cs_goto : a-4=%d, a-8=%d, a-12=%d, a-16=%d.\n", *(&a-4), *(&a-8), *(&a-12), *(&a-16));
+	//printf("cs_goto : cs0(a, b, c, d)\n");
+#ifdef INDIRECT
+	goto csp(b+a, d+b, a+c, c+d);
+#else
+	goto cs0(b+a, d+b, a+c, c+d);
+#endif
+}
+
 __code cs_end(int a){
 	printf("cs_exit : a=%d.\n", a);
 	exit(a);
@@ -19,17 +43,6 @@
 void* freturn(){
 	return cs0;
 }
-__code cs_goto(int a, int b, int c, int d){
-	__code (*csp)(int, int, int, int);
-	csp = freturn();
-	printf("csp = %x.\n", csp);
-
-	//printf("cs_goto : a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d.\n", a, b, c, d, e, f, g);
-	//printf("cs_goto : a=%d, b=%d, c=%d, d=%d.\n", a, b, c, d);
-	//printf("cs_goto : a-4=%d, a-8=%d, a-12=%d, a-16=%d.\n", *(&a-4), *(&a-8), *(&a-12), *(&a-16));
-	//printf("cs_goto : cs0(a, b, c, d)\n");
-	goto csp(b+a, d+b, a+c, c+d);
-}
 
 int function(double a, float b, int c){
 
@@ -45,4 +58,3 @@
 	return 0;
 }
 
-