Esempio n. 1
0
        private SNode Visit(SNode node)
        {
            LLVMTypeRef[] paramType = { };
            var           funcType  = LLVMTypeRef.CreateFunction(LLVMTypeRef.Void, paramType);

            func  = mod.AddFunction("main", funcType);
            entry = func.AppendBasicBlock("entry");
            var body = func.AppendBasicBlock("body");

            blockStack.Add(entry);
            blockStack.Add(body);
            symbolTables.Add(new LLVMSymbolTable(symbolTables.Last()));
            builder.PositionAtEnd(body);
            Visit(node.CompoundStatement);
            builder.BuildRetVoid();
            builder.PositionAtEnd(entry);
            builder.BuildBr(body);
            return(node);
        }