compiler/backend/cgbackend

  Source   Edit

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).

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