1 package org.simantics.scl.compiler.internal.codegen.writer;
\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
10 public class RecursiveDefinitionWriter {
\r
11 ModuleWriter moduleWriter;
\r
14 public RecursiveDefinitionWriter(ModuleWriter moduleWriter, LetFunctions let) {
\r
15 this.moduleWriter = moduleWriter;
\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
25 let.addFunction(function);
\r
27 return new CodeWriter(moduleWriter, block);
\r
30 public void setLocation(long loc) {
\r
31 let.setRecursiveGroupLocation(loc);
\r