make case-object transitions explicit, make unknownLineInfo a const, replace a few magic numbers with consts (#13170)
This commit is contained in:
parent
2bf337abae
commit
796aafe7e0
35 changed files with 182 additions and 203 deletions
|
|
@ -1457,7 +1457,7 @@ proc genArrToSeq(p: BProc, n: PNode, d: var TLoc) =
|
|||
genAssignment(p, elem, arr, {needToCopy})
|
||||
else:
|
||||
var i: TLoc
|
||||
getTemp(p, getSysType(p.module.g.graph, unknownLineInfo(), tyInt), i)
|
||||
getTemp(p, getSysType(p.module.g.graph, unknownLineInfo, tyInt), i)
|
||||
linefmt(p, cpsStmts, "for ($1 = 0; $1 < $2; $1++) {$n", [i.r, L])
|
||||
initLoc(elem, locExpr, lodeTyp elemType(skipTypes(n.typ, abstractInst)), OnHeap)
|
||||
elem.r = ropecg(p.module, "$1$3[$2]", [rdLoc(d), rdLoc(i), dataField(p)])
|
||||
|
|
@ -1847,10 +1847,10 @@ proc genSetOp(p: BProc, e: PNode, d: var TLoc, op: TMagic) =
|
|||
initLocExpr(p, e[1], a)
|
||||
putIntoDest(p, d, e, ropecg(p.module, "#cardSet($1, $2)", [rdCharLoc(a), size]))
|
||||
of mLtSet, mLeSet:
|
||||
getTemp(p, getSysType(p.module.g.graph, unknownLineInfo(), tyInt), i) # our counter
|
||||
getTemp(p, getSysType(p.module.g.graph, unknownLineInfo, tyInt), i) # our counter
|
||||
initLocExpr(p, e[1], a)
|
||||
initLocExpr(p, e[2], b)
|
||||
if d.k == locNone: getTemp(p, getSysType(p.module.g.graph, unknownLineInfo(), tyBool), d)
|
||||
if d.k == locNone: getTemp(p, getSysType(p.module.g.graph, unknownLineInfo, tyBool), d)
|
||||
if op == mLtSet:
|
||||
linefmt(p, cpsStmts, lookupOpr[mLtSet],
|
||||
[rdLoc(i), size, rdLoc(d), rdLoc(a), rdLoc(b)])
|
||||
|
|
@ -1866,7 +1866,7 @@ proc genSetOp(p: BProc, e: PNode, d: var TLoc, op: TMagic) =
|
|||
putIntoDest(p, d, e, ropecg(p.module, "(#nimCmpMem($1, $2, $3)==0)", [a.rdCharLoc, b.rdCharLoc, size]))
|
||||
of mMulSet, mPlusSet, mMinusSet, mSymDiffSet:
|
||||
# we inline the simple for loop for better code generation:
|
||||
getTemp(p, getSysType(p.module.g.graph, unknownLineInfo(), tyInt), i) # our counter
|
||||
getTemp(p, getSysType(p.module.g.graph, unknownLineInfo, tyInt), i) # our counter
|
||||
initLocExpr(p, e[1], a)
|
||||
initLocExpr(p, e[2], b)
|
||||
if d.k == locNone: getTemp(p, setType, d)
|
||||
|
|
@ -2319,7 +2319,7 @@ proc genSetConstr(p: BProc, e: PNode, d: var TLoc) =
|
|||
[rdLoc(d), getTypeDesc(p.module, e.typ)])
|
||||
for it in e.sons:
|
||||
if it.kind == nkRange:
|
||||
getTemp(p, getSysType(p.module.g.graph, unknownLineInfo(), tyInt), idx) # our counter
|
||||
getTemp(p, getSysType(p.module.g.graph, unknownLineInfo, tyInt), idx) # our counter
|
||||
initLocExpr(p, it[0], a)
|
||||
initLocExpr(p, it[1], b)
|
||||
lineF(p, cpsStmts, "for ($1 = $3; $1 <= $4; $1++) $n" &
|
||||
|
|
@ -2335,7 +2335,7 @@ proc genSetConstr(p: BProc, e: PNode, d: var TLoc) =
|
|||
lineF(p, cpsStmts, "$1 = 0;$n", [rdLoc(d)])
|
||||
for it in e.sons:
|
||||
if it.kind == nkRange:
|
||||
getTemp(p, getSysType(p.module.g.graph, unknownLineInfo(), tyInt), idx) # our counter
|
||||
getTemp(p, getSysType(p.module.g.graph, unknownLineInfo, tyInt), idx) # our counter
|
||||
initLocExpr(p, it[0], a)
|
||||
initLocExpr(p, it[1], b)
|
||||
lineF(p, cpsStmts, "for ($1 = $3; $1 <= $4; $1++) $n" &
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue