abi3.ssa (870B)
1 type :four = {l, b, w} 2 3 data $z = { w 0 } 4 5 export 6 function $test() { 7 @start 8 %a =w loadw $z 9 %y =w add %a, %a 10 %yl =l extsw %y 11 12 %s =l alloc8 16 # allocate a :four struct 13 %s1 =l add %s, 12 # get address of the w 14 storel 4, %s # set the l 15 storew 5, %s1 # set the w 16 17 # only the last argument should be on the stack 18 %f =l add $F, %yl 19 %x =w call %f(w %y, w 1, w 2, w 3, :four %s, w 6) 20 21 # store the result in the 22 # global variable a 23 24 %x1 =w add %y, %x 25 storew %x1, $a 26 ret 27 } 28 29 # >>> driver 30 # #include <stdio.h> 31 # struct four { long l; char c; int i; }; 32 # extern void test(void); 33 # int F(int a0, int a1, int a2, int a3, struct four s, int a6) { 34 # printf("%d %d %d %d %d %d %d\n", 35 # a0, a1, a2, a3, (int)s.l, s.i, a6); 36 # return 42; 37 # } 38 # int a; 39 # int main() { test(); printf("%d\n", a); return 0; } 40 # <<< 41 42 # >>> output 43 # 0 1 2 3 4 5 6 44 # 42 45 # <<<