[fpc-pascal] FPC's compiler directory and file prefix meaning

Nikolay Nikolov nickysn at gmail.com
Wed Dec 17 16:12:50 CET 2025


On 12/17/25 4:07 PM, Hairy Pixels via fpc-pascal wrote:
> On Dec 17, 2025 at 8:48:35 PM, Michael Van Canneyt via fpc-pascal 
> <fpc-pascal at lists.freepascal.org> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20251217/a4becea4/attachment.htm>


More information about the fpc-pascal mailing list