private static void GenFunction( LLVMModuleRef module, LLVMBuilderRef builder, [NotNull] VariableDeclaration variable, [NotNull] LambdaType lambdaType) { var function = LLVMSharp.LLVM.AddFunction(module, variable.Name, GetLlvmType(lambdaType)); LLVMSharp.LLVM.PositionBuilderAtEnd(builder, LLVMSharp.LLVM.AppendBasicBlock(function, "entry")); GenAstHolder.GenAst(module, builder, (LambdaExpression)variable.Expression); LLVMSharp.LLVM.VerifyFunction(function, LLVMVerifierFailureAction.LLVMPrintMessageAction); }
public static string Generate( [NotNull] string moduleName, [NotNull] params Declaration[] declarations) { var core = new Core(); var analyzedDeclarations = core.Analyze(declarations); var moduleRef = LLVMSharp.LLVM.ModuleCreateWithName(moduleName); var builder = LLVMSharp.LLVM.CreateBuilder(); foreach (var analyzedDeclaration in analyzedDeclarations) { GenAstHolder.GenAst(moduleRef, builder, analyzedDeclaration); } // for (var i = 0; i < Constants.StringConstants.Count; i++) // { // var str = Constants.StringConstants[i]; // var len = Constants.StringConstantLengths[i]; // } LLVMSharp.LLVM.DumpModule(moduleRef); return(""); }