Example #1
0
 public CompilationContext(
     LLVMSharp.API.Module llvmModule,
     AssemblyBuilder assemblyBuilder,
     TypeBuilder typeBuilder)
 {
     LLVMModule      = llvmModule;
     AssemblyBuilder = assemblyBuilder;
     TypeBuilder     = typeBuilder;
 }
Example #2
0
        public static Function AddFunction(this Module module, Type returnType, string name, Type[] parameterTypes, Action <Function, IRBuilder> action)
        {
            var type    = FunctionType.Create(returnType, parameterTypes);
            var func    = module.AddFunction(name, type);
            var block   = func.AppendBasicBlock(string.Empty);
            var builder = IRBuilder.Create(module.Context);

            builder.PositionBuilderAtEnd(block);
            action(func, builder);
            return(func);
        }