forked from M-Labs/artiq
1
0
Fork 0

compiler.embedding.Stitcher: refactor.

This commit is contained in:
whitequark 2015-08-10 20:25:57 +03:00
parent 46476516ba
commit 62e6f8a03d
2 changed files with 16 additions and 2 deletions

View File

@ -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))

View File

@ -36,6 +36,7 @@ class Core:
stitcher = Stitcher(engine=engine)
stitcher.stitch_call(function, args, kwargs)
stitcher.finalize()
module = Module(stitcher)
target = OR1KTarget()