mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 19:52:36 +00:00
compiler: remove unused assignment flags (#9760)
This commit is contained in:
committed by
Andreas Rumpf
parent
574cdfc156
commit
2b2fc5c7e9
@@ -173,21 +173,6 @@ proc genRefAssign(p: BProc, dest, src: TLoc, flags: TAssignmentFlags) =
|
||||
linefmt(p, cpsStmts, "$1 = $2;$n", rdLoc(dest), rdLoc(src))
|
||||
elif dest.storage == OnHeap:
|
||||
# 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):
|
||||
linefmt(p, cpsStmts, "#asgnRef((void**) $1, $2);$n",
|
||||
addrLoc(p.config, dest), rdLoc(src))
|
||||
@@ -1155,7 +1140,7 @@ proc genSeqElemAppend(p: BProc, e: PNode, d: var TLoc) =
|
||||
getIntTemp(p, tmpL)
|
||||
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))
|
||||
genAssignment(p, dest, b, {needToCopy, afDestIsNil})
|
||||
genAssignment(p, dest, b, {needToCopy})
|
||||
gcUsage(p.config, e)
|
||||
|
||||
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
|
||||
initLoc(arr, locExpr, lodeTyp elemType(skipTypes(n.sons[1].typ, abstractInst)), a.storage)
|
||||
arr.r = ropecg(p.module, "$1[$2]", rdLoc(a), intLiteral(i))
|
||||
genAssignment(p, elem, arr, {afDestIsNil, needToCopy})
|
||||
genAssignment(p, elem, arr, {needToCopy})
|
||||
else:
|
||||
var i: TLoc
|
||||
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
|
||||
initLoc(arr, locExpr, lodeTyp elemType(skipTypes(n.sons[1].typ, abstractInst)), a.storage)
|
||||
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", [])
|
||||
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ proc genObjectInit(p: BProc, section: TCProcSection, t: PType, a: TLoc,
|
||||
|
||||
type
|
||||
TAssignmentFlag = enum
|
||||
needToCopy, afDestIsNil, afDestIsNotNil, afSrcIsNil, afSrcIsNotNil
|
||||
needToCopy
|
||||
TAssignmentFlags = set[TAssignmentFlag]
|
||||
|
||||
proc genRefAssign(p: BProc, dest, src: TLoc, flags: TAssignmentFlags)
|
||||
@@ -313,7 +313,7 @@ proc resetLoc(p: BProc, loc: var TLoc) =
|
||||
var nilLoc: TLoc
|
||||
initLoc(nilLoc, locTemp, loc.lode, OnStack)
|
||||
nilLoc.r = rope("NIM_NIL")
|
||||
genRefAssign(p, loc, nilLoc, {afSrcIsNil})
|
||||
genRefAssign(p, loc, nilLoc, {})
|
||||
else:
|
||||
linefmt(p, cpsStmts, "$1 = 0;$n", rdLoc(loc))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user