Mercurial > pub > dyncall > dyncall
comparison doc/disas_examples/mips.eabi.disas @ 529:fe694c7677b4
- mips eabi doc disas examples
author | Tassilo Philipp |
---|---|
date | Thu, 14 Apr 2022 21:18:02 +0200 |
parents | 06c9adae114d |
children |
comparison
equal
deleted
inserted
replaced
528:e56241bba0f5 | 529:fe694c7677b4 |
---|---|
607 94: afc9003c sw t1,60(s8) | 607 94: afc9003c sw t1,60(s8) |
608 98: afca0040 sw t2,64(s8) | 608 98: afca0040 sw t2,64(s8) |
609 9c: afcb0044 sw t3,68(s8) | 609 9c: afcb0044 sw t3,68(s8) |
610 | 610 |
611 | 611 |
612 | |
613 ; ---------- structs by value ----------> | |
614 ; | |
615 ; struct A { int i, j; long long l; }; | |
616 ; | |
617 ; void leaf_call(int b, int c, int d, int e, struct A f, int g, int h) | |
618 ; { | |
619 ; } | |
620 ; | |
621 ; void nonleaf_call(int a, int b, int c, int d, int e, struct A f, int g, int h) | |
622 ; { | |
623 ; /* use some local data */ | |
624 ; char l[100] ={ 'L'}; | |
625 ; leaf_call(b, c, d, e, f, g, h); | |
626 ; } | |
627 ; | |
628 ; int main() | |
629 ; { | |
630 ; nonleaf_call(0, 1, 2, 3, 4, (struct A){5, 6, 7ll}, 8, 9); | |
631 ; return 0; | |
632 ; } | |
633 | |
634 | |
635 | |
636 ; output from psptoolchain-20111215-psp w/ gcc 4.9.3 | |
637 | |
638 00000000 <leaf_call>: | |
639 0: 27bdffd0 addiu sp,sp,-48 | |
640 4: afbe002c sw s8,44(sp) | |
641 8: afb00028 sw s0,40(sp) | |
642 c: 03a0f021 move s8,sp | |
643 10: afc40010 sw a0,16(s8) | |
644 14: afc50014 sw a1,20(s8) | |
645 18: afc60018 sw a2,24(s8) | |
646 1c: afc7001c sw a3,28(s8) | |
647 20: 01008021 move s0,t0 | |
648 24: afc90020 sw t1,32(s8) | |
649 28: afca0024 sw t2,36(s8) | |
650 2c: 8e050000 lw a1,0(s0) | |
651 30: 8e040004 lw a0,4(s0) | |
652 34: 8e030008 lw v1,8(s0) | |
653 38: 8e02000c lw v0,12(s0) | |
654 3c: afc50000 sw a1,0(s8) | |
655 40: afc40004 sw a0,4(s8) | |
656 44: afc30008 sw v1,8(s8) | |
657 48: afc2000c sw v0,12(s8) | |
658 4c: 03c0e821 move sp,s8 | |
659 50: 8fbe002c lw s8,44(sp) | |
660 54: 8fb00028 lw s0,40(sp) | |
661 58: 27bd0030 addiu sp,sp,48 | |
662 5c: 03e00008 jr ra | |
663 60: 00000000 nop | |
664 | |
665 00000064 <nonleaf_call>: | |
666 64: 27bdff58 addiu sp,sp,-168 | |
667 68: afbf00a4 sw ra,164(sp) | |
668 6c: afbe00a0 sw s8,160(sp) | |
669 70: afb0009c sw s0,156(sp) | |
670 74: 03a0f021 move s8,sp | |
671 78: afc40078 sw a0,120(s8) | |
672 7c: afc5007c sw a1,124(s8) | |
673 80: afc60080 sw a2,128(s8) | |
674 84: afc70084 sw a3,132(s8) | |
675 88: afc80088 sw t0,136(s8) | |
676 8c: 01208021 move s0,t1 | |
677 90: afca008c sw t2,140(s8) | |
678 94: afcb0090 sw t3,144(s8) | |
679 98: 8e050000 lw a1,0(s0) | |
680 9c: 8e040004 lw a0,4(s0) | |
681 a0: 8e030008 lw v1,8(s0) | |
682 a4: 8e02000c lw v0,12(s0) | |
683 a8: afc50000 sw a1,0(s8) | |
684 ac: afc40004 sw a0,4(s8) | |
685 b0: afc30008 sw v1,8(s8) | |
686 b4: afc2000c sw v0,12(s8) | |
687 b8: 27c30010 addiu v1,s8,16 | |
688 bc: 24020064 li v0,100 | |
689 c0: 00602021 move a0,v1 | |
690 c4: 00002821 move a1,zero | |
691 c8: 00403021 move a2,v0 | |
692 cc: 0c000000 jal 0 <leaf_call> | |
693 d0: 00000000 nop | |
694 d4: 2402004c li v0,76 | |
695 d8: a3c20010 sb v0,16(s8) | |
696 dc: 8fc4007c lw a0,124(s8) | |
697 e0: 8fc50080 lw a1,128(s8) | |
698 e4: 8fc60084 lw a2,132(s8) | |
699 e8: 8fc70088 lw a3,136(s8) | |
700 ec: 03c04021 move t0,s8 | |
701 f0: 8fc9008c lw t1,140(s8) | |
702 f4: 8fca0090 lw t2,144(s8) | |
703 f8: 0c000000 jal 0 <leaf_call> | |
704 fc: 00000000 nop | |
705 100: 03c0e821 move sp,s8 | |
706 104: 8fbf00a4 lw ra,164(sp) | |
707 108: 8fbe00a0 lw s8,160(sp) | |
708 10c: 8fb0009c lw s0,156(sp) | |
709 110: 27bd00a8 addiu sp,sp,168 | |
710 114: 03e00008 jr ra | |
711 118: 00000000 nop | |
712 | |
713 0000011c <main>: | |
714 11c: 27bdffe8 addiu sp,sp,-24 | |
715 120: afbf0014 sw ra,20(sp) | |
716 124: afbe0010 sw s8,16(sp) | |
717 128: 03a0f021 move s8,sp | |
718 12c: 24020005 li v0,5 | |
719 130: afc20000 sw v0,0(s8) | |
720 134: 24020006 li v0,6 | |
721 138: afc20004 sw v0,4(s8) | |
722 13c: 24020007 li v0,7 | |
723 140: 00001821 move v1,zero | |
724 144: afc20008 sw v0,8(s8) | |
725 148: afc3000c sw v1,12(s8) | |
726 14c: 00002021 move a0,zero | |
727 150: 24050001 li a1,1 | |
728 154: 24060002 li a2,2 | |
729 158: 24070003 li a3,3 | |
730 15c: 24080004 li t0,4 | |
731 160: 03c04821 move t1,s8 | |
732 164: 240a0008 li t2,8 | |
733 168: 240b0009 li t3,9 | |
734 16c: 0c000000 jal 0 <leaf_call> | |
735 170: 00000000 nop | |
736 174: 00001021 move v0,zero | |
737 178: 03c0e821 move sp,s8 | |
738 17c: 8fbf0014 lw ra,20(sp) | |
739 180: 8fbe0010 lw s8,16(sp) | |
740 184: 27bd0018 addiu sp,sp,24 | |
741 188: 03e00008 jr ra | |
742 18c: 00000000 nop | |
743 | |
744 | |
745 | |
746 | |
747 ; ---------- structs by value, complex example (multiple structs) ----------> | |
748 ; | |
749 ; struct A { int i, j; float f; }; | |
750 ; struct B { double d; long long l; }; | |
751 ; | |
752 ; 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) | |
753 ; { | |
754 ; } | |
755 ; | |
756 ; 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) | |
757 ; { | |
758 ; /* use some local data */ | |
759 ; char l[100] ={ 'L'}; | |
760 ; leaf_call(b, c, d, e, f, g, h, i, j); | |
761 ; } | |
762 ; | |
763 ; int main() | |
764 ; { | |
765 ; 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); | |
766 ; return 0; | |
767 ; } | |
768 | |
769 | |
770 | |
771 ; output from psptoolchain-20111215-psp w/ gcc 4.9.3 | |
772 | |
773 00000000 <leaf_call>: | |
774 0: 27bdff98 addiu sp,sp,-104 | |
775 4: afbe0064 sw s8,100(sp) | |
776 8: afb30060 sw s3,96(sp) | |
777 c: afb2005c sw s2,92(sp) | |
778 10: afb10058 sw s1,88(sp) | |
779 14: afb00054 sw s0,84(sp) | |
780 18: 03a0f021 move s8,sp | |
781 1c: afc40040 sw a0,64(s8) | |
782 20: 00a09821 move s3,a1 | |
783 24: 00c08821 move s1,a2 | |
784 28: afc70044 sw a3,68(s8) | |
785 2c: afc80048 sw t0,72(s8) | |
786 30: 01209021 move s2,t1 | |
787 34: 01408021 move s0,t2 | |
788 38: afcb004c sw t3,76(s8) | |
789 3c: 8e640000 lw a0,0(s3) | |
790 40: 8e630004 lw v1,4(s3) | |
791 44: 8e620008 lw v0,8(s3) | |
792 48: afc40030 sw a0,48(s8) | |
793 4c: afc30034 sw v1,52(s8) | |
794 50: afc20038 sw v0,56(s8) | |
795 54: 8e250000 lw a1,0(s1) | |
796 58: 8e240004 lw a0,4(s1) | |
797 5c: 8e230008 lw v1,8(s1) | |
798 60: 8e22000c lw v0,12(s1) | |
799 64: afc50020 sw a1,32(s8) | |
800 68: afc40024 sw a0,36(s8) | |
801 6c: afc30028 sw v1,40(s8) | |
802 70: afc2002c sw v0,44(s8) | |
803 74: 8e440000 lw a0,0(s2) | |
804 78: 8e430004 lw v1,4(s2) | |
805 7c: 8e420008 lw v0,8(s2) | |
806 80: afc40010 sw a0,16(s8) | |
807 84: afc30014 sw v1,20(s8) | |
808 88: afc20018 sw v0,24(s8) | |
809 8c: 8e050000 lw a1,0(s0) | |
810 90: 8e040004 lw a0,4(s0) | |
811 94: 8e030008 lw v1,8(s0) | |
812 98: 8e02000c lw v0,12(s0) | |
813 9c: afc50000 sw a1,0(s8) | |
814 a0: afc40004 sw a0,4(s8) | |
815 a4: afc30008 sw v1,8(s8) | |
816 a8: afc2000c sw v0,12(s8) | |
817 ac: 03c0e821 move sp,s8 | |
818 b0: 8fbe0064 lw s8,100(sp) | |
819 b4: 8fb30060 lw s3,96(sp) | |
820 b8: 8fb2005c lw s2,92(sp) | |
821 bc: 8fb10058 lw s1,88(sp) | |
822 c0: 8fb00054 lw s0,84(sp) | |
823 c4: 27bd0068 addiu sp,sp,104 | |
824 c8: 03e00008 jr ra | |
825 cc: 00000000 nop | |
826 | |
827 000000d0 <nonleaf_call>: | |
828 d0: 27bdff30 addiu sp,sp,-208 | |
829 d4: afbf00cc sw ra,204(sp) | |
830 d8: afbe00c8 sw s8,200(sp) | |
831 dc: afb300c4 sw s3,196(sp) | |
832 e0: afb200c0 sw s2,192(sp) | |
833 e4: afb100bc sw s1,188(sp) | |
834 e8: afb000b8 sw s0,184(sp) | |
835 ec: 03a0f021 move s8,sp | |
836 f0: afc400a8 sw a0,168(s8) | |
837 f4: afc500ac sw a1,172(s8) | |
838 f8: 00c09821 move s3,a2 | |
839 fc: 00e08821 move s1,a3 | |
840 100: afc800b0 sw t0,176(s8) | |
841 104: afc900b4 sw t1,180(s8) | |
842 108: 01409021 move s2,t2 | |
843 10c: 01608021 move s0,t3 | |
844 110: 8e640000 lw a0,0(s3) | |
845 114: 8e630004 lw v1,4(s3) | |
846 118: 8e620008 lw v0,8(s3) | |
847 11c: afc40038 sw a0,56(s8) | |
848 120: afc3003c sw v1,60(s8) | |
849 124: afc20040 sw v0,64(s8) | |
850 128: 8e250000 lw a1,0(s1) | |
851 12c: 8e240004 lw a0,4(s1) | |
852 130: 8e230008 lw v1,8(s1) | |
853 134: 8e22000c lw v0,12(s1) | |
854 138: afc50028 sw a1,40(s8) | |
855 13c: afc4002c sw a0,44(s8) | |
856 140: afc30030 sw v1,48(s8) | |
857 144: afc20034 sw v0,52(s8) | |
858 148: 8e440000 lw a0,0(s2) | |
859 14c: 8e430004 lw v1,4(s2) | |
860 150: 8e420008 lw v0,8(s2) | |
861 154: afc40018 sw a0,24(s8) | |
862 158: afc3001c sw v1,28(s8) | |
863 15c: afc20020 sw v0,32(s8) | |
864 160: 8e050000 lw a1,0(s0) | |
865 164: 8e040004 lw a0,4(s0) | |
866 168: 8e030008 lw v1,8(s0) | |
867 16c: 8e02000c lw v0,12(s0) | |
868 170: afc50008 sw a1,8(s8) | |
869 174: afc4000c sw a0,12(s8) | |
870 178: afc30010 sw v1,16(s8) | |
871 17c: afc20014 sw v0,20(s8) | |
872 180: 27c30044 addiu v1,s8,68 | |
873 184: 24020064 li v0,100 | |
874 188: 00602021 move a0,v1 | |
875 18c: 00002821 move a1,zero | |
876 190: 00403021 move a2,v0 | |
877 194: 0c000000 jal 0 <leaf_call> | |
878 198: 00000000 nop | |
879 19c: 2402004c li v0,76 | |
880 1a0: a3c20044 sb v0,68(s8) | |
881 1a4: 27c50038 addiu a1,s8,56 | |
882 1a8: 27c60028 addiu a2,s8,40 | |
883 1ac: 27c30018 addiu v1,s8,24 | |
884 1b0: 8fc200d4 lw v0,212(s8) | |
885 1b4: afa20000 sw v0,0(sp) | |
886 1b8: 8fc400ac lw a0,172(s8) | |
887 1bc: 8fc700b0 lw a3,176(s8) | |
888 1c0: 8fc800b4 lw t0,180(s8) | |
889 1c4: 00604821 move t1,v1 | |
890 1c8: 27c20008 addiu v0,s8,8 | |
891 1cc: 00405021 move t2,v0 | |
892 1d0: 8fcb00d0 lw t3,208(s8) | |
893 1d4: 0c000000 jal 0 <leaf_call> | |
894 1d8: 00000000 nop | |
895 1dc: 03c0e821 move sp,s8 | |
896 1e0: 8fbf00cc lw ra,204(sp) | |
897 1e4: 8fbe00c8 lw s8,200(sp) | |
898 1e8: 8fb300c4 lw s3,196(sp) | |
899 1ec: 8fb200c0 lw s2,192(sp) | |
900 1f0: 8fb100bc lw s1,188(sp) | |
901 1f4: 8fb000b8 lw s0,184(sp) | |
902 1f8: 27bd00d0 addiu sp,sp,208 | |
903 1fc: 03e00008 jr ra | |
904 200: 00000000 nop | |
905 | |
906 00000204 <main>: | |
907 204: 27bdffb0 addiu sp,sp,-80 | |
908 208: afbf004c sw ra,76(sp) | |
909 20c: afbe0048 sw s8,72(sp) | |
910 210: 03a0f021 move s8,sp | |
911 214: 24020002 li v0,2 | |
912 218: afc20038 sw v0,56(s8) | |
913 21c: 24020003 li v0,3 | |
914 220: afc2003c sw v0,60(s8) | |
915 224: 8f820000 lw v0,0(gp) | |
916 228: afc20040 sw v0,64(s8) | |
917 22c: 8f820008 lw v0,8(gp) | |
918 230: 8f83000c lw v1,12(gp) | |
919 234: afc20028 sw v0,40(s8) | |
920 238: afc3002c sw v1,44(s8) | |
921 23c: 24020006 li v0,6 | |
922 240: 00001821 move v1,zero | |
923 244: afc20030 sw v0,48(s8) | |
924 248: afc30034 sw v1,52(s8) | |
925 24c: 24020009 li v0,9 | |
926 250: afc20018 sw v0,24(s8) | |
927 254: 2402000a li v0,10 | |
928 258: afc2001c sw v0,28(s8) | |
929 25c: 8f820010 lw v0,16(gp) | |
930 260: afc20020 sw v0,32(s8) | |
931 264: 8f820018 lw v0,24(gp) | |
932 268: 8f83001c lw v1,28(gp) | |
933 26c: afc20008 sw v0,8(s8) | |
934 270: afc3000c sw v1,12(s8) | |
935 274: 2402000d li v0,13 | |
936 278: 00001821 move v1,zero | |
937 27c: afc20010 sw v0,16(s8) | |
938 280: afc30014 sw v1,20(s8) | |
939 284: 27c60038 addiu a2,s8,56 | |
940 288: 27c70028 addiu a3,s8,40 | |
941 28c: 27c30018 addiu v1,s8,24 | |
942 290: 2402000e li v0,14 | |
943 294: afa20000 sw v0,0(sp) | |
944 298: 2402000f li v0,15 | |
945 29c: afa20004 sw v0,4(sp) | |
946 2a0: 00002021 move a0,zero | |
947 2a4: 24050001 li a1,1 | |
948 2a8: 24080007 li t0,7 | |
949 2ac: 24090008 li t1,8 | |
950 2b0: 00605021 move t2,v1 | |
951 2b4: 27c20008 addiu v0,s8,8 | |
952 2b8: 00405821 move t3,v0 | |
953 2bc: 0c000000 jal 0 <leaf_call> | |
954 2c0: 00000000 nop | |
955 2c4: 00001021 move v0,zero | |
956 2c8: 03c0e821 move sp,s8 | |
957 2cc: 8fbf004c lw ra,76(sp) | |
958 2d0: 8fbe0048 lw s8,72(sp) | |
959 2d4: 27bd0050 addiu sp,sp,80 | |
960 2d8: 03e00008 jr ra | |
961 2dc: 00000000 nop | |
962 | |
963 | |
964 | |
965 | |
966 ; ---------- returning structs by value ----------> | |
967 ; | |
968 ; struct Small { char x; }; | |
969 ; struct Big { long long i,j,k,l; long m; }; /* bigger than 16b */ | |
970 ; | |
971 ; struct Small f0() | |
972 ; { | |
973 ; struct Small s = { 132 }; | |
974 ; return s; | |
975 ; } | |
976 ; | |
977 ; struct Big f1() | |
978 ; { | |
979 ; struct Big b = { 7171LL, 99LL, -99LL, -3102LL, 32 }; | |
980 ; return b; | |
981 ; } | |
982 ; | |
983 ; int main() | |
984 ; { | |
985 ; struct Small s = f0(); | |
986 ; struct Big b = f1(); | |
987 ; return b.j + b.k + b.m + s.x; | |
988 ; } | |
989 | |
990 | |
991 | |
992 ; output from psptoolchain-20111215-psp w/ gcc 4.9.3 | |
993 | |
994 00000000 <f0>: | |
995 0: 27bdfff0 addiu sp,sp,-16 | |
996 4: afbe000c sw s8,12(sp) | |
997 8: 03a0f021 move s8,sp | |
998 c: 2402ff84 li v0,-124 | |
999 10: a3c20000 sb v0,0(s8) | |
1000 14: 93c20000 lbu v0,0(s8) | |
1001 18: 03c0e821 move sp,s8 | |
1002 1c: 8fbe000c lw s8,12(sp) | |
1003 20: 27bd0010 addiu sp,sp,16 | |
1004 24: 03e00008 jr ra | |
1005 28: 00000000 nop | |
1006 | |
1007 0000002c <f1>: | |
1008 2c: 27bdffc8 addiu sp,sp,-56 | |
1009 30: afbf0034 sw ra,52(sp) | |
1010 34: afbe0030 sw s8,48(sp) | |
1011 38: 03a0f021 move s8,sp | |
1012 3c: afc40028 sw a0,40(s8) | |
1013 40: 3c020000 lui v0,0x0 | |
1014 44: 03c02021 move a0,s8 | |
1015 48: 24430000 addiu v1,v0,0 | |
1016 4c: 24020028 li v0,40 | |
1017 50: 00602821 move a1,v1 | |
1018 54: 00403021 move a2,v0 | |
1019 58: 0c000000 jal 0 <f0> | |
1020 5c: 00000000 nop | |
1021 60: 8fc20028 lw v0,40(s8) | |
1022 64: 00402021 move a0,v0 | |
1023 68: 03c01821 move v1,s8 | |
1024 6c: 24020028 li v0,40 | |
1025 70: 00602821 move a1,v1 | |
1026 74: 00403021 move a2,v0 | |
1027 78: 0c000000 jal 0 <f0> | |
1028 7c: 00000000 nop | |
1029 80: 8fc20028 lw v0,40(s8) | |
1030 84: 03c0e821 move sp,s8 | |
1031 88: 8fbf0034 lw ra,52(sp) | |
1032 8c: 8fbe0030 lw s8,48(sp) | |
1033 90: 27bd0038 addiu sp,sp,56 | |
1034 94: 03e00008 jr ra | |
1035 98: 00000000 nop | |
1036 | |
1037 0000009c <main>: | |
1038 9c: 27bdffc8 addiu sp,sp,-56 | |
1039 a0: afbf0034 sw ra,52(sp) | |
1040 a4: afbe0030 sw s8,48(sp) | |
1041 a8: 03a0f021 move s8,sp | |
1042 ac: 0c000000 jal 0 <f0> | |
1043 b0: 00000000 nop | |
1044 b4: a3c20000 sb v0,0(s8) | |
1045 b8: 27c20008 addiu v0,s8,8 | |
1046 bc: 00402021 move a0,v0 | |
1047 c0: 0c000000 jal 0 <f0> | |
1048 c4: 00000000 nop | |
1049 c8: 8fc20010 lw v0,16(s8) | |
1050 cc: 8fc30014 lw v1,20(s8) | |
1051 d0: 00402021 move a0,v0 | |
1052 d4: 8fc20018 lw v0,24(s8) | |
1053 d8: 8fc3001c lw v1,28(s8) | |
1054 dc: 00821021 addu v0,a0,v0 | |
1055 e0: 8fc30028 lw v1,40(s8) | |
1056 e4: 00431021 addu v0,v0,v1 | |
1057 e8: 83c30000 lb v1,0(s8) | |
1058 ec: 00431021 addu v0,v0,v1 | |
1059 f0: 03c0e821 move sp,s8 | |
1060 f4: 8fbf0034 lw ra,52(sp) | |
1061 f8: 8fbe0030 lw s8,48(sp) | |
1062 fc: 27bd0038 addiu sp,sp,56 | |
1063 100: 03e00008 jr ra | |
1064 104: 00000000 nop | |
1065 | |
1066 | |
1067 | |
1068 ; ---------- returning long long ----------> | |
1069 ; | |
1070 ; long long f() | |
1071 ; { | |
1072 ; return 7171LL; | |
1073 ; } | |
1074 ; | |
1075 ; int main() | |
1076 ; { | |
1077 ; return (int)f(); | |
1078 ; } | |
1079 | |
1080 | |
1081 | |
1082 ; output from psptoolchain-20111215-psp w/ gcc 4.9.3 | |
1083 | |
1084 00000000 <f>: | |
1085 0: 27bdfff8 addiu sp,sp,-8 | |
1086 4: afbe0004 sw s8,4(sp) | |
1087 8: 03a0f021 move s8,sp | |
1088 c: 24021c03 li v0,7171 | |
1089 10: 00001821 move v1,zero | |
1090 14: 03c0e821 move sp,s8 | |
1091 18: 8fbe0004 lw s8,4(sp) | |
1092 1c: 27bd0008 addiu sp,sp,8 | |
1093 20: 03e00008 jr ra | |
1094 24: 00000000 nop | |
1095 | |
1096 00000028 <main>: | |
1097 28: 27bdfff8 addiu sp,sp,-8 | |
1098 2c: afbf0004 sw ra,4(sp) | |
1099 30: afbe0000 sw s8,0(sp) | |
1100 34: 03a0f021 move s8,sp | |
1101 38: 0c000000 jal 0 <f> | |
1102 3c: 00000000 nop | |
1103 40: 03c0e821 move sp,s8 | |
1104 44: 8fbf0004 lw ra,4(sp) | |
1105 48: 8fbe0000 lw s8,0(sp) | |
1106 4c: 27bd0008 addiu sp,sp,8 | |
1107 50: 03e00008 jr ra | |
1108 54: 00000000 nop | |
1109 | |
1110 | |
1111 | |
1112 ; ---------- passing structs with only fp parts ----------> | |
1113 ; | |
1114 ; struct A { float a; }; | |
1115 ; struct B { float a, b; }; | |
1116 ; struct C { float a, b, c; }; | |
1117 ; struct D { double a; }; | |
1118 ; struct E { double a, b; }; | |
1119 ; struct F { double a, b, c; }; | |
1120 ; | |
1121 ; void leaf_call(struct A a, struct B b, struct C c, struct D d, struct E e, struct F f) | |
1122 ; { | |
1123 ; } | |
1124 ; | |
1125 ; int main() | |
1126 ; { | |
1127 ; 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.}); | |
1128 ; return 0; | |
1129 ; } | |
1130 | |
1131 | |
1132 | |
1133 ; output from psptoolchain-20111215-psp w/ gcc 4.9.3 | |
1134 | |
1135 00000000 <leaf_call>: | |
1136 0: 27bdff98 addiu sp,sp,-104 | |
1137 4: afbe0064 sw s8,100(sp) | |
1138 8: afb30060 sw s3,96(sp) | |
1139 c: afb2005c sw s2,92(sp) | |
1140 10: afb10058 sw s1,88(sp) | |
1141 14: afb00054 sw s0,84(sp) | |
1142 18: 03a0f021 move s8,sp | |
1143 1c: e7cc0040 swc1 $f12,64(s8) | |
1144 20: 00809821 move s3,a0 | |
1145 24: 00a09021 move s2,a1 | |
1146 28: afc60048 sw a2,72(s8) | |
1147 2c: afc7004c sw a3,76(s8) | |
1148 30: 01008821 move s1,t0 | |
1149 34: 01208021 move s0,t1 | |
1150 38: 8e630000 lw v1,0(s3) | |
1151 3c: 8e620004 lw v0,4(s3) | |
1152 40: afc30034 sw v1,52(s8) | |
1153 44: afc20038 sw v0,56(s8) | |
1154 48: 8e440000 lw a0,0(s2) | |
1155 4c: 8e430004 lw v1,4(s2) | |
1156 50: 8e420008 lw v0,8(s2) | |
1157 54: afc40028 sw a0,40(s8) | |
1158 58: afc3002c sw v1,44(s8) | |
1159 5c: afc20030 sw v0,48(s8) | |
1160 60: 8e250000 lw a1,0(s1) | |
1161 64: 8e240004 lw a0,4(s1) | |
1162 68: 8e230008 lw v1,8(s1) | |
1163 6c: 8e22000c lw v0,12(s1) | |
1164 70: afc50018 sw a1,24(s8) | |
1165 74: afc4001c sw a0,28(s8) | |
1166 78: afc30020 sw v1,32(s8) | |
1167 7c: afc20024 sw v0,36(s8) | |
1168 80: 8e070000 lw a3,0(s0) | |
1169 84: 8e060004 lw a2,4(s0) | |
1170 88: 8e050008 lw a1,8(s0) | |
1171 8c: 8e04000c lw a0,12(s0) | |
1172 90: 8e030010 lw v1,16(s0) | |
1173 94: 8e020014 lw v0,20(s0) | |
1174 98: afc70000 sw a3,0(s8) | |
1175 9c: afc60004 sw a2,4(s8) | |
1176 a0: afc50008 sw a1,8(s8) | |
1177 a4: afc4000c sw a0,12(s8) | |
1178 a8: afc30010 sw v1,16(s8) | |
1179 ac: afc20014 sw v0,20(s8) | |
1180 b0: 03c0e821 move sp,s8 | |
1181 b4: 8fbe0064 lw s8,100(sp) | |
1182 b8: 8fb30060 lw s3,96(sp) | |
1183 bc: 8fb2005c lw s2,92(sp) | |
1184 c0: 8fb10058 lw s1,88(sp) | |
1185 c4: 8fb00054 lw s0,84(sp) | |
1186 c8: 27bd0068 addiu sp,sp,104 | |
1187 cc: 03e00008 jr ra | |
1188 d0: 00000000 nop | |
1189 | |
1190 000000d4 <main>: | |
1191 d4: 27bdffb0 addiu sp,sp,-80 | |
1192 d8: afbf004c sw ra,76(sp) | |
1193 dc: afbe0048 sw s8,72(sp) | |
1194 e0: 03a0f021 move s8,sp | |
1195 e4: 8f820000 lw v0,0(gp) | |
1196 e8: afc20044 sw v0,68(s8) | |
1197 ec: 8f820004 lw v0,4(gp) | |
1198 f0: afc2003c sw v0,60(s8) | |
1199 f4: 8f820008 lw v0,8(gp) | |
1200 f8: afc20040 sw v0,64(s8) | |
1201 fc: 8f82000c lw v0,12(gp) | |
1202 100: afc20030 sw v0,48(s8) | |
1203 104: 8f820010 lw v0,16(gp) | |
1204 108: afc20034 sw v0,52(s8) | |
1205 10c: 8f820014 lw v0,20(gp) | |
1206 110: afc20038 sw v0,56(s8) | |
1207 114: 8f820018 lw v0,24(gp) | |
1208 118: 8f83001c lw v1,28(gp) | |
1209 11c: afc20028 sw v0,40(s8) | |
1210 120: afc3002c sw v1,44(s8) | |
1211 124: 8f820020 lw v0,32(gp) | |
1212 128: 8f830024 lw v1,36(gp) | |
1213 12c: afc20018 sw v0,24(s8) | |
1214 130: afc3001c sw v1,28(s8) | |
1215 134: 8f820028 lw v0,40(gp) | |
1216 138: 8f83002c lw v1,44(gp) | |
1217 13c: afc20020 sw v0,32(s8) | |
1218 140: afc30024 sw v1,36(s8) | |
1219 144: 8f820030 lw v0,48(gp) | |
1220 148: 8f830034 lw v1,52(gp) | |
1221 14c: afc20000 sw v0,0(s8) | |
1222 150: afc30004 sw v1,4(s8) | |
1223 154: 8f820038 lw v0,56(gp) | |
1224 158: 8f83003c lw v1,60(gp) | |
1225 15c: afc20008 sw v0,8(s8) | |
1226 160: afc3000c sw v1,12(s8) | |
1227 164: 8f820040 lw v0,64(gp) | |
1228 168: 8f830044 lw v1,68(gp) | |
1229 16c: afc20010 sw v0,16(s8) | |
1230 170: afc30014 sw v1,20(s8) | |
1231 174: 27c4003c addiu a0,s8,60 | |
1232 178: 27c30030 addiu v1,s8,48 | |
1233 17c: 27c20018 addiu v0,s8,24 | |
1234 180: c7cc0044 lwc1 $f12,68(s8) | |
1235 184: 00602821 move a1,v1 | |
1236 188: 8fc60028 lw a2,40(s8) | |
1237 18c: 8fc7002c lw a3,44(s8) | |
1238 190: 00404021 move t0,v0 | |
1239 194: 03c04821 move t1,s8 | |
1240 198: 0c000000 jal 0 <leaf_call> | |
1241 19c: 00000000 nop | |
1242 1a0: 00001021 move v0,zero | |
1243 1a4: 03c0e821 move sp,s8 | |
1244 1a8: 8fbf004c lw ra,76(sp) | |
1245 1ac: 8fbe0048 lw s8,72(sp) | |
1246 1b0: 27bd0050 addiu sp,sp,80 | |
1247 1b4: 03e00008 jr ra | |
1248 1b8: 00000000 nop | |
1249 | |
1250 | |
1251 | |
1252 ; ---------- single-field structs by values (and small array fields) ----------> | |
1253 ; | |
1254 ; struct C { char c; }; | |
1255 ; struct S { short s; }; | |
1256 ; struct I { int i; }; | |
1257 ; struct F { float f; }; | |
1258 ; struct D { double d; }; | |
1259 ; | |
1260 ; struct C2 { char c[2]; }; | |
1261 ; struct C3 { char c[3]; }; | |
1262 ; | |
1263 ; void leaf_call(struct C2 a, struct C b, struct S c, struct I d, struct F e, struct D f, struct C3 g) | |
1264 ; { | |
1265 ; } | |
1266 ; | |
1267 ; int main() | |
1268 ; { | |
1269 ; 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}}); | |
1270 ; return 0; | |
1271 ; } | |
1272 | |
1273 | |
1274 | |
1275 ; output from psptoolchain-20111215-psp w/ gcc 4.9.3 | |
1276 | |
1277 00000000 <leaf_call>: | |
1278 0: 27bdffd8 addiu sp,sp,-40 | |
1279 4: afbe0024 sw s8,36(sp) | |
1280 8: 03a0f021 move s8,sp | |
1281 c: a7c40000 sh a0,0(s8) | |
1282 10: a3c50004 sb a1,4(s8) | |
1283 14: a7c60008 sh a2,8(s8) | |
1284 18: afc7000c sw a3,12(s8) | |
1285 1c: e7cc0010 swc1 $f12,16(s8) | |
1286 20: afc80018 sw t0,24(s8) | |
1287 24: afc9001c sw t1,28(s8) | |
1288 28: afca0014 sw t2,20(s8) | |
1289 2c: 03c0e821 move sp,s8 | |
1290 30: 8fbe0024 lw s8,36(sp) | |
1291 34: 27bd0028 addiu sp,sp,40 | |
1292 38: 03e00008 jr ra | |
1293 3c: 00000000 nop | |
1294 | |
1295 00000040 <main>: | |
1296 40: 27bdffd0 addiu sp,sp,-48 | |
1297 44: afbf002c sw ra,44(sp) | |
1298 48: afbe0028 sw s8,40(sp) | |
1299 4c: 03a0f021 move s8,sp | |
1300 50: a3c00020 sb zero,32(s8) | |
1301 54: 24020001 li v0,1 | |
1302 58: a3c20021 sb v0,33(s8) | |
1303 5c: 24020002 li v0,2 | |
1304 60: a3c2001c sb v0,28(s8) | |
1305 64: 24020003 li v0,3 | |
1306 68: a7c20018 sh v0,24(s8) | |
1307 6c: 24020004 li v0,4 | |
1308 70: afc20014 sw v0,20(s8) | |
1309 74: 8f820000 lw v0,0(gp) | |
1310 78: afc20010 sw v0,16(s8) | |
1311 7c: 8f820008 lw v0,8(gp) | |
1312 80: 8f83000c lw v1,12(gp) | |
1313 84: afc20008 sw v0,8(s8) | |
1314 88: afc3000c sw v1,12(s8) | |
1315 8c: 24020007 li v0,7 | |
1316 90: a3c20000 sb v0,0(s8) | |
1317 94: 24020008 li v0,8 | |
1318 98: a3c20001 sb v0,1(s8) | |
1319 9c: 24020009 li v0,9 | |
1320 a0: a3c20002 sb v0,2(s8) | |
1321 a4: 8fc40020 lw a0,32(s8) | |
1322 a8: 93c5001c lbu a1,28(s8) | |
1323 ac: 97c60018 lhu a2,24(s8) | |
1324 b0: 8fc70014 lw a3,20(s8) | |
1325 b4: c7cc0010 lwc1 $f12,16(s8) | |
1326 b8: 8fc80008 lw t0,8(s8) | |
1327 bc: 8fc9000c lw t1,12(s8) | |
1328 c0: 8fca0000 lw t2,0(s8) | |
1329 c4: 0c000000 jal 0 <leaf_call> | |
1330 c8: 00000000 nop | |
1331 cc: 00001021 move v0,zero | |
1332 d0: 03c0e821 move sp,s8 | |
1333 d4: 8fbf002c lw ra,44(sp) | |
1334 d8: 8fbe0028 lw s8,40(sp) | |
1335 dc: 27bd0030 addiu sp,sp,48 | |
1336 e0: 03e00008 jr ra | |
1337 e4: 00000000 nop | |
1338 | |
1339 | |
1340 | |
1341 ; ---------- C++ trivial and non-trivial aggrs passed to C funcs ----------> | |
1342 ; | |
1343 ; struct Trivial { int a; }; | |
1344 ; struct NonTrivial { int a; NonTrivial() : a(0) {} NonTrivial(const NonTrivial& rhs) : a(rhs.a) { } }; | |
1345 ; | |
1346 ; extern "C" { | |
1347 ; | |
1348 ; void f1(struct Trivial s) { } | |
1349 ; void f2(struct NonTrivial s) { } | |
1350 ; | |
1351 ; void f() | |
1352 ; { | |
1353 ; struct Trivial t; | |
1354 ; struct NonTrivial n; | |
1355 ; int a=1; | |
1356 ; a += 123; | |
1357 ; f1(t); | |
1358 ; a -= 123; | |
1359 ; f2(n); | |
1360 ; a -= 12; | |
1361 ; } | |
1362 ; } | |
1363 | |
1364 | |
1365 | |
1366 ; output from psptoolchain-20111215-psp w/ gcc 4.9.3 | |
1367 | |
1368 00000000 <f1>: | |
1369 0: 27bdfff0 addiu sp,sp,-16 | |
1370 4: afbe000c sw s8,12(sp) | |
1371 8: 03a0f021 move s8,sp | |
1372 c: afc40000 sw a0,0(s8) | |
1373 10: 03c0e821 move sp,s8 | |
1374 14: 8fbe000c lw s8,12(sp) | |
1375 18: 27bd0010 addiu sp,sp,16 | |
1376 1c: 03e00008 jr ra | |
1377 20: 00000000 nop | |
1378 | |
1379 00000024 <f2>: | |
1380 24: 27bdfff0 addiu sp,sp,-16 | |
1381 28: afbe000c sw s8,12(sp) | |
1382 2c: 03a0f021 move s8,sp | |
1383 30: afc40000 sw a0,0(s8) | |
1384 34: 03c0e821 move sp,s8 | |
1385 38: 8fbe000c lw s8,12(sp) | |
1386 3c: 27bd0010 addiu sp,sp,16 | |
1387 40: 03e00008 jr ra | |
1388 44: 00000000 nop | |
1389 | |
1390 00000048 <f>: | |
1391 48: 27bdffe8 addiu sp,sp,-24 ; | |
1392 4c: afbf0014 sw ra,20(sp) ; | |
1393 50: afbe0010 sw s8,16(sp) ; | |
1394 54: 03a0f021 move s8,sp ; | |
1395 58: 27c2000c addiu v0,s8,12 ; | |
1396 5c: 00402021 move a0,v0 ; | | |
1397 60: 0c000000 jal 0 <f1> ; | NonTrivial::NonTrivial() / ctor | |
1398 64: 00000000 nop ; | |
1399 68: 24020001 li v0,1 ; a = 1 | |
1400 6c: afc20000 sw v0,0(s8) ; | |
1401 70: 8fc20000 lw v0,0(s8) ; | |
1402 74: 2442007b addiu v0,v0,123 ; a += 123 | |
1403 78: afc20000 sw v0,0(s8) ; | |
1404 7c: 8fc40008 lw a0,8(s8) ; | | |
1405 80: 0c000000 jal 0 <f1> ; | call f1(struct Trivial) | |
1406 84: 00000000 nop ; | |
1407 88: 8fc20000 lw v0,0(s8) ; | |
1408 8c: 2442ff85 addiu v0,v0,-123 ; a -= 123 | |
1409 90: afc20000 sw v0,0(s8) ; | |
1410 94: 27c30004 addiu v1,s8,4 ; | |
1411 98: 27c2000c addiu v0,s8,12 ; | |
1412 9c: 00602021 move a0,v1 ; | ptr to dest of copy of n | |
1413 a0: 00402821 move a1,v0 ; | copy n ptr to n | |
1414 a4: 0c000000 jal 0 <f1> ; | | NonTrivial::NonTrivial(const NonTrivial&) / copy ctor | |
1415 a8: 00000000 nop ; | |
1416 ac: 27c20004 addiu v0,s8,4 ; get ptr to copy of n -> v0 | |
1417 b0: 00402021 move a0,v0 ; f2 arg 0 (ptr to copy of struct NonTrivial), via ptr as non-trivial | |
1418 b4: 0c000000 jal 0 <f1> ; call f2(struct NonTrivial) | |
1419 b8: 00000000 nop ; | |
1420 bc: 8fc20000 lw v0,0(s8) ; | |
1421 c0: 2442fff4 addiu v0,v0,-12 ; a -= 12 | |
1422 c4: afc20000 sw v0,0(s8) ; | |
1423 c8: 03c0e821 move sp,s8 ; | |
1424 cc: 8fbf0014 lw ra,20(sp) ; | |
1425 d0: 8fbe0010 lw s8,16(sp) ; | |
1426 d4: 27bd0018 addiu sp,sp,24 ; | |
1427 d8: 03e00008 jr ra ; | |
1428 dc: 00000000 nop ; | |
1429 | |
1430 ; ... snip, removed code of ctor and copy ctor ... | |
1431 | |
1432 | |
1433 | |
1434 ; ---------- C++ trivial and non-trivial aggrs as return values ----------> | |
1435 ; | |
1436 ; struct Trivial { int a; }; | |
1437 ; struct NonTrivial { int a; NonTrivial() : a(0) {} NonTrivial(const NonTrivial& rhs) : a(rhs.a) { } }; | |
1438 ; | |
1439 ; extern "C" { | |
1440 ; struct Trivial f1() { return Trivial(); } | |
1441 ; } | |
1442 ; | |
1443 ; struct NonTrivial f2() { return NonTrivial(); } | |
1444 ; | |
1445 ; extern "C" { | |
1446 ; void f() | |
1447 ; { | |
1448 ; int a=1; | |
1449 ; a += 123; | |
1450 ; struct Trivial t = f1(); | |
1451 ; a -= 123; | |
1452 ; struct NonTrivial n = f2(); | |
1453 ; a -= 12; | |
1454 ; } | |
1455 ; } | |
1456 | |
1457 | |
1458 | |
1459 ; output from psptoolchain-20111215-psp w/ gcc 4.9.3 | |
1460 | |
1461 00000000 <f1>: | |
1462 0: 27bdfff8 addiu sp,sp,-8 | |
1463 4: afbe0004 sw s8,4(sp) | |
1464 8: 03a0f021 move s8,sp | |
1465 c: 00001021 move v0,zero | |
1466 10: 03c0e821 move sp,s8 | |
1467 14: 8fbe0004 lw s8,4(sp) | |
1468 18: 27bd0008 addiu sp,sp,8 | |
1469 1c: 03e00008 jr ra | |
1470 20: 00000000 nop | |
1471 | |
1472 00000024 <_Z2f2v>: | |
1473 24: 27bdfff0 addiu sp,sp,-16 ; | |
1474 28: afbf000c sw ra,12(sp) ; | |
1475 2c: afbe0008 sw s8,8(sp) ; | |
1476 30: 03a0f021 move s8,sp ; | |
1477 34: afc40000 sw a0,0(s8) ; | |
1478 38: 8fc40000 lw a0,0(s8) ; | |
1479 3c: 0c000000 jal 0 <f1> ; | |
1480 40: 00000000 nop ; | |
1481 44: 8fc20000 lw v0,0(s8) ; retval, return (hidden) passed-in ptr to space for retval | |
1482 48: 03c0e821 move sp,s8 ; | |
1483 4c: 8fbf000c lw ra,12(sp) ; | |
1484 50: 8fbe0008 lw s8,8(sp) ; | |
1485 54: 27bd0010 addiu sp,sp,16 ; | |
1486 58: 03e00008 jr ra ; | |
1487 5c: 00000000 nop ; | |
1488 | |
1489 00000060 <f>: | |
1490 60: 27bdffe8 addiu sp,sp,-24 ; | |
1491 64: afbf0014 sw ra,20(sp) ; | |
1492 68: afbe0010 sw s8,16(sp) ; | |
1493 6c: 03a0f021 move s8,sp ; | |
1494 70: 24020001 li v0,1 ; a = 1 | |
1495 74: afc20000 sw v0,0(s8) ; | |
1496 78: 8fc20000 lw v0,0(s8) ; | |
1497 7c: 2442007b addiu v0,v0,123 ; a += 123 | |
1498 80: afc20000 sw v0,0(s8) ; | |
1499 84: 0c000000 jal 0 <f1> ; call f1(), struct returned via as trivial and <= 64bit | |
1500 88: 00000000 nop ; | |
1501 8c: afc20004 sw v0,4(s8) ; | |
1502 90: 8fc20000 lw v0,0(s8) ; | |
1503 94: 2442ff85 addiu v0,v0,-123 ; a -= 123 | |
1504 98: afc20000 sw v0,0(s8) ; | |
1505 9c: 27c20008 addiu v0,s8,8 ; | |
1506 a0: 00402021 move a0,v0 ; hidden first arg (ptr to space for ret val) | |
1507 a4: 0c000000 jal 0 <f1> ; call f2(), result returned indirectly as struct nontrivial | |
1508 a8: 00000000 nop ; | |
1509 ac: 8fc20000 lw v0,0(s8) ; | |
1510 b0: 2442fff4 addiu v0,v0,-12 ; a -= 12 | |
1511 b4: afc20000 sw v0,0(s8) ; | |
1512 b8: 03c0e821 move sp,s8 ; | |
1513 bc: 8fbf0014 lw ra,20(sp) ; | |
1514 c0: 8fbe0010 lw s8,16(sp) ; | |
1515 c4: 27bd0018 addiu sp,sp,24 ; | |
1516 c8: 03e00008 jr ra ; | |
1517 cc: 00000000 nop ; | |
1518 | |
1519 ; ... snip, removed code of ctor ... | |
1520 | |
1521 | |
1522 | |
612 ; vim: ft=asm | 1523 ; vim: ft=asm |
613 | 1524 |