# compiler/cgen

Dark Mode

- 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, passes, wordrecg, treetab, cgmeth, rodutils, renderer, cgendata, aliases, lowerings, ndi, lineinfos, pathutils, transf, injectdestructors, astmsgs, modulepaths, spawn, semparallel, ic/ic, sighashes, modulegraphs, dfa, parampatterns

# Consts

    cgenPass = (myOpen, myProcess, myClose, false)

  Source Edit

# Procs

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

  Source Edit

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

  Source Edit

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

  Also called from IC. Source Edit

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

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

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

  Source Edit

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

  Source Edit

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

  Called from the IC backend. Source Edit

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

  Source Edit

# Templates

    template cgDeclFrmt(s: PSym): string

  Source Edit