public Function(Block block, string name, ImmutableList<Argument> arguments, string returnType)
 {
     Debug.Assert(block != null);
     _block = block;
     _name = name;
     _args = arguments;
     _returnType = returnType;
 }
Esempio n. 2
0
        private LLVMValueRef GenerateBlock(Block block, LLVMValueRef llvmFunc, LLVMBuilderRef builder)
        {
            _table.EnterContext();

            LLVMBasicBlockRef basicBlock;
            if (LLVM.GetBasicBlocks(llvmFunc).Count() == 0)
            {
                basicBlock = LLVM.AppendBasicBlock(llvmFunc, "basicblock");
            }
            else
            {
                basicBlock = LLVM.GetBasicBlocks(llvmFunc).First();
            }

            LLVM.PositionBuilderAtEnd(builder, basicBlock);

            foreach (Expression exp in block.Expressions)
            {
                GenerateExpression(exp, builder);
            }

            _table.LeaveContext();
            return basicBlock;
        }