compiler/lowerings

    Dark Mode
Search:
Group by:
  Source   Edit

This module implements common simple lowerings.

Consts

genPrefix = ":tmp"
  Source   Edit

Procs

proc addField(obj: PType; s: PSym; cache: IdentCache; idgen: IdGenerator): PSym {.
    ...raises: [], tags: [].}
  Source   Edit
proc addUniqueField(obj: PType; s: PSym; cache: IdentCache; idgen: IdGenerator): PSym {.
    discardable, ...raises: [], tags: [].}
  Source   Edit
proc addVar(father, v, value: PNode) {....raises: [], tags: [].}
  Source   Edit
proc addVar(father, v: PNode) {....raises: [], tags: [].}
  Source   Edit
proc callCodegenProc(g: ModuleGraph; name: string;
                     info: TLineInfo = unknownLineInfo;
                     arg1, arg2, arg3, optionalArgs: PNode = nil): PNode {....raises: [
    KeyError, Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
    ReadDirEffect, RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc createObj(g: ModuleGraph; idgen: IdGenerator; owner: PSym; info: TLineInfo;
               final = true): PType {....raises: [KeyError, Exception],
                                      tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc evalOnce(g: ModuleGraph; value: PNode; idgen: IdGenerator; owner: PSym): PNode {.
    ...raises: [], tags: [].}
Turns (value) into (let tmp = value; tmp) so that 'value' can be re-used freely, multiple times. This is frequently required and such a builtin would also be handy to have in macros.nim. The value that can be reused is 'result.lastSon'!   Source   Edit
proc genAddrOf(n: PNode; idgen: IdGenerator; typeKind = tyPtr): PNode {.
    ...raises: [], tags: [].}
  Source   Edit
proc genDeref(n: PNode; k = nkHiddenDeref): PNode {....raises: [], tags: [].}
  Source   Edit
proc genHigh(g: ModuleGraph; n: PNode): PNode {....raises: [KeyError, Exception,
    ValueError, OSError, IOError, ERecoverableError], tags: [ReadDirEffect,
    RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc genLen(g: ModuleGraph; n: PNode): PNode {....raises: [KeyError, Exception,
    ValueError, OSError, IOError, ERecoverableError], tags: [ReadDirEffect,
    RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc getFieldFromObj(t: PType; v: PSym): PSym {....raises: [], tags: [].}
  Source   Edit
proc indirectAccess(a, b: PSym; info: TLineInfo): PNode {....raises: [], tags: [].}
  Source   Edit
proc indirectAccess(a: PNode; b: ItemId; info: TLineInfo): PNode {....raises: [],
    tags: [].}
  Source   Edit
proc indirectAccess(a: PNode; b: PSym; info: TLineInfo): PNode {....raises: [],
    tags: [].}
  Source   Edit
proc indirectAccess(a: PNode; b: string; info: TLineInfo; cache: IdentCache): PNode {.
    ...raises: [], tags: [].}
  Source   Edit
proc lowerSwap(g: ModuleGraph; n: PNode; idgen: IdGenerator; owner: PSym): PNode {.
    ...raises: [], tags: [].}
  Source   Edit
proc lowerTupleUnpacking(g: ModuleGraph; n: PNode; idgen: IdGenerator;
                         owner: PSym): PNode {....raises: [KeyError, Exception,
    ValueError, OSError, IOError, ERecoverableError], tags: [ReadDirEffect,
    RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc lowerTupleUnpackingForAsgn(g: ModuleGraph; n: PNode; idgen: IdGenerator;
                                owner: PSym): PNode {....raises: [KeyError],
    tags: [].}
  Source   Edit
proc newAsgnStmt(le, ri: PNode): PNode {....raises: [], tags: [].}
  Source   Edit
proc newDeref(n: PNode): PNode {.inline, ...raises: [], tags: [].}
  Source   Edit
proc newDotExpr(obj, b: PSym): PNode {....raises: [], tags: [].}
  Source   Edit
proc newFastAsgnStmt(le, ri: PNode): PNode {....raises: [], tags: [].}
  Source   Edit
proc newFastMoveStmt(g: ModuleGraph; le, ri: PNode): PNode {....raises: [KeyError,
    Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
    ReadDirEffect, RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc newIntLit(g: ModuleGraph; info: TLineInfo; value: BiggestInt): PNode {....raises: [
    KeyError, Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
    ReadDirEffect, RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc newTryFinally(body, final: PNode): PNode {....raises: [], tags: [].}
  Source   Edit
proc newTupleAccess(g: ModuleGraph; tup: PNode; i: int): PNode {....raises: [
    KeyError, Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
    ReadDirEffect, RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc newTupleAccessRaw(tup: PNode; i: int): PNode {....raises: [KeyError], tags: [].}
  Source   Edit
proc rawAddField(obj: PType; field: PSym) {....raises: [], tags: [].}
  Source   Edit
proc rawDirectAccess(obj, field: PSym): PNode {....raises: [], tags: [].}
  Source   Edit
proc rawIndirectAccess(a: PNode; field: PSym; info: TLineInfo): PNode {.
    ...raises: [], tags: [].}
  Source   Edit