Implements a generic backend, which is effectively a driver for transf, mid-end processing, and producing CGIR modules. For efficiency, CGIR production currently uses a "jumbo" approach, where the code for the full static program is compiled into a single CGIR module (referred to as the "total" module).
Imports
-
../ast/ast_query, ../ast/ast_types, ../ast/ast_idgen, ../ast/idents, ../ast/lineinfos, backends, ccgutils, cgir2, mir2cg, pretty, validation, ../front/options, ../front/msgs, ../mir/mirbodies, ../mir/mirbridge, ../mir/mirgen, ../mir/mirenv, ../mir/mirtrees, ../mir/mirtypes, ../modules/magicsys, ../modules/modulegraphs, ../sem/modulelowering, ../utils/tracer, ../ast/ast, cgen, ../ast/reports, ../ast/reports_sem
Types
OutModule = object sym*: PSym globals*: seq[StringId] ## globals defined in the module procs*: seq[StringId] ## procedures defined in the module emits*: Emit ## top-level emit/asm statements for the module
- A view into the total CCGIR module, derived from a source module. The entities are ordered by their sem-level ID. Source Edit
Procs
proc generateCode(graph: ModuleGraph; mlist: sink ModuleList; caps: set[Capability]): tuple[all: CgModule, modules: seq[OutModule]] {....raises: [KeyError, Exception, ERecoverableError, ValueError, IOError], tags: [ ReadDirEffect, RootEffect, TimeEffect, WriteIOEffect].}
- Takes the whole-program representation mlist and generates a single CG module containing all live code for it. Source Edit