Re: [MSEide-MSEgui-talk] Produced code of MSElang and FPC

2015-03-24 Thread Michael Schnell
On 03/24/2015 01:04 PM, Martin Schreiber wrote:
>
> No, MSElang has its own optimised binary represention for the unified record,

As you might have read, in the FPC list I suggested exactly this just 
this morning :-)

-Michael

--
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


Re: [MSEide-MSEgui-talk] Produced code of MSElang and FPC

2015-03-24 Thread Martin Schreiber
On Tuesday 24 March 2015 11:23:44 Michael Schnell wrote:
> On 03/23/2015 06:36 PM, Martin Schreiber wrote:
> > Currently I am implementing "class" for the llvm-bitcode backend.
>
> AFAIK, LLVM is done with C++ in mind.
>
Why do you think so?
The instruction set is here:
http://llvm.org/docs/LangRef.html

> I do know that Delphi classes are rather incompatible with C++ classes
> and so when using a C++ DLL/.so with fpc or vice versa you can't pass
> instances of classes.
>
> Will this be mended in mselang ?
>
No, MSElang has its own optimised binary represention for the unified record, 
object and class concept which is not FPC nor C++ binary compatible.
BTW, C++ class ABI depends on the used compiler and sometimes even on the used 
compiler version.

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


Re: [MSEide-MSEgui-talk] Produced code of MSElang and FPC

2015-03-24 Thread Michael Schnell
On 03/23/2015 06:36 PM, Martin Schreiber wrote:

> Currently I am implementing "class" for the llvm-bitcode backend.
AFAIK, LLVM is done with C++ in mind.

I do know that Delphi classes are rather incompatible with C++ classes 
and so when using a C++ DLL/.so with fpc or vice versa you can't pass 
instances of classes.

Will this be mended in mselang ?

-Michael

--
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


Re: [MSEide-MSEgui-talk] Produced code of MSElang and FPC

2015-03-23 Thread Martin Schreiber
On Monday 23 March 2015 18:53:41 Ivanko B wrote:
> So?
> =
> Hmm, it's not run-time optimization - its' pre-performing the program.
> Then how about passing the "5" as an external  program argument
> (ParamStr(i)) ?
>
Not yet implemented. It is really difficult to make testcases for llvm because 
it optimises away all expressions with constants. :-)

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


Re: [MSEide-MSEgui-talk] Produced code of MSElang and FPC

2015-03-23 Thread Ivanko B
So?
=
Hmm, it's not run-time optimization - its' pre-performing the program.
Then how about passing the "5" as an external  program argument (ParamStr(i)) ?

--
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


Re: [MSEide-MSEgui-talk] Produced code of MSElang and FPC

2015-03-23 Thread Martin Schreiber
On Monday 23 March 2015 18:28:00 misu kun wrote:
>  impressive
> how is the progression of mselang now , whats have been done  , and
> what still not ?

Currently I am implementing "class" for  the llvm-bitcode backend. There is 
work for several years until it can be used in production.

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


Re: [MSEide-MSEgui-talk] Produced code of MSElang and FPC

2015-03-23 Thread misu kun
 impressive
how is the progression of mselang now , whats have been done  , and
what still not ?
i know it's still early . but seems promising :)

--
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


Re: [MSEide-MSEgui-talk] Produced code of MSElang and FPC

2015-03-23 Thread Martin Schreiber
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
callFPC_INITIALIZEUNITS
# [17] test(5);
movl$5,%eax
callP$WHILE1_TEST$LONGINT
# [18] end.
callFPC_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


Re: [MSEide-MSEgui-talk] Produced code of MSElang and FPC

2015-03-23 Thread Ivanko B
How about wrapping the code in a function accepting the "5" as its argument ?

--
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


Re: [MSEide-MSEgui-talk] Produced code of MSElang and FPC

2015-03-22 Thread Martin Schreiber
On Sunday 22 March 2015 16:02:57 Ivanko B wrote:
> MSElang-llvm seems to ask LLVM to precalculate the result ($15 in the
> example) then just puts it to the output. So now we have smth like
> C[++] double pass compiling, correct ?
>
MSElang produces a llvm bitcode file in a single pass. This file is fed 
to "llc -O3" which produces the showed assembler file. It seems "llc -O3" 
does a loop unroll and resolves the constant expressions which can be 
simplified into a single assignment. Impressive.

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


Re: [MSEide-MSEgui-talk] Produced code of MSElang and FPC

2015-03-22 Thread Ivanko B
MSElang-llvm seems to ask LLVM to precalculate the result ($15 in the
example) then just puts it to the output. So now we have smth like
C[++] double pass compiling, correct ?

--
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


Re: [MSEide-MSEgui-talk] Produced code of MSElang and FPC

2015-03-22 Thread Martin Schreiber
On Friday 23 January 2015 14:09:24 Martin Schreiber wrote:
> Hi,
> Here the first comparison of FPC and MSElang produced code:
>
Another example:
"
program while1;
var
 i1,i2: int32;
begin
 i1:= 0;
 i2:= 0;
 while i1 < 5 do begin
  inc(i1);
  i2:= i1+i2;
 end;
 exitcode:= i2;
end.
"

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


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

FPC fixes_2_6:
"
main:
# Temps allocated between esp+0 and esp+0
# Var i1 located in register ecx
# Var i2 located in register edx
# [test1.pas]
# [4] begin
callFPC_INITIALIZEUNITS
movl$0,%eax
movl$0,%eax
# [5] i1:= 0;
movl$0,%ecx
# [6] i2:= 0;
movl$0,%edx
# [7] while i1 < 5 do begin
jmp .Lj8
.balign 4,0x90
.Lj7:
# [8] inc(i1);
incl%ecx
# [9] i2:= i1+i2;
movl%edx,%eax
addl%ecx,%eax
movl%eax,%edx
.Lj8:
cmpl$5,%ecx
jl  .Lj7
.Lj9:
# [11] exitcode:= i2;
movl%edx,operatingsystem_result
# [12] end.
callFPC_DO_EXIT
ret
.Le0:
.size   main, .Le0 - main
"

--
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