comp.lang.ada
 help / color / mirror / Atom feed
* Little function generates lots of object code.
@ 2001-09-30  0:52 Mike Harrison
  2001-09-30 12:58 ` Robert Dewar
  2001-10-01 12:18 ` Ian
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Harrison @ 2001-09-30  0:52 UTC (permalink / raw)


Hello group,

I am using AdaMulti 3.1 with a Sun target (optimized for size).  
The following little function seems to be generating a lot more object
code than it deserves.
Is this what other people would expect?
Is there something that I could do to reduce this?

.Mike.

----------------------------------------------------------
      function "-" (Right : in Matrix) return Matrix is  
         Result : Matrix (Right'range(1), Right'range(2)); 
      begin 
         for Row in Right'range(1) loop 
            for Column in Right'range(2) loop 
               Result(Row,Column) := -Right(Row,Column); 
            end loop; 
         end loop; 
         return Result; 
      end "-";
----------------------------------------------------------


0x5c230:	.byte 	00,00,00,01 
      function "-" (Right : in Matrix) return Matrix is  
         Result : Matrix (Right'range(1), Right'range(2)); 
      begin 
0x5c234  M:      	0x9de3bfa0  save	%o6,-96,%o6
0x5c238  M+0x4:  	0xe406a00c 
ld	[%i2=matrix_functions.extended_float_array.operations.M__7.right___dope+12],%l2
0x5c23c  M+0x8:  	0xe206a000 
ld	[%i2=matrix_functions.extended_float_array.operations.M__7.right___dope],%l1
0x5c240  M+0xc:  	0xe606a004 
ld	[%i2=matrix_functions.extended_float_array.operations.M__7.right___dope+4],%l3
0x5c244  M+0x10: 	0xe006a008 
ld	[%i2=_matrix_functions.extended_float_array.operations.M__7.right___dope+8],%l0
0x5c248  M+0x14: 	0x9007bffc  add	%i6,-4,%o0
0x5c24c  M+0x18: 	0x40013692  call	rts_ss_mark (0xa9c94) (0xa9c94)
0x5c250  M+0x1c: 	0xb8100019  mov	%i1,%i4=right
0x5c254  M+0x20: 	0x80a4c011  cmp	%l3,%l1
0x5c258  M+0x24: 	0x06800004  bl	M+0x34 (0x5c268) (0x5c268)
0x5c25c  M+0x28: 	0x90102000  mov	0,%o0
0x5c260  M+0x2c: 	0x9a24c011  sub	%l3,%l1,%o5
0x5c264  M+0x30: 	0x90036001  add	%o5,1,%o0
0x5c268  M+0x34: 	0x80a48010  cmp	%l2,%l0
0x5c26c  M+0x38: 	0x06800004  bl	M+0x48 (0x5c27c) (0x5c27c)
0x5c270  M+0x3c: 	0x92102000  mov	0,%o1
0x5c274  M+0x40: 	0x98248010  sub	%l2,%l0,%o4
0x5c278  M+0x44: 	0x92032001  add	%o4,1,%o1
0x5c27c  M+0x48: 	0x400188a4  call	.mul (0xbe50c) (0xbe50c)
0x5c280  M+0x4c: 	0x01000000  nop
0x5c284  M+0x50: 	0x400136bc  call	rts_ss_allocate (0xa9d74) (0xa9d74)
0x5c288  M+0x54: 	0x912a2003  sll	%o0,3,%o0
         for Row in Right'range(1) loop 
0x5c28c  M+0x58: 	0xd606a000 
ld	[%i2=matrix_functions.extended_float_array.operations.M__7.right___dope],%o3
0x5c290  M+0x5c: 	0xd406a004 
ld	[%i2=matrix_functions.extended_float_array.operations.M__7.right___dope+4],%o2
0x5c294  M+0x60: 	0x80a2c00a  cmp	%o3,%o2
0x5c298  M+0x64: 	0x1480002e  bg	M+0x11c (0x5c350) (0x5c350)
0x5c29c  M+0x68: 	0xb2100008  mov	%o0,%i1=result
0x5c2a0  M+0x6c: 	0xc806a000 
ld	[%i2=matrix_functions.extended_float_array.operations.M__7.right___dope],%g4=row
            for Column in Right'range(2) loop 
0x5c2a4  M+0x70: 	0xd006a008 
ld	[%i2=matrix_functions.extended_float_array.operations.M__7.right___dope+8],%o0
0x5c2a8  M+0x74: 	0xd206a00c 
ld	[%i2=matrix_functions.extended_float_array.operations.M__7.right___dope+12],%o1
0x5c2ac  M+0x78: 	0x80a20009  cmp	%o0,%o1
0x5c2b0  M+0x7c: 	0x34800023  bg,a	M+0x108 (0x5c33c) (0x5c33c)
0x5c2b4  M+0x80: 	0xda06a004 
ld	[%i2=matrix_functions.extended_float_array.operations.M__7.right___dope+4],%o5
0x5c2b8  M+0x84: 	0xac100008  mov	%o0,%l6=column
               Result(Row,Column) := -Right(Row,Column); 
0x5c2bc  M+0x88: 	0xf606a008 
ld	[%i2=matrix_functions.extended_float_array.operations.M__7.right___dope+8],%i3
0x5c2c0  M+0x8c: 	0x90248010  sub	%l2,%l0,%o0
0x5c2c4  M+0x90: 	0x92022001  add	%o0,1,%o1
0x5c2c8  M+0x94: 	0x40018891  call	.mul (0xbe50c) (0xbe50c)
0x5c2cc  M+0x98: 	0x90210011  sub	%g4=row,%l1,%o0
0x5c2d0  M+0x9c: 	0xde06a000 
ld	[%i2=matrix_functions.extended_float_array.operations.M__7.right___dope],%o7
0x5c2d4  M+0xa0: 	0xfa06a00c 
ld	[%i2=matrix_functions.extended_float_array.operations.M__7.right___dope+12],%i5
0x5c2d8  M+0xa4: 	0x92258010  sub	%l6=column,%l0,%o1
0x5c2dc  M+0xa8: 	0x90024008  add	%o1,%o0,%o0
0x5c2e0  M+0xac: 	0xaf2a2003  sll	%o0,3,%l7
0x5c2e4  M+0xb0: 	0x9027401b  sub	%i5,%i3,%o0
0x5c2e8  M+0xb4: 	0x92022001  add	%o0,1,%o1
0x5c2ec  M+0xb8: 	0x9021000f  sub	%g4=row,%o7,%o0
0x5c2f0  M+0xbc: 	0x40018887  call	.mul (0xbe50c) (0xbe50c)
0x5c2f4  M+0xc0: 	0x01000000  nop
0x5c2f8  M+0xc4: 	0x9225801b  sub	%l6=column,%i3,%o1
0x5c2fc  M+0xc8: 	0x90024008  add	%o1,%o0,%o0
0x5c300  M+0xcc: 	0x912a2003  sll	%o0,3,%o0
0x5c304  M+0xd0: 	0xc102001c  ld	[%o0+%i4=right],%f0
0x5c308  M+0xd4: 	0x8602001c  add	%o0,%i4=right,%g3
0x5c30c  M+0xd8: 	0x81a000a0  fnegs	%f0,%f0
0x5c310  M+0xdc: 	0xc300e004  ld	[%g3+4],%f1
0x5c314  M+0xe0: 	0xc125c019  st	%f0,[%l7+%i1=result]
0x5c318  M+0xe4: 	0xa805c019  add	%l7,%i1=result,%l4
0x5c31c  M+0xe8: 	0xc3252004  st	%f1,[%l4+4]
            end loop; 
0x5c320  M+0xec: 	0xd006a00c 
ld	[%i2=matrix_functions.extended_float_array.operations.M__7.right___dope+12],%o0
0x5c324  M+0xf0: 	0x80a58008  cmp	%l6=column,%o0
0x5c328  M+0xf4: 	0x22800005  be,a	M+0x108 (0x5c33c) (0x5c33c)
0x5c32c  M+0xf8: 	0xda06a004 
ld	[%i2=matrix_functions.extended_float_array.operations.M__7.right___dope+4],%o5
0x5c330  M+0xfc: 	0x10bfffe3  ba	M+0x88 (0x5c2bc) (0x5c2bc)
0x5c334  M+0x100:	0xac05a001  add	%l6=column,1,%l6=column
         end loop; 
0x5c338  M+0x104:	0xda06a004 
ld	[%i2=matrix_functions.extended_float_array.operations.M__7.right___dope+4],%o5
0x5c33c  M+0x108:	0x80a1000d  cmp	%g4=row,%o5
0x5c340  M+0x10c:	0x22800005  be,a	M+0x120 (0x5c354) (0x5c354)
0x5c344  M+0x110:	0x90102000  mov	0,%o0
0x5c348  M+0x114:	0x10bfffd7  ba	M+0x70 (0x5c2a4) (0x5c2a4)
0x5c34c  M+0x118:	0x88012001  add	%g4=row,1,%g4=row
         return Result; 
0x5c350  M+0x11c:	0x90102000  mov	0,%o0
0x5c354  M+0x120:	0xe6262004  st	%l3,[%i0=implicit_dope_for_result+4]
0x5c358  M+0x124:	0xe0262008  st	%l0,[%i0=implicit_dope_for_result+8]
0x5c35c  M+0x128:	0xe426200c  st	%l2,[%i0=implicit_dope_for_result+12]
0x5c360  M+0x12c:	0x80a4c011  cmp	%l3,%l1
0x5c364  M+0x130:	0x06800004  bl	M+0x140 (0x5c374) (0x5c374)
0x5c368  M+0x134:	0xe2262000  st	%l1,[%i0=implicit_dope_for_result]
0x5c36c  M+0x138:	0x9824c011  sub	%l3,%l1,%o4
0x5c370  M+0x13c:	0x90032001  add	%o4,1,%o0
0x5c374  M+0x140:	0x80a48010  cmp	%l2,%l0
0x5c378  M+0x144:	0x06800004  bl	M+0x154 (0x5c388) (0x5c388)
0x5c37c  M+0x148:	0x92102000  mov	0,%o1
0x5c380  M+0x14c:	0x96248010  sub	%l2,%l0,%o3
0x5c384  M+0x150:	0x9202e001  add	%o3,1,%o1
0x5c388  M+0x154:	0x40018861  call	.mul (0xbe50c) (0xbe50c)
0x5c38c  M+0x158:	0x01000000  nop
0x5c390  M+0x15c:	0x952a2003  sll	%o0,3,%o2
0x5c394  M+0x160:	0x9207bffc  add	%i6,-4,%o1
0x5c398  M+0x164:	0x400136f1  call	rts_ss_copy_and_release (0xa9f5c)
(0xa9f5c)
0x5c39c  M+0x168:	0x90100019  mov	%i1=result,%o0
0x5c3a0  M+0x16c:	0xb0100008  mov	%o0,%i0=implicit_dope_for_result
0x5c3a4  M+0x170:	0x81c7e008  ret
0x5c3a8  M+0x174:	0x91ea0000  restore	%o0,%g0,%o0
      end "-";



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Little function generates lots of object code.
  2001-09-30  0:52 Little function generates lots of object code Mike Harrison
@ 2001-09-30 12:58 ` Robert Dewar
  2001-10-01 12:18 ` Ian
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Dewar @ 2001-09-30 12:58 UTC (permalink / raw)


Mike_Harrison80@yahoo.com (Mike Harrison) wrote in message news:<14df6e36.0109291652.73e61d20@posting.google.com>...
> Hello group,
> 
> I am using AdaMulti 3.1 with a Sun target (optimized for size).  
> The following little function seems to be generating a lot more object
> code than it deserves.
> Is this what other people would expect?
> Is there something that I could do to reduce this?
> 
> .Mike.

Not clear why you would expect less code than this, but
in any case this is most certainly something you should
discuss with the vendor. A question like this is highly
compiler specific, and your vendor should be able to give
specific help and suggestions on answering your question.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Little function generates lots of object code.
  2001-09-30  0:52 Little function generates lots of object code Mike Harrison
  2001-09-30 12:58 ` Robert Dewar
@ 2001-10-01 12:18 ` Ian
  1 sibling, 0 replies; 3+ messages in thread
From: Ian @ 2001-10-01 12:18 UTC (permalink / raw)


Mike_Harrison80@yahoo.com (Mike Harrison) wrote in message news:<14df6e36.0109291652.73e61d20@posting.google.com>...
> Hello group,
> 
> I am using AdaMulti 3.1 with a Sun target (optimized for size).  
> The following little function seems to be generating a lot more object
> code than it deserves.
> Is this what other people would expect?
> Is there something that I could do to reduce this?
> 
> .Mike.
> 
> ----------------------------------------------------------
>       function "-" (Right : in Matrix) return Matrix is  
>          Result : Matrix (Right'range(1), Right'range(2)); 
>       begin 
>          for Row in Right'range(1) loop 
>             for Column in Right'range(2) loop 
>                Result(Row,Column) := -Right(Row,Column); 
>             end loop; 
>          end loop; 
>          return Result; 
>       end "-";
> ----------------------------------------------------------
> 
> 
> 0x5c230:	.byte 	00,00,00,01 
>       function "-" (Right : in Matrix) return Matrix is  
.
.
.
.
.
> 0x5c3a0  M+0x16c:	0xb0100008  mov	%o0,%i0=implicit_dope_for_result
> 0x5c3a4  M+0x170:	0x81c7e008  ret
> 0x5c3a8  M+0x174:	0x91ea0000  restore	%o0,%g0,%o0
>       end "-";

Mike,
      If I can count correctly you have 6 semi-colons and 10 SLOCS
with
376 Bytes of object code. This gives 62.7 B per ;  and 37.6 B per
SLOC.
Out current project with a very much larger code base, using Rational
Apex
3.0.1 generating for a PPC604 target is loaded into FLASH and then
copied to RAM after which it is elaborated. We get 66.5 B per ; in
FLASH (this is maybe
object code with the libraries swamped out due to the large image
size). When copied into RAM and elaborated it grows to 133 B per ;

Looks like Greenhills MultiAda is about typical. If you want to
estimate the RAM needed, this expansion should be taken into account.
I was wondering if the increase is all explained by the heap. We
probably use a lot of this.

Has anyone got the correct answer to this?

Ian.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-10-01 12:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-30  0:52 Little function generates lots of object code Mike Harrison
2001-09-30 12:58 ` Robert Dewar
2001-10-01 12:18 ` Ian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox