/// <summary> /// Creates a call instruction to the given method with the given arguments. /// </summary> /// <param name="method">The target method to invoke.</param> /// <param name="arguments">The call arguments.</param> private void CreateCall( MethodBase method, ImmutableArray <ValueReference> arguments) { var intrinsicContext = new InvocationContext( this, Location, Block, Method, method, arguments); // Check for internal remappings first RemappedIntrinsics.RemapIntrinsic(ref intrinsicContext); // Early rejection for runtime-dependent methods VerifyNotRuntimeMethod(intrinsicContext.Method); // Handle device functions if (!Intrinsics.HandleIntrinsic(intrinsicContext, out var result)) { var targetFunction = DeclareMethod(intrinsicContext.Method); result = Builder.CreateCall( Location, targetFunction, intrinsicContext.Arguments); } // Setup result if (result.IsValid && !result.Type.IsVoidType) { Block.Push(result); } }
/// <summary> /// Creates a call instruction to the given method with the given arguments. /// </summary> /// <param name="method">The target method to invoke.</param> /// <param name="arguments">The call arguments.</param> private void CreateCall( MethodBase method, ref ValueList arguments) { var intrinsicContext = new InvocationContext( this, CompilationStackLocation.Append(Location), Block, Method, method, ref arguments); // Check for internal remappings first RemappedIntrinsics.RemapIntrinsic(ref intrinsicContext); // Early rejection for runtime-dependent methods VerifyNotRuntimeMethod(intrinsicContext.Method); // Handle device functions if (!Intrinsics.HandleIntrinsic(ref intrinsicContext, out var result)) { var targetFunction = DeclareMethod(intrinsicContext.Method); result = Builder.CreateCall( Location, targetFunction, ref arguments); } // Setup result if (result.IsValid && !result.Type.IsVoidType) { var flags = method.GetReturnType().IsUnsignedInt() ? ConvertFlags.SourceUnsigned : ConvertFlags.None; Block.Push(LoadOntoEvaluationStack(result, flags)); } }