Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2025-12

FPC's compiler directory and file prefix meaning

4 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

Hi.

I was browsing the FPC's 'compiler' directory and noticed a pattern of file name prefixed.

dbg*.pas - I can deduce 'debug'

But what does the 'nc*' and 'og*' and 'opt*' prefixes mean? eg: ogbase, gomap, ogelf etc.

Regards,
Graeme

Reply by email

Michael Van Canneyt
to Unknown author
mailinglists--- wrote 9 lines
Hi. I was browsing the FPC's 'compiler' directory and noticed a pattern of file name prefixed. dbg*.pas - I can deduce 'debug' But what does the 'nc*' and 'og*' and 'opt*' prefixes mean? eg: ogbase, gomap, ogelf etc.

Educated guess:

nc - node conversion
og - object (file) generation
opt - optimizer

?

Michael.

Reply by email

Hairy Pixels
to Michael Van Canneyt

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.

Reply by email

Nikolay Nikolov
to Hairy Pixels
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

Reply by email