January 26, 2008 - 4:39am
Guest |
bar1() / foo1() (below) is optimal, but bar2(n) needlessly stores and recalls 'n' when calling foo2().
This is especially important in the small model, where RAM is limited.
regards Steven Pruzina
DOS RC51 COMPILER V03.03.43, COMPILATION OF MODULE T1
OBJECT MODULE PLACED IN c:\spj1\flouro2\swr\\obj\t1.obj
COMPILER INVOKED BY: OBJECT(C:\SPJ1\FLOURO2\SWR\\OBJ\T1.OBJ) PIN(C:\SPJ1\FLOURO2
-\SWR\SRC;C:\SPJ1\SWR\TINY1\PUBLIC;C:\SPJ1\SWR\C8051\PUBLIC;C:\CSIAP
-PS\RIDE\INC;C:\CSIAPPS\RIDE\INC\51) PIN(C:\CSIAPPS\RIDE\INC\51\CYGN
-AL\) NOAM PR(C:\SPJ1\FLOURO2\SWR\\LST\T1.LST) CD SB OE(1) SM NOIP F
-P(NOFLOAT) PW(80) DF(TOOL_IS_RIDE_8051,MCU_IS_C8051F530,SYSTEM_IS_F
-O2_MK1) NOIS NOGENERIC UNSIGNEDCHAR ET(CHAR) QUIET GENERATEDEPFILE
stmt level source
1 extern int foo1(int a, int b);
2 extern int foo2(int a, int b, int c);
3
4 int bar1(int n)
5 {
6 1 return foo1(n, 0xABCD);
7 1 }
8
9 int bar2(int n)
10 {
11 1 return foo2(n, 0x1234, 0xABCD);
12 1 }
13
RC51 COMPILER V03.03.43, T1 01/25/08 21:26:58 PAGE 2
ASSEMBLY LISTING OF GENERATED OBJECT CODE
; FUNCTION _bar1 (BEGIN)
; Register R2R3 is assigned to parameter n
; SOURCE LINE # 6
0000 7CAB MOV R4,#0ABH
0002 7DCD MOV R5,#0CDH
0004 120000 R LCALL _foo1
; SOURCE LINE # 7
0007 22 RET
; FUNCTION _bar1 (END)
; FUNCTION _bar2 (BEGIN)
; SOURCE LINE # 9
0000 8E00 R MOV n,R6 <----------- stores 'n'
0002 8F00 R MOV n+01H,R7
; SOURCE LINE # 11
0004 AE00 R MOV R6,n <----------- only to read it right back
0006 AF00 R MOV R7,n+01H
0008 7C12 MOV R4,#012H
000A 7D34 MOV R5,#034H
000C 7AAB MOV R2,#0ABH
000E 7BCD MOV R3,#0CDH
0010 120000 R LCALL _foo2
; SOURCE LINE # 12
0013 22 RET
; FUNCTION _bar2 (END)
|
We try to clean it for the next release.
Done now. Will be available in the next release.