public CompilationContext( LLVMSharp.API.Module llvmModule, AssemblyBuilder assemblyBuilder, TypeBuilder typeBuilder) { LLVMModule = llvmModule; AssemblyBuilder = assemblyBuilder; TypeBuilder = typeBuilder; }
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); }