changeset 529:fe694c7677b4

- mips eabi doc disas examples
author Tassilo Philipp
date Thu, 14 Apr 2022 21:18:02 +0200
parents e56241bba0f5
children 585dcb68f55d
files doc/disas_examples/mips.eabi.disas
diffstat 1 files changed, 911 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/doc/disas_examples/mips.eabi.disas	Thu Apr 14 14:44:40 2022 +0200
+++ b/doc/disas_examples/mips.eabi.disas	Thu Apr 14 21:18:02 2022 +0200
@@ -609,5 +609,916 @@
   9c:   afcb0044        sw      t3,68(s8)
 
 
+
+; ---------- structs by value ---------->
+;
+; struct A { int i, j; long long l; };
+;
+; void leaf_call(int b, int c, int d, int e, struct A f, int g, int h)
+; {
+; }
+;
+; void nonleaf_call(int a, int b, int c, int d, int e, struct A f, int g, int h)
+; {
+;     /* use some local data */
+;     char l[100] ={ 'L'};
+;     leaf_call(b, c, d, e, f, g, h);
+; }
+;
+; int main()
+; {
+;     nonleaf_call(0, 1, 2, 3, 4, (struct A){5, 6, 7ll}, 8, 9);
+;     return 0;
+; }
+
+
+
+; output from psptoolchain-20111215-psp w/ gcc 4.9.3
+
+00000000 <leaf_call>:
+   0:   27bdffd0        addiu   sp,sp,-48
+   4:   afbe002c        sw      s8,44(sp)
+   8:   afb00028        sw      s0,40(sp)
+   c:   03a0f021        move    s8,sp
+  10:   afc40010        sw      a0,16(s8)
+  14:   afc50014        sw      a1,20(s8)
+  18:   afc60018        sw      a2,24(s8)
+  1c:   afc7001c        sw      a3,28(s8)
+  20:   01008021        move    s0,t0
+  24:   afc90020        sw      t1,32(s8)
+  28:   afca0024        sw      t2,36(s8)
+  2c:   8e050000        lw      a1,0(s0)
+  30:   8e040004        lw      a0,4(s0)
+  34:   8e030008        lw      v1,8(s0)
+  38:   8e02000c        lw      v0,12(s0)
+  3c:   afc50000        sw      a1,0(s8)
+  40:   afc40004        sw      a0,4(s8)
+  44:   afc30008        sw      v1,8(s8)
+  48:   afc2000c        sw      v0,12(s8)
+  4c:   03c0e821        move    sp,s8
+  50:   8fbe002c        lw      s8,44(sp)
+  54:   8fb00028        lw      s0,40(sp)
+  58:   27bd0030        addiu   sp,sp,48
+  5c:   03e00008        jr      ra
+  60:   00000000        nop
+
+00000064 <nonleaf_call>:
+  64:   27bdff58        addiu   sp,sp,-168
+  68:   afbf00a4        sw      ra,164(sp)
+  6c:   afbe00a0        sw      s8,160(sp)
+  70:   afb0009c        sw      s0,156(sp)
+  74:   03a0f021        move    s8,sp
+  78:   afc40078        sw      a0,120(s8)
+  7c:   afc5007c        sw      a1,124(s8)
+  80:   afc60080        sw      a2,128(s8)
+  84:   afc70084        sw      a3,132(s8)
+  88:   afc80088        sw      t0,136(s8)
+  8c:   01208021        move    s0,t1
+  90:   afca008c        sw      t2,140(s8)
+  94:   afcb0090        sw      t3,144(s8)
+  98:   8e050000        lw      a1,0(s0)
+  9c:   8e040004        lw      a0,4(s0)
+  a0:   8e030008        lw      v1,8(s0)
+  a4:   8e02000c        lw      v0,12(s0)
+  a8:   afc50000        sw      a1,0(s8)
+  ac:   afc40004        sw      a0,4(s8)
+  b0:   afc30008        sw      v1,8(s8)
+  b4:   afc2000c        sw      v0,12(s8)
+  b8:   27c30010        addiu   v1,s8,16
+  bc:   24020064        li      v0,100
+  c0:   00602021        move    a0,v1
+  c4:   00002821        move    a1,zero
+  c8:   00403021        move    a2,v0
+  cc:   0c000000        jal     0 <leaf_call>
+  d0:   00000000        nop
+  d4:   2402004c        li      v0,76
+  d8:   a3c20010        sb      v0,16(s8)
+  dc:   8fc4007c        lw      a0,124(s8)
+  e0:   8fc50080        lw      a1,128(s8)
+  e4:   8fc60084        lw      a2,132(s8)
+  e8:   8fc70088        lw      a3,136(s8)
+  ec:   03c04021        move    t0,s8
+  f0:   8fc9008c        lw      t1,140(s8)
+  f4:   8fca0090        lw      t2,144(s8)
+  f8:   0c000000        jal     0 <leaf_call>
+  fc:   00000000        nop
+ 100:   03c0e821        move    sp,s8
+ 104:   8fbf00a4        lw      ra,164(sp)
+ 108:   8fbe00a0        lw      s8,160(sp)
+ 10c:   8fb0009c        lw      s0,156(sp)
+ 110:   27bd00a8        addiu   sp,sp,168
+ 114:   03e00008        jr      ra
+ 118:   00000000        nop
+
+0000011c <main>:
+ 11c:   27bdffe8        addiu   sp,sp,-24
+ 120:   afbf0014        sw      ra,20(sp)
+ 124:   afbe0010        sw      s8,16(sp)
+ 128:   03a0f021        move    s8,sp
+ 12c:   24020005        li      v0,5
+ 130:   afc20000        sw      v0,0(s8)
+ 134:   24020006        li      v0,6
+ 138:   afc20004        sw      v0,4(s8)
+ 13c:   24020007        li      v0,7
+ 140:   00001821        move    v1,zero
+ 144:   afc20008        sw      v0,8(s8)
+ 148:   afc3000c        sw      v1,12(s8)
+ 14c:   00002021        move    a0,zero
+ 150:   24050001        li      a1,1
+ 154:   24060002        li      a2,2
+ 158:   24070003        li      a3,3
+ 15c:   24080004        li      t0,4
+ 160:   03c04821        move    t1,s8
+ 164:   240a0008        li      t2,8
+ 168:   240b0009        li      t3,9
+ 16c:   0c000000        jal     0 <leaf_call>
+ 170:   00000000        nop
+ 174:   00001021        move    v0,zero
+ 178:   03c0e821        move    sp,s8
+ 17c:   8fbf0014        lw      ra,20(sp)
+ 180:   8fbe0010        lw      s8,16(sp)
+ 184:   27bd0018        addiu   sp,sp,24
+ 188:   03e00008        jr      ra
+ 18c:   00000000        nop
+
+
+
+
+; ---------- structs by value, complex example (multiple structs) ---------->
+;
+; struct A { int i, j; float f; };
+; struct B { double d; long long l; };
+;
+; void leaf_call(int b, struct A c, struct B d, int e, int f, struct A g, struct B h, int i, int j)
+; {
+; }
+;
+; void nonleaf_call(int a, int b, struct A c, struct B d, int e, int f, struct A g, struct B h, int i, int j)
+; {
+;     /* use some local data */
+;     char l[100] ={ 'L'};
+;     leaf_call(b, c, d, e, f, g, h, i, j);
+; }
+;
+; int main()
+; {
+;     nonleaf_call(0, 1, (struct A){2, 3, 4.f}, (struct B){5., 6ll}, 7, 8, (struct A){9, 10, 11.f}, (struct B){12., 13ll}, 14, 15);
+;     return 0;
+; }
+
+
+
+; output from psptoolchain-20111215-psp w/ gcc 4.9.3
+
+00000000 <leaf_call>:
+   0:   27bdff98        addiu   sp,sp,-104
+   4:   afbe0064        sw      s8,100(sp)
+   8:   afb30060        sw      s3,96(sp)
+   c:   afb2005c        sw      s2,92(sp)
+  10:   afb10058        sw      s1,88(sp)
+  14:   afb00054        sw      s0,84(sp)
+  18:   03a0f021        move    s8,sp
+  1c:   afc40040        sw      a0,64(s8)
+  20:   00a09821        move    s3,a1
+  24:   00c08821        move    s1,a2
+  28:   afc70044        sw      a3,68(s8)
+  2c:   afc80048        sw      t0,72(s8)
+  30:   01209021        move    s2,t1
+  34:   01408021        move    s0,t2
+  38:   afcb004c        sw      t3,76(s8)
+  3c:   8e640000        lw      a0,0(s3)
+  40:   8e630004        lw      v1,4(s3)
+  44:   8e620008        lw      v0,8(s3)
+  48:   afc40030        sw      a0,48(s8)
+  4c:   afc30034        sw      v1,52(s8)
+  50:   afc20038        sw      v0,56(s8)
+  54:   8e250000        lw      a1,0(s1)
+  58:   8e240004        lw      a0,4(s1)
+  5c:   8e230008        lw      v1,8(s1)
+  60:   8e22000c        lw      v0,12(s1)
+  64:   afc50020        sw      a1,32(s8)
+  68:   afc40024        sw      a0,36(s8)
+  6c:   afc30028        sw      v1,40(s8)
+  70:   afc2002c        sw      v0,44(s8)
+  74:   8e440000        lw      a0,0(s2)
+  78:   8e430004        lw      v1,4(s2)
+  7c:   8e420008        lw      v0,8(s2)
+  80:   afc40010        sw      a0,16(s8)
+  84:   afc30014        sw      v1,20(s8)
+  88:   afc20018        sw      v0,24(s8)
+  8c:   8e050000        lw      a1,0(s0)
+  90:   8e040004        lw      a0,4(s0)
+  94:   8e030008        lw      v1,8(s0)
+  98:   8e02000c        lw      v0,12(s0)
+  9c:   afc50000        sw      a1,0(s8)
+  a0:   afc40004        sw      a0,4(s8)
+  a4:   afc30008        sw      v1,8(s8)
+  a8:   afc2000c        sw      v0,12(s8)
+  ac:   03c0e821        move    sp,s8
+  b0:   8fbe0064        lw      s8,100(sp)
+  b4:   8fb30060        lw      s3,96(sp)
+  b8:   8fb2005c        lw      s2,92(sp)
+  bc:   8fb10058        lw      s1,88(sp)
+  c0:   8fb00054        lw      s0,84(sp)
+  c4:   27bd0068        addiu   sp,sp,104
+  c8:   03e00008        jr      ra
+  cc:   00000000        nop
+
+000000d0 <nonleaf_call>:
+  d0:   27bdff30        addiu   sp,sp,-208
+  d4:   afbf00cc        sw      ra,204(sp)
+  d8:   afbe00c8        sw      s8,200(sp)
+  dc:   afb300c4        sw      s3,196(sp)
+  e0:   afb200c0        sw      s2,192(sp)
+  e4:   afb100bc        sw      s1,188(sp)
+  e8:   afb000b8        sw      s0,184(sp)
+  ec:   03a0f021        move    s8,sp
+  f0:   afc400a8        sw      a0,168(s8)
+  f4:   afc500ac        sw      a1,172(s8)
+  f8:   00c09821        move    s3,a2
+  fc:   00e08821        move    s1,a3
+ 100:   afc800b0        sw      t0,176(s8)
+ 104:   afc900b4        sw      t1,180(s8)
+ 108:   01409021        move    s2,t2
+ 10c:   01608021        move    s0,t3
+ 110:   8e640000        lw      a0,0(s3)
+ 114:   8e630004        lw      v1,4(s3)
+ 118:   8e620008        lw      v0,8(s3)
+ 11c:   afc40038        sw      a0,56(s8)
+ 120:   afc3003c        sw      v1,60(s8)
+ 124:   afc20040        sw      v0,64(s8)
+ 128:   8e250000        lw      a1,0(s1)
+ 12c:   8e240004        lw      a0,4(s1)
+ 130:   8e230008        lw      v1,8(s1)
+ 134:   8e22000c        lw      v0,12(s1)
+ 138:   afc50028        sw      a1,40(s8)
+ 13c:   afc4002c        sw      a0,44(s8)
+ 140:   afc30030        sw      v1,48(s8)
+ 144:   afc20034        sw      v0,52(s8)
+ 148:   8e440000        lw      a0,0(s2)
+ 14c:   8e430004        lw      v1,4(s2)
+ 150:   8e420008        lw      v0,8(s2)
+ 154:   afc40018        sw      a0,24(s8)
+ 158:   afc3001c        sw      v1,28(s8)
+ 15c:   afc20020        sw      v0,32(s8)
+ 160:   8e050000        lw      a1,0(s0)
+ 164:   8e040004        lw      a0,4(s0)
+ 168:   8e030008        lw      v1,8(s0)
+ 16c:   8e02000c        lw      v0,12(s0)
+ 170:   afc50008        sw      a1,8(s8)
+ 174:   afc4000c        sw      a0,12(s8)
+ 178:   afc30010        sw      v1,16(s8)
+ 17c:   afc20014        sw      v0,20(s8)
+ 180:   27c30044        addiu   v1,s8,68
+ 184:   24020064        li      v0,100
+ 188:   00602021        move    a0,v1
+ 18c:   00002821        move    a1,zero
+ 190:   00403021        move    a2,v0
+ 194:   0c000000        jal     0 <leaf_call>
+ 198:   00000000        nop
+ 19c:   2402004c        li      v0,76
+ 1a0:   a3c20044        sb      v0,68(s8)
+ 1a4:   27c50038        addiu   a1,s8,56
+ 1a8:   27c60028        addiu   a2,s8,40
+ 1ac:   27c30018        addiu   v1,s8,24
+ 1b0:   8fc200d4        lw      v0,212(s8)
+ 1b4:   afa20000        sw      v0,0(sp)
+ 1b8:   8fc400ac        lw      a0,172(s8)
+ 1bc:   8fc700b0        lw      a3,176(s8)
+ 1c0:   8fc800b4        lw      t0,180(s8)
+ 1c4:   00604821        move    t1,v1
+ 1c8:   27c20008        addiu   v0,s8,8
+ 1cc:   00405021        move    t2,v0
+ 1d0:   8fcb00d0        lw      t3,208(s8)
+ 1d4:   0c000000        jal     0 <leaf_call>
+ 1d8:   00000000        nop
+ 1dc:   03c0e821        move    sp,s8
+ 1e0:   8fbf00cc        lw      ra,204(sp)
+ 1e4:   8fbe00c8        lw      s8,200(sp)
+ 1e8:   8fb300c4        lw      s3,196(sp)
+ 1ec:   8fb200c0        lw      s2,192(sp)
+ 1f0:   8fb100bc        lw      s1,188(sp)
+ 1f4:   8fb000b8        lw      s0,184(sp)
+ 1f8:   27bd00d0        addiu   sp,sp,208
+ 1fc:   03e00008        jr      ra
+ 200:   00000000        nop
+
+00000204 <main>:
+ 204:   27bdffb0        addiu   sp,sp,-80
+ 208:   afbf004c        sw      ra,76(sp)
+ 20c:   afbe0048        sw      s8,72(sp)
+ 210:   03a0f021        move    s8,sp
+ 214:   24020002        li      v0,2
+ 218:   afc20038        sw      v0,56(s8)
+ 21c:   24020003        li      v0,3
+ 220:   afc2003c        sw      v0,60(s8)
+ 224:   8f820000        lw      v0,0(gp)
+ 228:   afc20040        sw      v0,64(s8)
+ 22c:   8f820008        lw      v0,8(gp)
+ 230:   8f83000c        lw      v1,12(gp)
+ 234:   afc20028        sw      v0,40(s8)
+ 238:   afc3002c        sw      v1,44(s8)
+ 23c:   24020006        li      v0,6
+ 240:   00001821        move    v1,zero
+ 244:   afc20030        sw      v0,48(s8)
+ 248:   afc30034        sw      v1,52(s8)
+ 24c:   24020009        li      v0,9
+ 250:   afc20018        sw      v0,24(s8)
+ 254:   2402000a        li      v0,10
+ 258:   afc2001c        sw      v0,28(s8)
+ 25c:   8f820010        lw      v0,16(gp)
+ 260:   afc20020        sw      v0,32(s8)
+ 264:   8f820018        lw      v0,24(gp)
+ 268:   8f83001c        lw      v1,28(gp)
+ 26c:   afc20008        sw      v0,8(s8)
+ 270:   afc3000c        sw      v1,12(s8)
+ 274:   2402000d        li      v0,13
+ 278:   00001821        move    v1,zero
+ 27c:   afc20010        sw      v0,16(s8)
+ 280:   afc30014        sw      v1,20(s8)
+ 284:   27c60038        addiu   a2,s8,56
+ 288:   27c70028        addiu   a3,s8,40
+ 28c:   27c30018        addiu   v1,s8,24
+ 290:   2402000e        li      v0,14
+ 294:   afa20000        sw      v0,0(sp)
+ 298:   2402000f        li      v0,15
+ 29c:   afa20004        sw      v0,4(sp)
+ 2a0:   00002021        move    a0,zero
+ 2a4:   24050001        li      a1,1
+ 2a8:   24080007        li      t0,7
+ 2ac:   24090008        li      t1,8
+ 2b0:   00605021        move    t2,v1
+ 2b4:   27c20008        addiu   v0,s8,8
+ 2b8:   00405821        move    t3,v0
+ 2bc:   0c000000        jal     0 <leaf_call>
+ 2c0:   00000000        nop
+ 2c4:   00001021        move    v0,zero
+ 2c8:   03c0e821        move    sp,s8
+ 2cc:   8fbf004c        lw      ra,76(sp)
+ 2d0:   8fbe0048        lw      s8,72(sp)
+ 2d4:   27bd0050        addiu   sp,sp,80
+ 2d8:   03e00008        jr      ra
+ 2dc:   00000000        nop
+
+
+
+
+; ---------- returning structs by value ---------->
+; 
+; struct Small { char x; };
+; struct Big { long long i,j,k,l; long m; }; /* bigger than 16b */
+;
+; struct Small f0()
+; {
+;     struct Small s = { 132 };
+;     return s;
+; }
+;
+; struct Big f1()
+; {
+;     struct Big b = { 7171LL, 99LL, -99LL, -3102LL, 32 };
+;     return b;
+; }
+;
+; int main()
+; {
+;     struct Small s = f0();
+;     struct Big b = f1();
+;     return b.j + b.k + b.m + s.x;
+; }
+
+
+
+; output from psptoolchain-20111215-psp w/ gcc 4.9.3
+
+00000000 <f0>:
+   0:   27bdfff0        addiu   sp,sp,-16
+   4:   afbe000c        sw      s8,12(sp)
+   8:   03a0f021        move    s8,sp
+   c:   2402ff84        li      v0,-124
+  10:   a3c20000        sb      v0,0(s8)
+  14:   93c20000        lbu     v0,0(s8)
+  18:   03c0e821        move    sp,s8
+  1c:   8fbe000c        lw      s8,12(sp)
+  20:   27bd0010        addiu   sp,sp,16
+  24:   03e00008        jr      ra
+  28:   00000000        nop
+
+0000002c <f1>:
+  2c:   27bdffc8        addiu   sp,sp,-56
+  30:   afbf0034        sw      ra,52(sp)
+  34:   afbe0030        sw      s8,48(sp)
+  38:   03a0f021        move    s8,sp
+  3c:   afc40028        sw      a0,40(s8)
+  40:   3c020000        lui     v0,0x0
+  44:   03c02021        move    a0,s8
+  48:   24430000        addiu   v1,v0,0
+  4c:   24020028        li      v0,40
+  50:   00602821        move    a1,v1
+  54:   00403021        move    a2,v0
+  58:   0c000000        jal     0 <f0>
+  5c:   00000000        nop
+  60:   8fc20028        lw      v0,40(s8)
+  64:   00402021        move    a0,v0
+  68:   03c01821        move    v1,s8
+  6c:   24020028        li      v0,40
+  70:   00602821        move    a1,v1
+  74:   00403021        move    a2,v0
+  78:   0c000000        jal     0 <f0>
+  7c:   00000000        nop
+  80:   8fc20028        lw      v0,40(s8)
+  84:   03c0e821        move    sp,s8
+  88:   8fbf0034        lw      ra,52(sp)
+  8c:   8fbe0030        lw      s8,48(sp)
+  90:   27bd0038        addiu   sp,sp,56
+  94:   03e00008        jr      ra
+  98:   00000000        nop
+
+0000009c <main>:
+  9c:   27bdffc8        addiu   sp,sp,-56
+  a0:   afbf0034        sw      ra,52(sp)
+  a4:   afbe0030        sw      s8,48(sp)
+  a8:   03a0f021        move    s8,sp
+  ac:   0c000000        jal     0 <f0>
+  b0:   00000000        nop
+  b4:   a3c20000        sb      v0,0(s8)
+  b8:   27c20008        addiu   v0,s8,8
+  bc:   00402021        move    a0,v0
+  c0:   0c000000        jal     0 <f0>
+  c4:   00000000        nop
+  c8:   8fc20010        lw      v0,16(s8)
+  cc:   8fc30014        lw      v1,20(s8)
+  d0:   00402021        move    a0,v0
+  d4:   8fc20018        lw      v0,24(s8)
+  d8:   8fc3001c        lw      v1,28(s8)
+  dc:   00821021        addu    v0,a0,v0
+  e0:   8fc30028        lw      v1,40(s8)
+  e4:   00431021        addu    v0,v0,v1
+  e8:   83c30000        lb      v1,0(s8)
+  ec:   00431021        addu    v0,v0,v1
+  f0:   03c0e821        move    sp,s8
+  f4:   8fbf0034        lw      ra,52(sp)
+  f8:   8fbe0030        lw      s8,48(sp)
+  fc:   27bd0038        addiu   sp,sp,56
+ 100:   03e00008        jr      ra
+ 104:   00000000        nop
+
+
+
+; ---------- returning long long ---------->
+;
+; long long f()
+; {
+;     return 7171LL;
+; }
+;
+; int main()
+; {
+;     return (int)f();
+; }
+
+
+
+; output from psptoolchain-20111215-psp w/ gcc 4.9.3
+
+00000000 <f>:
+   0:   27bdfff8        addiu   sp,sp,-8
+   4:   afbe0004        sw      s8,4(sp)
+   8:   03a0f021        move    s8,sp
+   c:   24021c03        li      v0,7171
+  10:   00001821        move    v1,zero
+  14:   03c0e821        move    sp,s8
+  18:   8fbe0004        lw      s8,4(sp)
+  1c:   27bd0008        addiu   sp,sp,8
+  20:   03e00008        jr      ra
+  24:   00000000        nop
+
+00000028 <main>:
+  28:   27bdfff8        addiu   sp,sp,-8
+  2c:   afbf0004        sw      ra,4(sp)
+  30:   afbe0000        sw      s8,0(sp)
+  34:   03a0f021        move    s8,sp
+  38:   0c000000        jal     0 <f>
+  3c:   00000000        nop
+  40:   03c0e821        move    sp,s8
+  44:   8fbf0004        lw      ra,4(sp)
+  48:   8fbe0000        lw      s8,0(sp)
+  4c:   27bd0008        addiu   sp,sp,8
+  50:   03e00008        jr      ra
+  54:   00000000        nop
+
+
+
+; ---------- passing structs with only fp parts ---------->
+;
+; struct A { float a; };
+; struct B { float a, b; };
+; struct C { float a, b, c; };
+; struct D { double a; };
+; struct E { double a, b; };
+; struct F { double a, b, c; };
+;
+; void leaf_call(struct A a, struct B b, struct C c, struct D d, struct E e, struct F f)
+; {
+; }
+;
+; int main()
+; {
+;     leaf_call((struct A){1.f}, (struct B){2.f,3.f}, (struct C){4.f,5.f,6.f}, (struct D){1.}, (struct E){2.,3.}, (struct F){4.,5.,6.});
+;     return 0;
+; }
+
+
+
+; output from psptoolchain-20111215-psp w/ gcc 4.9.3
+
+00000000 <leaf_call>:
+   0:   27bdff98        addiu   sp,sp,-104
+   4:   afbe0064        sw      s8,100(sp)
+   8:   afb30060        sw      s3,96(sp)
+   c:   afb2005c        sw      s2,92(sp)
+  10:   afb10058        sw      s1,88(sp)
+  14:   afb00054        sw      s0,84(sp)
+  18:   03a0f021        move    s8,sp
+  1c:   e7cc0040        swc1    $f12,64(s8)
+  20:   00809821        move    s3,a0
+  24:   00a09021        move    s2,a1
+  28:   afc60048        sw      a2,72(s8)
+  2c:   afc7004c        sw      a3,76(s8)
+  30:   01008821        move    s1,t0
+  34:   01208021        move    s0,t1
+  38:   8e630000        lw      v1,0(s3)
+  3c:   8e620004        lw      v0,4(s3)
+  40:   afc30034        sw      v1,52(s8)
+  44:   afc20038        sw      v0,56(s8)
+  48:   8e440000        lw      a0,0(s2)
+  4c:   8e430004        lw      v1,4(s2)
+  50:   8e420008        lw      v0,8(s2)
+  54:   afc40028        sw      a0,40(s8)
+  58:   afc3002c        sw      v1,44(s8)
+  5c:   afc20030        sw      v0,48(s8)
+  60:   8e250000        lw      a1,0(s1)
+  64:   8e240004        lw      a0,4(s1)
+  68:   8e230008        lw      v1,8(s1)
+  6c:   8e22000c        lw      v0,12(s1)
+  70:   afc50018        sw      a1,24(s8)
+  74:   afc4001c        sw      a0,28(s8)
+  78:   afc30020        sw      v1,32(s8)
+  7c:   afc20024        sw      v0,36(s8)
+  80:   8e070000        lw      a3,0(s0)
+  84:   8e060004        lw      a2,4(s0)
+  88:   8e050008        lw      a1,8(s0)
+  8c:   8e04000c        lw      a0,12(s0)
+  90:   8e030010        lw      v1,16(s0)
+  94:   8e020014        lw      v0,20(s0)
+  98:   afc70000        sw      a3,0(s8)
+  9c:   afc60004        sw      a2,4(s8)
+  a0:   afc50008        sw      a1,8(s8)
+  a4:   afc4000c        sw      a0,12(s8)
+  a8:   afc30010        sw      v1,16(s8)
+  ac:   afc20014        sw      v0,20(s8)
+  b0:   03c0e821        move    sp,s8
+  b4:   8fbe0064        lw      s8,100(sp)
+  b8:   8fb30060        lw      s3,96(sp)
+  bc:   8fb2005c        lw      s2,92(sp)
+  c0:   8fb10058        lw      s1,88(sp)
+  c4:   8fb00054        lw      s0,84(sp)
+  c8:   27bd0068        addiu   sp,sp,104
+  cc:   03e00008        jr      ra
+  d0:   00000000        nop
+
+000000d4 <main>:
+  d4:   27bdffb0        addiu   sp,sp,-80
+  d8:   afbf004c        sw      ra,76(sp)
+  dc:   afbe0048        sw      s8,72(sp)
+  e0:   03a0f021        move    s8,sp
+  e4:   8f820000        lw      v0,0(gp)
+  e8:   afc20044        sw      v0,68(s8)
+  ec:   8f820004        lw      v0,4(gp)
+  f0:   afc2003c        sw      v0,60(s8)
+  f4:   8f820008        lw      v0,8(gp)
+  f8:   afc20040        sw      v0,64(s8)
+  fc:   8f82000c        lw      v0,12(gp)
+ 100:   afc20030        sw      v0,48(s8)
+ 104:   8f820010        lw      v0,16(gp)
+ 108:   afc20034        sw      v0,52(s8)
+ 10c:   8f820014        lw      v0,20(gp)
+ 110:   afc20038        sw      v0,56(s8)
+ 114:   8f820018        lw      v0,24(gp)
+ 118:   8f83001c        lw      v1,28(gp)
+ 11c:   afc20028        sw      v0,40(s8)
+ 120:   afc3002c        sw      v1,44(s8)
+ 124:   8f820020        lw      v0,32(gp)
+ 128:   8f830024        lw      v1,36(gp)
+ 12c:   afc20018        sw      v0,24(s8)
+ 130:   afc3001c        sw      v1,28(s8)
+ 134:   8f820028        lw      v0,40(gp)
+ 138:   8f83002c        lw      v1,44(gp)
+ 13c:   afc20020        sw      v0,32(s8)
+ 140:   afc30024        sw      v1,36(s8)
+ 144:   8f820030        lw      v0,48(gp)
+ 148:   8f830034        lw      v1,52(gp)
+ 14c:   afc20000        sw      v0,0(s8)
+ 150:   afc30004        sw      v1,4(s8)
+ 154:   8f820038        lw      v0,56(gp)
+ 158:   8f83003c        lw      v1,60(gp)
+ 15c:   afc20008        sw      v0,8(s8)
+ 160:   afc3000c        sw      v1,12(s8)
+ 164:   8f820040        lw      v0,64(gp)
+ 168:   8f830044        lw      v1,68(gp)
+ 16c:   afc20010        sw      v0,16(s8)
+ 170:   afc30014        sw      v1,20(s8)
+ 174:   27c4003c        addiu   a0,s8,60
+ 178:   27c30030        addiu   v1,s8,48
+ 17c:   27c20018        addiu   v0,s8,24
+ 180:   c7cc0044        lwc1    $f12,68(s8)
+ 184:   00602821        move    a1,v1
+ 188:   8fc60028        lw      a2,40(s8)
+ 18c:   8fc7002c        lw      a3,44(s8)
+ 190:   00404021        move    t0,v0
+ 194:   03c04821        move    t1,s8
+ 198:   0c000000        jal     0 <leaf_call>
+ 19c:   00000000        nop
+ 1a0:   00001021        move    v0,zero
+ 1a4:   03c0e821        move    sp,s8
+ 1a8:   8fbf004c        lw      ra,76(sp)
+ 1ac:   8fbe0048        lw      s8,72(sp)
+ 1b0:   27bd0050        addiu   sp,sp,80
+ 1b4:   03e00008        jr      ra
+ 1b8:   00000000        nop
+
+
+
+; ---------- single-field structs by values (and small array fields) ---------->
+;
+; struct C { char c; };
+; struct S { short s; };
+; struct I { int i; };
+; struct F { float f; };
+; struct D { double d; };
+;
+; struct C2 { char c[2]; };
+; struct C3 { char c[3]; };
+;
+; void leaf_call(struct C2 a, struct C b, struct S c, struct I d, struct F e, struct D f, struct C3 g)
+; {
+; }
+;
+; int main()
+; {
+;     leaf_call((struct C2){{0,1}}, (struct C){2}, (struct S){3}, (struct I){4}, (struct F){5.f}, (struct D){6.}, (struct C3){{7,8,9}});
+;     return 0;
+; }
+
+
+
+; output from psptoolchain-20111215-psp w/ gcc 4.9.3
+
+00000000 <leaf_call>:
+   0:   27bdffd8        addiu   sp,sp,-40
+   4:   afbe0024        sw      s8,36(sp)
+   8:   03a0f021        move    s8,sp
+   c:   a7c40000        sh      a0,0(s8)
+  10:   a3c50004        sb      a1,4(s8)
+  14:   a7c60008        sh      a2,8(s8)
+  18:   afc7000c        sw      a3,12(s8)
+  1c:   e7cc0010        swc1    $f12,16(s8)
+  20:   afc80018        sw      t0,24(s8)
+  24:   afc9001c        sw      t1,28(s8)
+  28:   afca0014        sw      t2,20(s8)
+  2c:   03c0e821        move    sp,s8
+  30:   8fbe0024        lw      s8,36(sp)
+  34:   27bd0028        addiu   sp,sp,40
+  38:   03e00008        jr      ra
+  3c:   00000000        nop
+
+00000040 <main>:
+  40:   27bdffd0        addiu   sp,sp,-48
+  44:   afbf002c        sw      ra,44(sp)
+  48:   afbe0028        sw      s8,40(sp)
+  4c:   03a0f021        move    s8,sp
+  50:   a3c00020        sb      zero,32(s8)
+  54:   24020001        li      v0,1
+  58:   a3c20021        sb      v0,33(s8)
+  5c:   24020002        li      v0,2
+  60:   a3c2001c        sb      v0,28(s8)
+  64:   24020003        li      v0,3
+  68:   a7c20018        sh      v0,24(s8)
+  6c:   24020004        li      v0,4
+  70:   afc20014        sw      v0,20(s8)
+  74:   8f820000        lw      v0,0(gp)
+  78:   afc20010        sw      v0,16(s8)
+  7c:   8f820008        lw      v0,8(gp)
+  80:   8f83000c        lw      v1,12(gp)
+  84:   afc20008        sw      v0,8(s8)
+  88:   afc3000c        sw      v1,12(s8)
+  8c:   24020007        li      v0,7
+  90:   a3c20000        sb      v0,0(s8)
+  94:   24020008        li      v0,8
+  98:   a3c20001        sb      v0,1(s8)
+  9c:   24020009        li      v0,9
+  a0:   a3c20002        sb      v0,2(s8)
+  a4:   8fc40020        lw      a0,32(s8)
+  a8:   93c5001c        lbu     a1,28(s8)
+  ac:   97c60018        lhu     a2,24(s8)
+  b0:   8fc70014        lw      a3,20(s8)
+  b4:   c7cc0010        lwc1    $f12,16(s8)
+  b8:   8fc80008        lw      t0,8(s8)
+  bc:   8fc9000c        lw      t1,12(s8)
+  c0:   8fca0000        lw      t2,0(s8)
+  c4:   0c000000        jal     0 <leaf_call>
+  c8:   00000000        nop
+  cc:   00001021        move    v0,zero
+  d0:   03c0e821        move    sp,s8
+  d4:   8fbf002c        lw      ra,44(sp)
+  d8:   8fbe0028        lw      s8,40(sp)
+  dc:   27bd0030        addiu   sp,sp,48
+  e0:   03e00008        jr      ra
+  e4:   00000000        nop
+
+
+
+; ---------- C++ trivial and non-trivial aggrs passed to C funcs ---------->
+;
+; struct Trivial { int a; };
+; struct NonTrivial { int a; NonTrivial() : a(0) {} NonTrivial(const NonTrivial& rhs) : a(rhs.a) { } };
+;
+; extern "C" {
+; 
+;     void f1(struct Trivial s)    { }
+;     void f2(struct NonTrivial s) { }
+;
+;     void f()
+;     {
+;         struct Trivial t;
+;         struct NonTrivial n;
+;         int a=1;
+;         a += 123;
+;         f1(t);
+;         a -= 123;
+;         f2(n);
+;         a -= 12;
+;     }
+; }
+
+
+
+; output from psptoolchain-20111215-psp w/ gcc 4.9.3
+
+00000000 <f1>:
+   0:   27bdfff0        addiu   sp,sp,-16
+   4:   afbe000c        sw      s8,12(sp)
+   8:   03a0f021        move    s8,sp
+   c:   afc40000        sw      a0,0(s8)
+  10:   03c0e821        move    sp,s8
+  14:   8fbe000c        lw      s8,12(sp)
+  18:   27bd0010        addiu   sp,sp,16
+  1c:   03e00008        jr      ra
+  20:   00000000        nop
+
+00000024 <f2>:
+  24:   27bdfff0        addiu   sp,sp,-16
+  28:   afbe000c        sw      s8,12(sp)
+  2c:   03a0f021        move    s8,sp
+  30:   afc40000        sw      a0,0(s8)
+  34:   03c0e821        move    sp,s8
+  38:   8fbe000c        lw      s8,12(sp)
+  3c:   27bd0010        addiu   sp,sp,16
+  40:   03e00008        jr      ra
+  44:   00000000        nop
+
+00000048 <f>:
+  48:   27bdffe8        addiu   sp,sp,-24  ;
+  4c:   afbf0014        sw      ra,20(sp)  ;
+  50:   afbe0010        sw      s8,16(sp)  ;
+  54:   03a0f021        move    s8,sp      ;
+  58:   27c2000c        addiu   v0,s8,12   ;
+  5c:   00402021        move    a0,v0      ; |
+  60:   0c000000        jal     0 <f1>     ; | NonTrivial::NonTrivial() / ctor
+  64:   00000000        nop                ;
+  68:   24020001        li      v0,1       ; a = 1
+  6c:   afc20000        sw      v0,0(s8)   ;
+  70:   8fc20000        lw      v0,0(s8)   ;
+  74:   2442007b        addiu   v0,v0,123  ; a += 123
+  78:   afc20000        sw      v0,0(s8)   ;
+  7c:   8fc40008        lw      a0,8(s8)   ; |
+  80:   0c000000        jal     0 <f1>     ; | call f1(struct Trivial)
+  84:   00000000        nop                ;
+  88:   8fc20000        lw      v0,0(s8)   ;
+  8c:   2442ff85        addiu   v0,v0,-123 ; a -= 123
+  90:   afc20000        sw      v0,0(s8)   ;
+  94:   27c30004        addiu   v1,s8,4    ;
+  98:   27c2000c        addiu   v0,s8,12   ;
+  9c:   00602021        move    a0,v1      ; |               ptr to dest of copy of n
+  a0:   00402821        move    a1,v0      ; | copy n        ptr to n
+  a4:   0c000000        jal     0 <f1>     ; |               | NonTrivial::NonTrivial(const NonTrivial&) / copy ctor
+  a8:   00000000        nop                ;
+  ac:   27c20004        addiu   v0,s8,4    ; get ptr to copy of n -> v0
+  b0:   00402021        move    a0,v0      ; f2 arg 0 (ptr to copy of struct NonTrivial), via ptr as non-trivial
+  b4:   0c000000        jal     0 <f1>     ; call f2(struct NonTrivial)
+  b8:   00000000        nop                ;
+  bc:   8fc20000        lw      v0,0(s8)   ;
+  c0:   2442fff4        addiu   v0,v0,-12  ; a -= 12
+  c4:   afc20000        sw      v0,0(s8)   ;
+  c8:   03c0e821        move    sp,s8      ;
+  cc:   8fbf0014        lw      ra,20(sp)  ;
+  d0:   8fbe0010        lw      s8,16(sp)  ;
+  d4:   27bd0018        addiu   sp,sp,24   ;
+  d8:   03e00008        jr      ra         ;
+  dc:   00000000        nop                ;
+
+  ; ... snip, removed code of ctor and copy ctor ...
+
+
+
+; ---------- C++ trivial and non-trivial aggrs as return values ---------->
+;
+; struct Trivial { int a; };
+; struct NonTrivial { int a; NonTrivial() : a(0) {} NonTrivial(const NonTrivial& rhs) : a(rhs.a) { } };
+; 
+; extern "C" {
+;     struct Trivial    f1() { return Trivial(); }
+; }
+; 
+;     struct NonTrivial f2() { return NonTrivial(); }
+; 
+; extern "C" {
+;     void f()
+;     {
+;         int a=1;
+;         a += 123;
+;         struct Trivial t = f1();
+;         a -= 123;
+;         struct NonTrivial n = f2();
+;         a -= 12;
+;     }
+; }
+
+
+
+; output from psptoolchain-20111215-psp w/ gcc 4.9.3
+
+00000000 <f1>:
+   0:   27bdfff8        addiu   sp,sp,-8
+   4:   afbe0004        sw      s8,4(sp)
+   8:   03a0f021        move    s8,sp
+   c:   00001021        move    v0,zero
+  10:   03c0e821        move    sp,s8
+  14:   8fbe0004        lw      s8,4(sp)
+  18:   27bd0008        addiu   sp,sp,8
+  1c:   03e00008        jr      ra
+  20:   00000000        nop
+
+00000024 <_Z2f2v>:
+  24:   27bdfff0        addiu   sp,sp,-16 ;
+  28:   afbf000c        sw      ra,12(sp) ;
+  2c:   afbe0008        sw      s8,8(sp)  ;
+  30:   03a0f021        move    s8,sp     ;
+  34:   afc40000        sw      a0,0(s8)  ;
+  38:   8fc40000        lw      a0,0(s8)  ;
+  3c:   0c000000        jal     0 <f1>    ;
+  40:   00000000        nop               ;
+  44:   8fc20000        lw      v0,0(s8)  ; retval, return (hidden) passed-in ptr to space for retval
+  48:   03c0e821        move    sp,s8     ;
+  4c:   8fbf000c        lw      ra,12(sp) ;
+  50:   8fbe0008        lw      s8,8(sp)  ;
+  54:   27bd0010        addiu   sp,sp,16  ;
+  58:   03e00008        jr      ra        ;
+  5c:   00000000        nop               ;
+
+00000060 <f>:
+  60:   27bdffe8        addiu   sp,sp,-24  ;
+  64:   afbf0014        sw      ra,20(sp)  ;
+  68:   afbe0010        sw      s8,16(sp)  ;
+  6c:   03a0f021        move    s8,sp      ;
+  70:   24020001        li      v0,1       ; a = 1
+  74:   afc20000        sw      v0,0(s8)   ;
+  78:   8fc20000        lw      v0,0(s8)   ;
+  7c:   2442007b        addiu   v0,v0,123  ; a += 123
+  80:   afc20000        sw      v0,0(s8)   ;
+  84:   0c000000        jal     0 <f1>     ; call f1(), struct returned via as trivial and <= 64bit
+  88:   00000000        nop                ;
+  8c:   afc20004        sw      v0,4(s8)   ;
+  90:   8fc20000        lw      v0,0(s8)   ;
+  94:   2442ff85        addiu   v0,v0,-123 ; a -= 123
+  98:   afc20000        sw      v0,0(s8)   ;
+  9c:   27c20008        addiu   v0,s8,8    ;
+  a0:   00402021        move    a0,v0      ; hidden first arg (ptr to space for ret val)
+  a4:   0c000000        jal     0 <f1>     ; call f2(), result returned indirectly as struct nontrivial
+  a8:   00000000        nop                ;
+  ac:   8fc20000        lw      v0,0(s8)   ;
+  b0:   2442fff4        addiu   v0,v0,-12  ; a -= 12
+  b4:   afc20000        sw      v0,0(s8)   ;
+  b8:   03c0e821        move    sp,s8      ;
+  bc:   8fbf0014        lw      ra,20(sp)  ;
+  c0:   8fbe0010        lw      s8,16(sp)  ;
+  c4:   27bd0018        addiu   sp,sp,24   ;
+  c8:   03e00008        jr      ra         ;
+  cc:   00000000        nop                ;
+
+  ; ... snip, removed code of ctor ...
+
+
+
 ; vim: ft=asm