comparison doc/disas_examples/arm.armhf.disas @ 499:fc614cb865c6

- doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
author Tassilo Philipp
date Mon, 04 Apr 2022 15:50:52 +0200
parents cb19b2fe2422
children
comparison
equal deleted inserted replaced
498:fd9ba3a6d348 499:fc614cb865c6
694 694
695 ; ... snip, removed code of ctor and copy ctor ... 695 ; ... snip, removed code of ctor and copy ctor ...
696 696
697 697
698 698
699 ; ---------- C++ trivial and non-trivial aggrs as return values ---------->
700 ;
701 ; struct Trivial { int a; };
702 ; struct NonTrivial { int a; NonTrivial() : a(0) {} NonTrivial(const NonTrivial& rhs) : a(rhs.a) { } };
703 ;
704 ; extern "C" {
705 ; struct Trivial f1() { return Trivial(); }
706 ; }
707 ;
708 ; struct NonTrivial f2() { return NonTrivial(); }
709 ;
710 ; extern "C" {
711 ; void f()
712 ; {
713 ; int a=1;
714 ; a += 123;
715 ; struct Trivial t = f1();
716 ; a -= 123;
717 ; struct NonTrivial n = f2();
718 ; a -= 12;
719 ; }
720 ; }
721
722
723
724 ; output from raspbian-11-armelhf w/ gcc 10.2.1
725
726 000103d0 <f1>:
727 103d0: e52db004 push {fp}
728 103d4: e28db000 add fp, sp, #0
729 103d8: e3a03000 mov r3, #0
730 103dc: e1a00003 mov r0, r3
731 103e0: e28bd000 add sp, fp, #0
732 103e4: e49db004 pop {fp}
733 103e8: e12fff1e bx lr
734
735 000103ec <_Z2f2v>:
736 103ec: e92d4800 push {fp, lr}
737 103f0: e28db004 add fp, sp, #4
738 103f4: e24dd008 sub sp, sp, #8
739 103f8: e50b0008 str r0, [fp, #-8]
740 103fc: e51b0008 ldr r0, [fp, #-8]
741 10400: eb00001f bl 10484 <_ZN10NonTrivialC1Ev>
742 10404: e51b0008 ldr r0, [fp, #-8] ; ptr to retval space -> r0
743 10408: e24bd004 sub sp, fp, #4
744 1040c: e8bd8800 pop {fp, pc}
745
746 00010410 <f>:
747 10410: e92d4800 push {fp, lr} ; |
748 10414: e28db004 add fp, sp, #4 ; | prolog
749 10418: e24dd010 sub sp, sp, #16 ; /
750 1041c: e3a03001 mov r3, #1 ; \ a = 1
751 10420: e50b3008 str r3, [fp, #-8] ; /
752 10424: e51b3008 ldr r3, [fp, #-8] ; \
753 10428: e283307b add r3, r3, #123 ; | a += 123
754 1042c: e50b3008 str r3, [fp, #-8] ; |
755 10430: ebffffe6 bl 103d0 <f1> ; call f1()
756 10434: e1a03000 mov r3, r0 ; | retval via r0, as small struct
757 10438: e50b300c str r3, [fp, #-12] ; /
758 1043c: e51b3008 ldr r3, [fp, #-8] ; \
759 10440: e243307b sub r3, r3, #123 ; | a -= 123
760 10444: e50b3008 str r3, [fp, #-8] ; |
761 10448: e24b3010 sub r3, fp, #16 ; space to hold non-triv retval -> eax ...
762 1044c: e1a00003 mov r0, r3 ; ... as hidden first arg (r0)
763 10450: ebffffe5 bl 103ec <_Z2f2v> ; call f2()
764 10454: e51b3008 ldr r3, [fp, #-8] ; |
765 10458: e243300c sub r3, r3, #12 ; | a -= 12
766 1045c: e50b3008 str r3, [fp, #-8] ; /
767 10460: e1a00000 nop ; \
768 10464: e24bd004 sub sp, fp, #4 ; | epilog
769 10468: e8bd8800 pop {fp, pc} ; |
770
771
772
699 ; vim: ft=asm68k 773 ; vim: ft=asm68k
700 774