예제 #1
0
        internal LLVMSharp.Module RunSemanticAnalysisUpToLLVMCodeGeneration(DfirRoot dfirRoot, string compiledFunctionName)
        {
            var cancellationToken = new CompileCancellationToken();

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

            RunCompilationUpToAutomaticNodeInsertion(dfirRoot, cancellationToken);
            return(FunctionCompileHandler.CompileFunctionForBytecodeInterpreter(dfirRoot, cancellationToken));
        }
예제 #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)));
        }
예제 #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)));
        }
예제 #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));
        }
예제 #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));
        }
예제 #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)));
        }