Esempio n. 1
0
 public AddressOfVisitor(
     FunctionStackLayout layout,
     SemanticModule module,
     StructLayoutManager structLayoutManager)
 {
     _layout = layout;
     _module = module;
     _structLayoutManager = structLayoutManager;
 }
Esempio n. 2
0
 public UnaryOperationCodeGenVisitor(FunctionBuilder builder, IExpressionVisitor expressionVisitor, SemanticModule semanticModule, ILTypeSizeManager typeSizeManager, FunctionStackLayout functionStackLayout, StructLayoutManager structLayoutManager)
 {
     _builder             = builder;
     _expressionVisitor   = expressionVisitor;
     _semanticModule      = semanticModule;
     _typeSizeManager     = typeSizeManager;
     _functionStackLayout = functionStackLayout;
     _structLayoutManager = structLayoutManager;
 }
Esempio n. 3
0
 public FunctionCodeGenVisitor(
     FunctionBuilder functionBuilder,
     FunctionStackLayout layout,
     FunctionManager functionManager,
     SemanticModule module,
     SemanticContext semanticContext,
     StructLayoutManager structLayoutManager,
     ILTypeSizeManager typeSizeManager,
     List <string> strings
     )
 {
     _functionBuilder     = functionBuilder;
     _layout              = layout;
     _functionManager     = functionManager;
     _module              = module;
     _semanticContext     = semanticContext;
     _structLayoutManager = structLayoutManager;
     _typeSizeManager     = typeSizeManager;
     _strings             = strings;
 }
Esempio n. 4
0
        private ILFunction GenerateFunction(FunctionDefinitionNode node, List <string> strings)
        {
            StackLayoutGenerator layoutGenerator = new StackLayoutGenerator(_typeSizeManager);

            layoutGenerator.VisitFunctionDefinition(node);
            FunctionStackLayout    layout  = layoutGenerator.GetLayout();
            FunctionBuilder        builder = new FunctionBuilder(layout, _module.BaseModule.SymbolMap);
            FunctionCodeGenVisitor functionCodeGenVisitor = new FunctionCodeGenVisitor(
                builder, layout, _functionManager, _module, _semanticContext, _structLayoutManager,
                _typeSizeManager, strings);

            builder.AddInstruction(OpCode.PUSH, 0, layout.EndAddress);
            functionCodeGenVisitor.VisitBody(node.Body);

            if (builder.InstructionCount == 0 || builder.Instructions[builder.InstructionCount - 1].Op != OpCode.RETURN)
            {
                builder.AddInstruction(OpCode.RETURN);
            }

            return(builder.Build(node));
        }
Esempio n. 5
0
 public FunctionBuilder(FunctionStackLayout layout, IDictionary <ISyntaxTreeNode, Symbol> nodeToTokenMap)
 {
     _layout         = layout;
     _nodeToTokenMap = nodeToTokenMap;
 }