# cgendata

Theme:

- Index

Search:
Group by:
Source Edit

This module contains the data structures for the C code generation phase.

# Imports

ast, ropes, options, lineinfos, pathutils, modulegraphs

# Types

    BModule = ref TCGen

  Source Edit

    BModuleList = ref object of RootObj
      mainModProcs*, mainModInit*, otherModsInit*, mainDatInit*: Rope
      mapping*: Rope
      modules*: seq[BModule]
      modulesClosed*: seq[BModule]
      forwardedProcs*: seq[PSym]
      generatedHeader*: BModule
      typeInfoMarker*: TypeCacheWithOwner
      typeInfoMarkerV2*: TypeCacheWithOwner
      config*: ConfigRef
      graph*: ModuleGraph
      strVersion*, seqVersion*: int
      nimtv*: Rope
      nimtvDeps*: seq[PType]
      nimtvDeclared*: IntSet
      mangledPrcs*: HashSet[string]

  Source Edit

    BProc = ref TCProc

  Source Edit

    CodegenFlag = enum
      preventStackTrace, usesThreadVars, frameDeclared, isHeaderFile,
      includesStringh, objHasKidsValid, useAliveDataFromDce

  Source Edit

    TBlock = object
      id*: int
      label*: Rope
      sections*: TCProcSections
      isLoop*: bool
      nestedTryStmts*: int16
      nestedExceptStmts*: int16
      frameLen*: int16

  Source Edit

    TCFileSection = enum
      cfsHeaders, cfsFrameDefines, cfsForwardTypes, cfsTypes, cfsSeqTypes,
      cfsTypeInfo, cfsProcHeaders, cfsStrData, cfsData, cfsVars, cfsProcs,
      cfsInitProc, cfsDatInitProc, cfsTypeInit1, cfsTypeInit3, cfsDynLibInit

  Source Edit

    TCFileSections = array[TCFileSection, Rope]

  Source Edit

    TCProcFlag = enum
      beforeRetNeeded, threadVarAccessed, hasCurFramePointer, noSafePoints,
      nimErrorFlagAccessed, nimErrorFlagDeclared, nimErrorFlagDisabled

  Source Edit

    TCProcSection = enum
      cpsLocals, cpsInit, cpsStmts

  Source Edit

    TCProcSections = array[TCProcSection, Rope]

  Source Edit

    TCTypeKind = enum
      ctVoid, ctChar, ctBool, ctInt, ctInt8, ctInt16, ctInt32, ctInt64, ctFloat,
      ctFloat32, ctFloat64, ctFloat128, ctUInt, ctUInt8, ctUInt16, ctUInt32,
      ctUInt64, ctArray, ctPtrToArray, ctStruct, ctPtr, ctNimStr, ctNimSeq, ctProc,
      ctCString

  Source Edit

    TLabel = Rope

  Source Edit

    TTypeSeq = seq[PType]

  Source Edit

    TypeCache = Table[SigHash, Rope]

  Source Edit

    TypeCacheWithOwner = Table[SigHash, tuple[str: Rope, owner: int32]]

  Source Edit

# Procs

    proc includeHeader(this: BModule; header: string) {....raises: [], tags: [],
        forbids: [].}

  Source Edit

    proc initBlock(): TBlock {....raises: [], tags: [], forbids: [].}

  Source Edit

    proc newModuleList(g: ModuleGraph): BModuleList {....raises: [], tags: [],
        forbids: [].}

  Source Edit

    proc newProc(prc: PSym; module: BModule): BProc {....raises: [], tags: [],
        forbids: [].}

  Source Edit

    proc procSec(p: BProc; s: TCProcSection): var Rope {.inline, ...raises: [],
        tags: [], forbids: [].}

  Source Edit

    proc s(p: BProc; s: TCProcSection): var Rope {.inline, ...raises: [], tags: [],
        forbids: [].}

  Source Edit

# Iterators

    iterator cgenModules(g: BModuleList): BModule {....raises: [], tags: [],
        forbids: [].}

  Source Edit

# Templates

    template config(m: BModule): ConfigRef

  Source Edit

    template config(p: BProc): ConfigRef

  Source Edit

    template vccAndC(p: BProc): bool

  Source Edit