Hairy Pixels wrote 7 lines
On Dec 17, 2025 at 8:48:35 PM, Michael Van Canneyt via fpc-pascal
wrote:
> nc - node conversion
ncgmat.pas is n for node, then cg for code generator, and mat
for mathematical. All the node related units are prefixed with n and
it's a code generator for nodes.
That is correct. All the nodes have a hierarchy. So, for the math notes, we have:
nmat.pas - the base classes node - this includes functionality for the type checking (pass_typecheck), pass_1 (optional transformations at the tree level), optimizations (simplify)
ncgmat.pas - the generic code generator for the math nodes (pass_generate_code)
x86/nx86mat.pas - CPU-specific overrides for the math nodes (I'm using x86 as an example here, other CPUs have similar units in their CPU-specific directory)
x86_64/nx64mat.pas - another layer of CPU-specific overrides. This one is specific to x86_64 only, while the above is common to i8086, i386 and x86_64.
The same pattern applies to other node types, e.g. nadd.pas, ncgadd.pas, etc. for "add" nodes (actually +, -, *, and, or, xor and similar). nflw.pas, ncgflw, etc for control flow nodes (if..then..else, goto, try..except, for, while, etc.)
Nikolay