cgendata

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

Imports

ast, ropes, options, ndi, lineinfos, pathutils, modulegraphs

Types

TLabel = Rope
Source Edit
TCFileSection = enum
  cfsMergeInfo, cfsHeaders, cfsFrameDefines, cfsForwardTypes, cfsTypes,
  cfsSeqTypes, cfsFieldInfo, cfsTypeInfo, cfsProcHeaders, cfsData, cfsVars,
  cfsProcs, cfsInitProc, cfsDatInitProc, cfsTypeInit1, cfsTypeInit2,
  cfsTypeInit3, cfsDebugInit, cfsDynLibInit, cfsDynLibDeinit
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
TCFileSections = array[TCFileSection, Rope]
Source Edit
TCProcSection = enum
  cpsLocals, cpsInit, cpsStmts
Source Edit
TCProcSections = array[TCProcSection, Rope]
Source Edit
BModule = ref TCGen
Source Edit
BProc = ref TCProc
Source Edit
TBlock = object
  id*: int
  label*: Rope
  sections*: TCProcSections
  isLoop*: bool
  nestedTryStmts*: int16
  nestedExceptStmts*: int16
  frameLen*: int16
Source Edit
TCProcFlag = enum
  beforeRetNeeded, threadVarAccessed, hasCurFramePointer, noSafePoints,
  nimErrorFlagAccessed, nimErrorFlagDeclared, nimErrorFlagDisabled
Source Edit
TTypeSeq = seq[PType]
Source Edit
TypeCache = Table[SigHash, Rope]
Source Edit
TypeCacheWithOwner = Table[SigHash, tuple[str: Rope, owner: PSym]]
Source Edit
CodegenFlag = enum
  preventStackTrace, usesThreadVars, frameDeclared, isHeaderFile,
  includesStringh, objHasKidsValid
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
Source Edit

Procs

proc includeHeader(this: BModule; header: string) {...}{.raises: [], tags: [].}
Source Edit
proc s(p: BProc; s: TCProcSection): var Rope {...}{.inline, raises: [], tags: [].}
Source Edit
proc procSec(p: BProc; s: TCProcSection): var Rope {...}{.inline, raises: [],
    tags: [].}
Source Edit
proc newProc(prc: PSym; module: BModule): BProc {...}{.raises: [], tags: [].}
Source Edit
proc newModuleList(g: ModuleGraph): BModuleList {...}{.raises: [], tags: [].}
Source Edit

Iterators

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

Templates

template config(m: BModule): ConfigRef
Source Edit
template config(p: BProc): ConfigRef
Source Edit

© 2006–2021 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/compiler/cgendata.html