See pliant computing mechanism for a general introduction on meta-programming
The Pliant optimizer and code generator stands in optimize.c which is documented.

If you want to dig in the code generator, just start by running:

pliant debug 0 module /pliant/sample/code_generator.pli

It will display of the sample function (factorial function) at three low level compiling stages: All assignments (two local variables are shared or a local variable is assigned to a processor register) are displayed.

This is a sample line extracted from the listing:

2048: cast_uInt_Int c6 a7 <= 768  (uInt Int  /pliant/language/type/number/int.pli (internals) 43 1)

It's meaning is:


The instruction index is 2048. Each instruction in the function is assigned an index that is unic. indices are ordered.

cast_uInt_Int c6 a7

The instruction calls function 'cast_uInt_Int' with two arguments 'c6' and 'a7'
Arguments starting with 'c' are constants.
Arguments starting with 'a' are local variables.
Arguments starting with 'r' are registers: they have to be assigned to a processor register, but we don't know yet which.
Processor registers are displayed using their usual name (EAX, EBX, ...)

<= 768

There is a possible jump to this instruction from instruction with index 768

uInt Int  /pliant/language/type/number/int.pli (internals) 43 1

The argument types for function 'cast_uInt_Int' are uInt and Int, and the function is defined in /pliant/language/type/number/int.pli at line 43.