nld and noft Manual
noft Utility
nld and noft Manual—520384-003
4-10
Debugging With noft
Example 4-6 shows the noft output for the compute() function in Example 4-3 on
page 4-7 compiled at optimize 2. The native compilers perform all possible
optimizations at optimize 2. The “+” and “-” characters in the leftmost column
indicate code that has been moved forward or backward in the execution stream.
The following table shows the number of instructions required (the length of the
instruction stream) to run the compute() function in Example 4-3 on page 4-7 at each
optimization level:
At optimization level 0, the native compiler performs no optimizations. Notice that the
code contains nop (no operation) instructions and uses few registers.
Example 4-6. Optimize 2 Listing
noft> dumpproc compute
******** Innerlist Dump Of Procedure: compute ********
Procedure Src Line Address Long Word Instructions
-------------------------------------------------------------------
19 for (i=0; i<20; i++)
[compute 19000] 0x70000450 0x00802825 move a1,a0
-[compute 18000] 0x70000454 0x00001825 move v1,zero
[compute 19000] 0x70000458 0x24040014 li a0,0x14
[compute 19000] 0x7000045c 0x00001025 move v0,zero
20 b += a[i];
[compute 20000] 0x70000460 0x8cae0000 lw t6,0(a1)
[compute 20000] 0x70000464 0x8caf0004 lw t7,0x4(a1)
[compute 20000] 0x70000468 0x8cb80008 lw t8,0x8(a1)
[compute 20000] 0x7000046c 0x006e1821 addu v1,v1,t6
[compute 20000] 0x70000470 0x8cb9000c lw t9,0xc(a1)
[compute 20000] 0x70000474 0x006f1821 addu v1,v1,t7
[compute 20000] 0x70000478 0x24420004 addiu v0,v0,0x4
[compute 20000] 0x7000047c 0x00781821 addu v1,v1,t8
[compute 20000] 0x70000480 0x24a50010 addiu a1,a1,0x10
[compute 20000] 0x70000484 0x1444fff6 bne v0,a0,0x70000460
[compute 20000] 0x70000488 0x00791821 addu v1,v1,t9
21 return b;
[compute 21000] 0x7000048c 0x03e00008 jr ra
[compute 21000] 0x70000490 0x00601025 move v0,v1
Optimization Level Number of Instructions
0269
1207
257