[polyml] Interfaces for printing IR and generated code

2010-08-22 Thread Yue Li
Dear David,

As you mentioned previously, Poly/ML first compiles ML program into
the IR, which is further passed to a code generator to produce low
level code.

I was trying to understand and document the semantics of the opcode
set used by Poly/ML's interpreter, and I'm wondering whether inside
Poly/ML's compiler, there are such debugging functions which could
print out the IR tree as well as the generated op code for an input ML
program? These functions would help me a lot to test my understanding
on Poly's IR data structure and code generation.  Thank you very much!

Best,

Yue
___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml


Re: [polyml] Poly/ML 5.4

2010-08-22 Thread David Matthews

Rob Arthan wrote:


Thanks for the clarification. In fact, I didn't explain myself very
well. What I meant was that as I have had problems of the sort
linking Poly/ML programs because I used cc rather than c++, I thought
it might be better to use c++ in the documentation throughout.


I think it depends a bit on the platform.  I would guess that using c++ 
to do the linking would make it easier to find the c++ libraries if 
they're in a non-standard place.  The Poly/ML configure script uses 
autoconf/automake/libtool to sort all these things out and that's 
probably the most portable way of doing it.  It ought to be fairly easy 
to copy the relevant bits from the polyml directory and adapt them as 
necessary.


Regards,
David

___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml


Re: [polyml] Interfaces for printing IR and generated code

2010-08-22 Thread David Matthews

Yue Li wrote:

I was trying to understand and document the semantics of the opcode
set used by Poly/ML's interpreter, and I'm wondering whether inside
Poly/ML's compiler, there are such debugging functions which could
print out the IR tree as well as the generated op code for an input ML
program? These functions would help me a lot to test my understanding
on Poly's IR data structure and code generation.  Thank you very much!


Yue,
There are switches in the PolyML.Compiler structure that will print out 
various stages of the compilation process when compiling something. 
Probably the most useful for you would be

PolyML.Compiler.codetree := true;
which will cause the compiler to print out the code-tree.  You may also 
find codetreeAfterOpt (i.e. code-tree after it has been through the 
optimiser) and assemblyCode (the machine code generated by the final 
code-generator) useful as well.


Regards,
David
___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml


Re: [polyml] Interfaces for printing IR and generated code

2010-08-22 Thread Yue Li
On Sun, Aug 22, 2010 at 5:32 AM, David Matthews
david.matth...@prolingua.co.uk wrote:
 Yue Li wrote:

 I was trying to understand and document the semantics of the opcode
 set used by Poly/ML's interpreter, and I'm wondering whether inside
 Poly/ML's compiler, there are such debugging functions which could
 print out the IR tree as well as the generated op code for an input ML
 program? These functions would help me a lot to test my understanding
 on Poly's IR data structure and code generation.  Thank you very much!

 Yue,
 There are switches in the PolyML.Compiler structure that will print out
 various stages of the compilation process when compiling something. Probably
 the most useful for you would be
 PolyML.Compiler.codetree := true;
 which will cause the compiler to print out the code-tree.  You may also find
 codetreeAfterOpt (i.e. code-tree after it has been through the optimiser)
 and assemblyCode (the machine code generated by the final code-generator)
 useful as well.

   This works and I can see the printed code tree now. I will have
more questions later when I tried more examples.

Many thanks!!

Yue
___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml