comparison CbC-examples/test05.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
children 5d30d517ebed
comparison
equal deleted inserted replaced
26:b388631e4738 27:f9b1a53df341
1 //#include<stdio.h>
2 #define dprint(f, args...) \
3 printf("in %s: "f, __FUNCTION__, ## args)
4
5 __code caller (int a);
6 void f01 (int a);
7 void f02 (int a, float b);
8 __code cs01 (int a);
9 __code cs02 (int a, float b);
10 int main ();
11
12
13 int g=0;
14 void (*funcp)(int);
15 __code (*csp)(int);
16
17 __code caller(int a) {
18 f01(a+2);
19 f02(a+3, 13.2);
20 funcp(a+4);
21 goto csp(a+4);
22 dprint("\n");
23 }
24
25 __code end() {
26 dprint("\n");
27 exit(0);
28 }
29
30 void f01(int a) {
31 dprint("%d\n", a);
32 g += a;
33 return ;
34 }
35 void f02(int a, float b) {
36 dprint("%d, %f\n", a, b);
37 g -= a;
38 g += b*0.3;
39 return ;
40 }
41 __code cs01(int a) {
42 dprint("%d\n", a);
43 g += a;
44 goto end() ;
45 }
46 __code cs02(int a, float b) {
47 dprint("%d, %f\n", a, b);
48 g -= a;
49 g += b*0.3;
50 goto end() ;
51 }
52
53 int main() {
54 funcp = f01;
55 csp = cs01;
56 caller(10);
57 }
58