forked from M-Labs/artiq
compiler.embedding.Stitcher: refactor.
This commit is contained in:
parent
46476516ba
commit
62e6f8a03d
|
@ -174,7 +174,7 @@ class Stitcher:
|
|||
self.inverse_rpc_map[obj_id] = self.next_rpc
|
||||
return self.next_rpc
|
||||
|
||||
def _iterate(self):
|
||||
def finalize(self):
|
||||
inferencer = Inferencer(engine=self.engine)
|
||||
|
||||
# Iterate inference to fixed point.
|
||||
|
@ -414,4 +414,17 @@ class Stitcher:
|
|||
synthesizer.finalize()
|
||||
self.typedtree.append(call_node)
|
||||
|
||||
self._iterate()
|
||||
def finalize(self):
|
||||
inferencer = Inferencer(engine=self.engine)
|
||||
|
||||
# Iterate inference to fixed point.
|
||||
self.inference_finished = False
|
||||
while not self.inference_finished:
|
||||
self.inference_finished = True
|
||||
inferencer.visit(self.typedtree)
|
||||
|
||||
# After we have found all functions, synthesize a module to hold them.
|
||||
source_buffer = source.Buffer("", "<synthesized>")
|
||||
self.typedtree = asttyped.ModuleT(
|
||||
typing_env=self.globals, globals_in_scope=set(),
|
||||
body=self.typedtree, loc=source.Range(source_buffer, 0, 0))
|
||||
|
|
|
@ -36,6 +36,7 @@ class Core:
|
|||
|
||||
stitcher = Stitcher(engine=engine)
|
||||
stitcher.stitch_call(function, args, kwargs)
|
||||
stitcher.finalize()
|
||||
|
||||
module = Module(stitcher)
|
||||
target = OR1KTarget()
|
||||
|
|
Loading…
Reference in New Issue