lowerings
Source Edit This module implements common simple lowerings.
Imports
ast, astalgo, types, idents, magicsys, msgs, options, modulegraphs, lineinfos
Consts
Procs
proc addField(obj: PType; s: PSym; cache: IdentCache; idgen: IdGenerator): PSym {.
...raises: [], tags: [], forbids: [].} - Source Edit
proc addUniqueField(obj: PType; s: PSym; cache: IdentCache; idgen: IdGenerator): PSym {.
discardable, ...raises: [], tags: [], forbids: [].} - Source Edit
proc addVar(father, v, value: PNode) {....raises: [], tags: [], forbids: [].} - Source Edit
proc addVar(father, v: PNode) {....raises: [], tags: [], forbids: [].} - Source Edit
proc callCodegenProc(g: ModuleGraph; name: string;
info: TLineInfo = unknownLineInfo; arg1: PNode = nil;
arg2: PNode = nil; arg3: PNode = nil;
optionalArgs: PNode = nil): PNode {....raises: [KeyError,
Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
ReadDirEffect, RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
forbids: [].} - Source Edit
proc createObj(g: ModuleGraph; idgen: IdGenerator; owner: PSym; info: TLineInfo;
final = true): PType {....raises: [KeyError, Exception],
tags: [ReadDirEffect, RootEffect],
forbids: [].} - Source Edit
proc evalOnce(g: ModuleGraph; value: PNode; idgen: IdGenerator; owner: PSym): PNode {.
...raises: [], tags: [], forbids: [].} - 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: [], forbids: [].} - Source Edit
proc genDeref(n: PNode; k = nkHiddenDeref): PNode {....raises: [], tags: [],
forbids: [].} - Source Edit
proc genHigh(g: ModuleGraph; n: PNode): PNode {....raises: [KeyError, Exception,
ValueError, OSError, IOError, ERecoverableError], tags: [ReadDirEffect,
RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].} - Source Edit
proc genLen(g: ModuleGraph; n: PNode): PNode {....raises: [KeyError, Exception,
ValueError, OSError, IOError, ERecoverableError], tags: [ReadDirEffect,
RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].} - Source Edit
proc getFieldFromObj(t: PType; v: PSym): PSym {....raises: [], tags: [],
forbids: [].} - Source Edit
proc indirectAccess(a, b: PSym; info: TLineInfo): PNode {....raises: [], tags: [],
forbids: [].} - Source Edit
proc indirectAccess(a: PNode; b: ItemId; info: TLineInfo): PNode {....raises: [],
tags: [], forbids: [].} - Source Edit
proc indirectAccess(a: PNode; b: PSym; info: TLineInfo): PNode {....raises: [],
tags: [], forbids: [].} - Source Edit
proc indirectAccess(a: PNode; b: string; info: TLineInfo; cache: IdentCache): PNode {.
...raises: [], tags: [], forbids: [].} - Source Edit
proc lowerSwap(g: ModuleGraph; n: PNode; idgen: IdGenerator; owner: PSym): PNode {.
...raises: [], tags: [], forbids: [].} - 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], forbids: [].} - Source Edit
proc newAsgnStmt(le, ri: PNode): PNode {....raises: [], tags: [], forbids: [].} - Source Edit
proc newDeref(n: PNode): PNode {.inline, ...raises: [], tags: [], forbids: [].} - Source Edit
proc newDotExpr(obj, b: PSym): PNode {....raises: [], tags: [], forbids: [].} - Source Edit
proc newFastAsgnStmt(le, ri: PNode): PNode {....raises: [], tags: [], forbids: [].} - Source Edit
proc newFastMoveStmt(g: ModuleGraph; le, ri: PNode): PNode {....raises: [KeyError,
Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
ReadDirEffect, RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
forbids: [].} - Source Edit
proc newIntLit(g: ModuleGraph; info: TLineInfo; value: BiggestInt): PNode {....raises: [
KeyError, Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
ReadDirEffect, RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
forbids: [].} - Source Edit
proc newTryFinally(body, final: PNode): PNode {....raises: [], tags: [],
forbids: [].} - Source Edit
proc newTupleAccess(g: ModuleGraph; tup: PNode; i: int): PNode {....raises: [
KeyError, Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
ReadDirEffect, RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
forbids: [].} - Source Edit
proc newTupleAccessRaw(tup: PNode; i: int): PNode {....raises: [KeyError],
tags: [], forbids: [].} - Source Edit
proc rawAddField(obj: PType; field: PSym) {....raises: [], tags: [], forbids: [].} - Source Edit
proc rawDirectAccess(obj, field: PSym): PNode {....raises: [], tags: [],
forbids: [].} - Source Edit
proc rawIndirectAccess(a: PNode; field: PSym; info: TLineInfo): PNode {.
...raises: [], tags: [], forbids: [].} - Source Edit