On Sun, Aug 22, 2010 at 5:32 AM, David Matthews David.Matthews@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