internal LLVMSharp.Module RunSemanticAnalysisUpToLLVMCodeGeneration(DfirRoot dfirRoot, string compiledFunctionName)
        {
            var cancellationToken = new CompileCancellationToken();

            RunCompilationUpToAutomaticNodeInsertion(dfirRoot, cancellationToken);
            return(FunctionCompileHandler.CompileFunctionForLLVM(dfirRoot, cancellationToken, compiledFunctionName));
        }
        internal global::Rebar.RebarTarget.BytecodeInterpreter.Function RunSemanticAnalysisUpToCodeGeneration(DfirRoot dfirRoot)
        {
            var cancellationToken = new CompileCancellationToken();

            RunCompilationUpToAutomaticNodeInsertion(dfirRoot, cancellationToken);
            return(FunctionCompileHandler.CompileFunctionForBytecodeInterpreter(dfirRoot, cancellationToken));
        }
Esempio n. 3
0
        public static LLVMValueRef GetImportedInitializeStateFunction(this FunctionModuleContext moduleContext, CreateMethodCallPromise createMethodCallPromise)
        {
            string targetFunctionName = FunctionCompileHandler.FunctionLLVMName(createMethodCallPromise.TargetName);

            return(moduleContext.GetImportedFunction(
                       FunctionNames.GetInitializeStateFunctionName(targetFunctionName),
                       () => moduleContext.TranslateInitializeFunctionType(createMethodCallPromise.Signature)));
        }
Esempio n. 4
0
        public static LLVMValueRef GetImportedSynchronousFunction(this FunctionModuleContext moduleContext, MethodCallNode methodCallNode)
        {
            string targetFunctionName = FunctionCompileHandler.FunctionLLVMName(methodCallNode.TargetName);

            return(moduleContext.GetImportedFunction(
                       FunctionNames.GetSynchronousFunctionName(targetFunctionName),
                       () => moduleContext.LLVMContext.TranslateFunctionType(methodCallNode.Signature)));
        }
Esempio n. 5
0
        internal FunctionCompileResult RunSemanticAnalysisUpToLLVMCodeGeneration(
            DfirRoot dfirRoot,
            string compiledFunctionName,
            Dictionary <CompilableDefinitionName, bool> calleesIsYielding,
            Dictionary <CompilableDefinitionName, bool> calleesMayPanic)
        {
            var cancellationToken = new CompileCancellationToken();

            RunCompilationUpToAutomaticNodeInsertion(dfirRoot, cancellationToken);
            return(FunctionCompileHandler.CompileFunctionForLLVM(dfirRoot, cancellationToken, calleesIsYielding, calleesMayPanic, compiledFunctionName));
        }
Esempio n. 6
0
        public CompileLoadResult CompileAndLoadFunction(CompilerTestBase test, DfirRoot function, DfirRoot[] otherFunctions)
        {
            var calleesIsYielding = new Dictionary <CompilableDefinitionName, bool>();
            var calleesMayPanic   = new Dictionary <CompilableDefinitionName, bool>();

            foreach (DfirRoot otherFunction in otherFunctions)
            {
                FunctionCompileResult otherCompileResult = test.RunSemanticAnalysisUpToLLVMCodeGeneration(
                    otherFunction,
                    FunctionCompileHandler.FunctionLLVMName(otherFunction.CompileSpecification.Name),
                    calleesIsYielding,
                    calleesMayPanic);
                calleesIsYielding[otherFunction.CompileSpecification.Name] = otherCompileResult.IsYielding;
                calleesMayPanic[otherFunction.CompileSpecification.Name]   = otherCompileResult.MayPanic;
                _context.LoadFunction(otherCompileResult.Module);
            }

            const string          compiledFunctionName = "test";
            FunctionCompileResult compileResult        = test.RunSemanticAnalysisUpToLLVMCodeGeneration(function, compiledFunctionName, calleesIsYielding, calleesMayPanic);

            _context.LoadFunction(compileResult.Module);
            return(new CompileLoadResult(compiledFunctionName, compileResult.IsYielding));
        }
Esempio n. 7
0
        public static LLVMValueRef GetImportedPollFunction(this FunctionModuleContext moduleContext, CreateMethodCallPromise createMethodCallPromise)
        {
            string targetFunctionName = FunctionCompileHandler.FunctionLLVMName(createMethodCallPromise.TargetName);

            return(moduleContext.GetImportedFunction(FunctionNames.GetPollFunctionName(targetFunctionName), () => AsynchronousFunctionModuleBuilder.PollFunctionType(moduleContext.LLVMContext)));
        }