On Monday 23 March 2015 17:25:36 Ivanko B wrote:
> How about wrapping the code in a function accepting the "5" as its argument
> ?
>
So?
"
program while1;

procedure test(const amax: int32);
var
 i1,i2: int32;
begin
 i1:= 0;
 i2:= 0;
 while i1 < amax do begin
  inc(i1);
  i2:= i1+i2;
  exitcode:= i2;
 end;
end;

begin
 test(5);
end.
"

MSElang:
"
        .file   "test-opt.ll"
        .text
        .globl  main
        .align  16, 0x90
        .type   main,@function
main:                                   # @main
# BB#0:
        movl    $15, __unnamed_1
        movl    $15, %eax
        ret
.Ltmp0:
        .size   main, .Ltmp0-main

        .type   __unnamed_1,@object     # @0
        .local  __unnamed_1
        .comm   __unnamed_1,4,4

        .section        ".note.GNU-stack","",@progbits
"

FPC:
"
.section .text
        .balign 16,0x90
.globl  P$WHILE1_TEST$LONGINT
        .type   P$WHILE1_TEST$LONGINT,@function
P$WHILE1_TEST$LONGINT:
# Temps allocated between esp+0 and esp+4
# [test1.pas]
# [6] begin
        subl    $4,%esp
# Var amax located in register eax
# Var i1 located in register ebx
# Var i2 located in register ecx
        movl    %ebx,(%esp)
# [7] i1:= 0;
        movl    $0,%ebx
# [8] i2:= 0;
        movl    $0,%ecx
# [9] while i1 < amax do begin
        jmp     .Lj10
        .balign 4,0x90
.Lj9:
# [10] inc(i1);
        incl    %ebx
# [11] i2:= i1+i2;
        movl    %ecx,%edx
        addl    %ebx,%edx
        movl    %edx,%ecx
# [12] exitcode:= i2;
        movl    %ecx,operatingsystem_result
.Lj10:
        cmpl    %eax,%ebx
        jl      .Lj9
.Lj11:
# [14] end;
        movl    (%esp),%ebx
        addl    $4,%esp
        ret
.Le0:
        .size   P$WHILE1_TEST$LONGINT, .Le0 - P$WHILE1_TEST$LONGINT

.section .text
        .balign 16,0x90
.globl  PASCALMAIN
        .type   PASCALMAIN,@function
PASCALMAIN:
.globl  main
        .type   main,@function
main:
# Temps allocated between esp+0 and esp+0
# [16] begin
        call    FPC_INITIALIZEUNITS
# [17] test(5);
        movl    $5,%eax
        call    P$WHILE1_TEST$LONGINT
# [18] end.
        call    FPC_DO_EXIT
        ret
.Le1:
        .size   main, .Le1 - main

"
Martin

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to