# 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, lineinfos, pathutils, transf, injectdestructors, astmsgs, modulepaths, pushpoppragmas, mangleutils, expanddefaults, pipelineutils, spawn, semparallel, ic/ic, sighashes, modulegraphs, aliasanalysis, parampatterns

# Procs

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

  Source Edit

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

  Source Edit

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

  Also called from IC. Source Edit

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

  Source Edit

    proc genTopLevelStmt(m: BModule; n: PNode) {....raises: [Exception, ValueError,
        OSError, KeyError, IOError, ERecoverableError], 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: [], tags: [], forbids: [].}

  Source Edit

    proc registerInitProcs(g: BModuleList; m: PSym; flags: set[ModuleBackendFlag]) {.
        ...raises: [ValueError, OSError], 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