/// <summary> /// Formats an error message to include the current sequence point. /// </summary> string ILocation.FormatErrorMessage(string message) { var location = compilationStackLocation != null ? compilationStackLocation.Append(CurrentLocation) : CurrentLocation; return(location.FormatErrorMessage(message)); }
/// <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)); } }