]> gerrit.simantics Code Review - simantics/platform.git/blob
9dba1dba7006ced62957e1f6583b1d7ff7b6301a
[simantics/platform.git] /
1 package org.simantics.scl.compiler.internal.codegen.writer;\r
2 \r
3 import org.simantics.scl.compiler.internal.codegen.references.BoundVar;\r
4 import org.simantics.scl.compiler.internal.codegen.ssa.SSABlock;\r
5 import org.simantics.scl.compiler.internal.codegen.ssa.SSAFunction;\r
6 import org.simantics.scl.compiler.internal.codegen.ssa.statements.LetFunctions;\r
7 import org.simantics.scl.compiler.types.TVar;\r
8 import org.simantics.scl.compiler.types.Type;\r
9 \r
10 public class RecursiveDefinitionWriter {\r
11     ModuleWriter moduleWriter;\r
12     LetFunctions let;\r
13 \r
14     public RecursiveDefinitionWriter(ModuleWriter moduleWriter, LetFunctions let) {\r
15         this.moduleWriter = moduleWriter;\r
16         this.let = let;\r
17     }\r
18 \r
19     public CodeWriter createFunction(BoundVar target, TVar[] typeParameters, Type effect, Type returnType, Type[] parameterTypes) {\r
20         SSAFunction function = new SSAFunction(typeParameters, effect, returnType);\r
21         SSABlock block = new SSABlock(parameterTypes);\r
22         function.addBlock(block);\r
23         function.setTarget(target);\r
24         \r
25         let.addFunction(function);\r
26         \r
27         return new CodeWriter(moduleWriter, block);\r
28     }\r
29 \r
30     public void setLocation(long loc) {\r
31         let.setRecursiveGroupLocation(loc);\r
32     }\r
33 }\r