/// <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); } }