compiler: remove unused assignment flags (#9760)
This commit is contained in:
parent
574cdfc156
commit
2b2fc5c7e9
2 changed files with 5 additions and 20 deletions
|
|
@ -173,21 +173,6 @@ proc genRefAssign(p: BProc, dest, src: TLoc, flags: TAssignmentFlags) =
|
||||||
linefmt(p, cpsStmts, "$1 = $2;$n", rdLoc(dest), rdLoc(src))
|
linefmt(p, cpsStmts, "$1 = $2;$n", rdLoc(dest), rdLoc(src))
|
||||||
elif dest.storage == OnHeap:
|
elif dest.storage == OnHeap:
|
||||||
# location is on heap
|
# location is on heap
|
||||||
# now the writer barrier is inlined for performance:
|
|
||||||
#
|
|
||||||
# if afSrcIsNotNil in flags:
|
|
||||||
# UseMagic(p.module, 'nimGCref')
|
|
||||||
# lineF(p, cpsStmts, 'nimGCref($1);$n', [rdLoc(src)])
|
|
||||||
# elif afSrcIsNil notin flags:
|
|
||||||
# UseMagic(p.module, 'nimGCref')
|
|
||||||
# lineF(p, cpsStmts, 'if ($1) nimGCref($1);$n', [rdLoc(src)])
|
|
||||||
# if afDestIsNotNil in flags:
|
|
||||||
# UseMagic(p.module, 'nimGCunref')
|
|
||||||
# lineF(p, cpsStmts, 'nimGCunref($1);$n', [rdLoc(dest)])
|
|
||||||
# elif afDestIsNil notin flags:
|
|
||||||
# UseMagic(p.module, 'nimGCunref')
|
|
||||||
# lineF(p, cpsStmts, 'if ($1) nimGCunref($1);$n', [rdLoc(dest)])
|
|
||||||
# lineF(p, cpsStmts, '$1 = $2;$n', [rdLoc(dest), rdLoc(src)])
|
|
||||||
if canFormAcycle(dest.t):
|
if canFormAcycle(dest.t):
|
||||||
linefmt(p, cpsStmts, "#asgnRef((void**) $1, $2);$n",
|
linefmt(p, cpsStmts, "#asgnRef((void**) $1, $2);$n",
|
||||||
addrLoc(p.config, dest), rdLoc(src))
|
addrLoc(p.config, dest), rdLoc(src))
|
||||||
|
|
@ -1155,7 +1140,7 @@ proc genSeqElemAppend(p: BProc, e: PNode, d: var TLoc) =
|
||||||
getIntTemp(p, tmpL)
|
getIntTemp(p, tmpL)
|
||||||
lineCg(p, cpsStmts, "$1 = $2->$3++;$n", tmpL.r, rdLoc(a), lenField(p))
|
lineCg(p, cpsStmts, "$1 = $2->$3++;$n", tmpL.r, rdLoc(a), lenField(p))
|
||||||
dest.r = ropecg(p.module, "$1$3[$2]", rdLoc(a), tmpL.r, dataField(p))
|
dest.r = ropecg(p.module, "$1$3[$2]", rdLoc(a), tmpL.r, dataField(p))
|
||||||
genAssignment(p, dest, b, {needToCopy, afDestIsNil})
|
genAssignment(p, dest, b, {needToCopy})
|
||||||
gcUsage(p.config, e)
|
gcUsage(p.config, e)
|
||||||
|
|
||||||
proc genReset(p: BProc, n: PNode) =
|
proc genReset(p: BProc, n: PNode) =
|
||||||
|
|
@ -1394,7 +1379,7 @@ proc genArrToSeq(p: BProc, n: PNode, d: var TLoc) =
|
||||||
elem.storage = OnHeap # we know that sequences are on the heap
|
elem.storage = OnHeap # we know that sequences are on the heap
|
||||||
initLoc(arr, locExpr, lodeTyp elemType(skipTypes(n.sons[1].typ, abstractInst)), a.storage)
|
initLoc(arr, locExpr, lodeTyp elemType(skipTypes(n.sons[1].typ, abstractInst)), a.storage)
|
||||||
arr.r = ropecg(p.module, "$1[$2]", rdLoc(a), intLiteral(i))
|
arr.r = ropecg(p.module, "$1[$2]", rdLoc(a), intLiteral(i))
|
||||||
genAssignment(p, elem, arr, {afDestIsNil, needToCopy})
|
genAssignment(p, elem, arr, {needToCopy})
|
||||||
else:
|
else:
|
||||||
var i: TLoc
|
var i: TLoc
|
||||||
getTemp(p, getSysType(p.module.g.graph, unknownLineInfo(), tyInt), i)
|
getTemp(p, getSysType(p.module.g.graph, unknownLineInfo(), tyInt), i)
|
||||||
|
|
@ -1405,7 +1390,7 @@ proc genArrToSeq(p: BProc, n: PNode, d: var TLoc) =
|
||||||
elem.storage = OnHeap # we know that sequences are on the heap
|
elem.storage = OnHeap # we know that sequences are on the heap
|
||||||
initLoc(arr, locExpr, lodeTyp elemType(skipTypes(n.sons[1].typ, abstractInst)), a.storage)
|
initLoc(arr, locExpr, lodeTyp elemType(skipTypes(n.sons[1].typ, abstractInst)), a.storage)
|
||||||
arr.r = ropecg(p.module, "$1[$2]", rdLoc(a), rdLoc(i))
|
arr.r = ropecg(p.module, "$1[$2]", rdLoc(a), rdLoc(i))
|
||||||
genAssignment(p, elem, arr, {afDestIsNil, needToCopy})
|
genAssignment(p, elem, arr, {needToCopy})
|
||||||
lineF(p, cpsStmts, "}$n", [])
|
lineF(p, cpsStmts, "}$n", [])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,7 @@ proc genObjectInit(p: BProc, section: TCProcSection, t: PType, a: TLoc,
|
||||||
|
|
||||||
type
|
type
|
||||||
TAssignmentFlag = enum
|
TAssignmentFlag = enum
|
||||||
needToCopy, afDestIsNil, afDestIsNotNil, afSrcIsNil, afSrcIsNotNil
|
needToCopy
|
||||||
TAssignmentFlags = set[TAssignmentFlag]
|
TAssignmentFlags = set[TAssignmentFlag]
|
||||||
|
|
||||||
proc genRefAssign(p: BProc, dest, src: TLoc, flags: TAssignmentFlags)
|
proc genRefAssign(p: BProc, dest, src: TLoc, flags: TAssignmentFlags)
|
||||||
|
|
@ -313,7 +313,7 @@ proc resetLoc(p: BProc, loc: var TLoc) =
|
||||||
var nilLoc: TLoc
|
var nilLoc: TLoc
|
||||||
initLoc(nilLoc, locTemp, loc.lode, OnStack)
|
initLoc(nilLoc, locTemp, loc.lode, OnStack)
|
||||||
nilLoc.r = rope("NIM_NIL")
|
nilLoc.r = rope("NIM_NIL")
|
||||||
genRefAssign(p, loc, nilLoc, {afSrcIsNil})
|
genRefAssign(p, loc, nilLoc, {})
|
||||||
else:
|
else:
|
||||||
linefmt(p, cpsStmts, "$1 = 0;$n", rdLoc(loc))
|
linefmt(p, cpsStmts, "$1 = 0;$n", rdLoc(loc))
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue