Nit: Make elaborate return a new Rtl instead of modifying the existing rtl inplace

This commit is contained in:
Dimo
2017-07-26 16:49:12 -07:00
committed by Jakob Stoklund Olesen
parent 80a42fdeaa
commit 93b57a5209

View File

@@ -101,14 +101,15 @@ def elaborate(r):
primitives = set(PRIMITIVES.instructions) primitives = set(PRIMITIVES.instructions)
idx = 0 idx = 0
outputs = r.definitions() res = Rtl(*r.rtl)
outputs = res.definitions()
while not fp: while not fp:
assert r.is_concrete() assert res.is_concrete()
new_defs = [] # type: List[Def] new_defs = [] # type: List[Def]
fp = True fp = True
for d in r.rtl: for d in res.rtl:
inst = d.expr.inst inst = d.expr.inst
if (inst not in primitives): if (inst not in primitives):
@@ -120,6 +121,6 @@ def elaborate(r):
else: else:
new_defs.append(d) new_defs.append(d)
r.rtl = tuple(new_defs) res.rtl = tuple(new_defs)
return cleanup_semantics(r, outputs) return cleanup_semantics(res, outputs)