# cgen

Theme:

- Index

Search:
Group by:
Source Edit

This module implements the C code generator.This include file contains the logic to produce constant string and seq literals. The code here is responsible that `const x = ["a", "b"]` works without hidden runtime creation code. The price is that seqs and strings are not purely a library implementation.Generates traversal procs for the C backend.Code specialization instead of the old, incredibly slow 'genericReset' implementation.Thread var support for architectures that lack native support for thread local storage.

# Imports

ast, astalgo, trees, platform, magicsys, extccomp, options, nversion, nimsets, msgs, bitsets, idents, types, ccgutils, ropes, wordrecg, treetab, cgmeth, rodutils, renderer, cgendata, aliases, lowerings, ndi, lineinfos, pathutils, transf, injectdestructors, astmsgs, modulepaths, backendpragmas, pipelineutils, spawn, semparallel, ic/ic, sighashes, modulegraphs, aliasanalysis, parampatterns

# Procs

    proc cgenWriteModules(backend: RootRef; config: ConfigRef) {....raises: [Exception,
        ValueError, KeyError, IOError, ERecoverableError, OSError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect,
        TimeEffect, WriteDirEffect], forbids: [].}

  Source Edit

    proc fillObjectFields(m: BModule; typ: PType) {....raises: [Exception, ValueError,
        KeyError, IOError, ERecoverableError, OSError], tags: [RootEffect,
        ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}

  Source Edit

    proc finalCodegenActions(graph: ModuleGraph; m: BModule; n: PNode): PNode {....raises: [
        KeyError, Exception, ValueError, IOError, ERecoverableError, OSError], tags: [
        ReadDirEffect, RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
        forbids: [].}

  Also called from IC. Source Edit

    proc genProcAux(m: BModule; prc: PSym) {....raises: [OSError, Exception,
        ERecoverableError, KeyError, ValueError, IOError], tags: [RootEffect,
        ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect, TimeEffect],
        forbids: [].}

  Source Edit

    proc genTopLevelStmt(m: BModule; n: PNode) {....raises: [Exception, ValueError,
        KeyError, IOError, ERecoverableError, OSError], tags: [RootEffect,
        ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect, TimeEffect],
        forbids: [].}

  Also called from `ic/cbackend.nim`. Source Edit

    proc genTypeInfo(config: ConfigRef; m: BModule; t: PType; info: TLineInfo): Rope {....raises: [
        OSError, Exception, ValueError, KeyError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
        forbids: [].}

  Source Edit

    proc multiFormat(frmt: var string; chars: static openArray[char];
                     args: openArray[seq[string]])

  Source Edit

    proc newModule(g: BModuleList; module: PSym; conf: ConfigRef): BModule {.
        ...raises: [OSError, IOError],
        tags: [ReadEnvEffect, ReadIOEffect, WriteDirEffect, ReadDirEffect],
        forbids: [].}

  Source Edit

    proc registerInitProcs(g: BModuleList; m: PSym; flags: set[ModuleBackendFlag]) {.
        ...raises: [Exception], tags: [RootEffect], forbids: [].}

  Called from the IC backend. Source Edit

    proc setupCgen(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext {.
        ...raises: [OSError, IOError],
        tags: [ReadEnvEffect, ReadIOEffect, WriteDirEffect, ReadDirEffect],
        forbids: [].}

  Source Edit

    proc whichInitProcs(m: BModule): set[ModuleBackendFlag] {....raises: [], tags: [],
        forbids: [].}

  Source Edit

# Templates

    template cgDeclFrmt(s: PSym): string

  Source Edit