diff --git a/compiler/add_heap_ops.m b/compiler/add_heap_ops.m index 27074ecf5..3c14d20c4 100644 --- a/compiler/add_heap_ops.m +++ b/compiler/add_heap_ops.m @@ -366,9 +366,10 @@ new_var(Name, Type, Var, !Info) :- heap_generate_call(Info, PredName, ArgVars, InstMapDelta, Detism, Purity, Context, CallGoal) :- ModuleInfo = Info ^ heap_module_info, - generate_simple_call(ModuleInfo, mercury_private_builtin_module, - PredName, pf_predicate, only_mode, Detism, Purity, [], ArgVars, [], - InstMapDelta, Context, CallGoal). + generate_plain_call(ModuleInfo, pf_predicate, + mercury_private_builtin_module, PredName, + [], ArgVars, InstMapDelta, only_mode, + Detism, Purity, [], Context, CallGoal). %-----------------------------------------------------------------------------% :- end_module ml_backend.add_heap_ops. diff --git a/compiler/add_trail_ops.m b/compiler/add_trail_ops.m index cfc3a4ca5..e70e1eef5 100644 --- a/compiler/add_trail_ops.m +++ b/compiler/add_trail_ops.m @@ -446,7 +446,7 @@ gen_store_ticket(TicketVar, Context, SaveTicketGoal, Info) :- yes(foreign_arg_name_mode("Ticket", out_mode)), ticket_type, bp_native_if_possible), ForeignCode = "MR_store_ticket(Ticket);", - trail_generate_foreign_proc(Info, "store_ticket", [Arg1], + trail_generate_call_foreign_proc(Info, "store_ticket", [Arg1], instmap_delta_bind_var(TicketVar), purity_impure, Context, ForeignCode, SaveTicketGoal) ). @@ -467,7 +467,7 @@ gen_reset_ticket_undo(TicketVar, Context, ResetTicketGoal, Info) :- yes(foreign_arg_name_mode("Ticket", in_mode)), ticket_type, bp_native_if_possible), ForeignCode = "MR_reset_ticket(Ticket, MR_undo);", - trail_generate_foreign_proc(Info, "reset_ticket_undo", [Arg1], + trail_generate_call_foreign_proc(Info, "reset_ticket_undo", [Arg1], instmap_delta_bind_no_var, purity_impure, Context, ForeignCode, ResetTicketGoal) ). @@ -488,7 +488,7 @@ gen_reset_ticket_solve(TicketVar, Context, ResetTicketGoal, Info) :- yes(foreign_arg_name_mode("Ticket", in_mode)), ticket_type, bp_native_if_possible), ForeignCode = "MR_reset_ticket(Ticket, MR_solve);", - trail_generate_foreign_proc(Info, "reset_ticket_solve", [Arg1], + trail_generate_call_foreign_proc(Info, "reset_ticket_solve", [Arg1], instmap_delta_bind_no_var, purity_impure, Context, ForeignCode, ResetTicketGoal) ). @@ -509,7 +509,7 @@ gen_reset_ticket_commit(TicketVar, Context, ResetTicketGoal, Info) :- yes(foreign_arg_name_mode("Ticket", in_mode)), ticket_type, bp_native_if_possible), ForeignCode = "MR_reset_ticket(Ticket, MR_commit);", - trail_generate_foreign_proc(Info, "reset_ticket_commit", [Arg1], + trail_generate_call_foreign_proc(Info, "reset_ticket_commit", [Arg1], instmap_delta_bind_no_var, purity_impure, Context, ForeignCode, ResetTicketGoal) ). @@ -527,7 +527,7 @@ gen_prune_ticket(Context, PruneTicketGoal, Info) :- ; GenerateInline = gen_trail_ops_inline, ForeignCode = "MR_prune_ticket();", - trail_generate_foreign_proc(Info, "prune_ticket", [], + trail_generate_call_foreign_proc(Info, "prune_ticket", [], instmap_delta_bind_no_var, purity_impure, Context, ForeignCode, PruneTicketGoal) ). @@ -545,7 +545,7 @@ gen_discard_ticket(Context, DiscardTicketGoal, Info) :- ; GenerateInline = gen_trail_ops_inline, ForeignCode = "MR_discard_ticket();", - trail_generate_foreign_proc(Info, "discard_ticket", [], + trail_generate_call_foreign_proc(Info, "discard_ticket", [], instmap_delta_bind_no_var, purity_impure, Context, ForeignCode, DiscardTicketGoal) ). @@ -567,7 +567,7 @@ gen_mark_ticket_stack(SavedTicketCounterVar, Context, MarkTicketStackGoal, yes(foreign_arg_name_mode("TicketCounter", out_mode)), ticket_counter_type, bp_native_if_possible), ForeignCode = "MR_mark_ticket_stack(TicketCounter);", - trail_generate_foreign_proc(Info, "mark_ticket_stack", [Arg1], + trail_generate_call_foreign_proc(Info, "mark_ticket_stack", [Arg1], instmap_delta_bind_no_var, purity_impure, Context, ForeignCode, MarkTicketStackGoal) ). @@ -589,7 +589,7 @@ gen_prune_tickets_to(SavedTicketCounterVar, Context, PruneTicketsToGoal, yes(foreign_arg_name_mode("TicketCounter", in_mode)), ticket_counter_type, bp_native_if_possible), ForeignCode = "MR_prune_tickets_to(TicketCounter);", - trail_generate_foreign_proc(Info, "prune_tickets_to", [Arg1], + trail_generate_call_foreign_proc(Info, "prune_tickets_to", [Arg1], instmap_delta_bind_no_var, purity_impure, Context, ForeignCode, PruneTicketsToGoal) ). @@ -638,17 +638,17 @@ ticket_counter_type = c_pointer_type. trail_generate_call(Info, PredName, ArgVars, InstMapDelta, Detism, Purity, Context, CallGoal) :- ModuleInfo = Info ^ trail_module_info, - generate_simple_call(ModuleInfo, mercury_private_builtin_module, - PredName, pf_predicate, only_mode, Detism, Purity, [], ArgVars, [], - InstMapDelta, Context, CallGoal). + generate_plain_call(ModuleInfo, pf_predicate, + mercury_private_builtin_module, PredName, [], ArgVars, InstMapDelta, + only_mode, Detism, Purity, [], Context, CallGoal). %-----------------------------------------------------------------------------% -:- pred trail_generate_foreign_proc(trail_ops_info::in, string::in, +:- pred trail_generate_call_foreign_proc(trail_ops_info::in, string::in, list(foreign_arg)::in, instmap_delta::in, purity::in, term.context::in, string::in, hlds_goal::out) is det. -trail_generate_foreign_proc(Info, PredName, Args, InstMapDelta, +trail_generate_call_foreign_proc(Info, PredName, Args, InstMapDelta, Purity, Context, ForeignCode, ForeignProcGoal) :- ModuleInfo = Info ^ trail_module_info, PrivateBuiltinModule = mercury_private_builtin_module, @@ -662,10 +662,10 @@ trail_generate_foreign_proc(Info, PredName, Args, InstMapDelta, ), ExtraArgs = [], MaybeTraceRuntimeCond = no, - goal_util.generate_foreign_proc(ModuleInfo, PrivateBuiltinModule, PredName, - pf_predicate, only_mode, Detism, Purity, FinalForeignProcAttrs, - [], Args, ExtraArgs, MaybeTraceRuntimeCond, ForeignCode, [], - InstMapDelta, Context, ForeignProcGoal). + generate_call_foreign_proc(ModuleInfo, pf_predicate, + PrivateBuiltinModule, PredName, [], Args, ExtraArgs, InstMapDelta, + only_mode, Detism, Purity, [], FinalForeignProcAttrs, + MaybeTraceRuntimeCond, ForeignCode, Context, ForeignProcGoal). %-----------------------------------------------------------------------------% :- end_module ml_backend.add_trail_ops. diff --git a/compiler/code_gen.m b/compiler/code_gen.m index 36d74c24f..254e31718 100644 --- a/compiler/code_gen.m +++ b/compiler/code_gen.m @@ -313,7 +313,7 @@ generate_goal_expr(GoalExpr, GoalInfo, CodeModel, ForwardLiveVarsBeforeGoal, Lang = get_foreign_language(Attributes), ( Lang = lang_c, - generate_foreign_proc_code(CodeModel, Attributes, + generate_code_for_foreign_proc(CodeModel, Attributes, PredId, ProcId, Args, ExtraArgs, MaybeTraceRuntimeCond, PragmaCode, GoalInfo, Code, !CI, !CLD) ; diff --git a/compiler/complexity.m b/compiler/complexity.m index 5b3b1c9d5..8a10b0021 100644 --- a/compiler/complexity.m +++ b/compiler/complexity.m @@ -307,28 +307,28 @@ complexity_process_proc(NumProcs, ProcNum, FullName, PredId, int_to_string(NumProfiledVars) ++ ", " ++ IsActiveVarName ++ ");\n", - complexity_generate_foreign_proc(IsActivePred, detism_det, + complexity_generate_call_foreign_proc(IsActivePred, detism_det, [IsActiveOutputArg], [], IsActiveStr, [IsActiveVar], !.ModuleInfo, Context, IsActiveGoal), ExitPred = "complexity_exit_proc", ExitStr = "\tMR_" ++ ExitPred ++ "(" ++ ProcNumStr ++ ", " ++ slot_var_name ++ ");\n", - complexity_generate_foreign_proc(ExitPred, detism_det, + complexity_generate_call_foreign_proc(ExitPred, detism_det, [SlotInputArg], [], ExitStr, [], !.ModuleInfo, Context, ExitGoal), FailPred = "complexity_fail_proc", FailStr = "\tMR_" ++ FailPred ++ "(" ++ ProcNumStr ++ ", " ++ slot_var_name ++ ");\n", - complexity_generate_foreign_proc(FailPred, detism_failure, + complexity_generate_call_foreign_proc(FailPred, detism_failure, [SlotInputArg], [], FailStr, [], !.ModuleInfo, Context, FailGoal), RedoPred = "complexity_redo_proc", RedoStr = "\tMR_" ++ RedoPred ++ "(" ++ ProcNumStr ++ ", " ++ slot_var_name ++ ");\n", - complexity_generate_foreign_proc(RedoPred, detism_failure, + complexity_generate_call_foreign_proc(RedoPred, detism_failure, [SlotInputArg], [], RedoStr, [], !.ModuleInfo, Context, RedoGoal0), @@ -432,7 +432,7 @@ generate_slot_goals(ProcNum, NumberedVars, NumProfiledVars, Context, PredId, int_to_string(ProcNum) ++ ", " ++ SlotVarName ++ ");\n", ProcStr = "\t" ++ ProcVarName ++ " = &MR_complexity_procs[" ++ int_to_string(ProcNum) ++ "];\n", - complexity_generate_foreign_proc(PredName, detism_det, [SlotVarArg], + complexity_generate_call_foreign_proc(PredName, detism_det, [SlotVarArg], ForeignArgs, DeclCodeStr ++ PredCodeStr ++ ProcStr ++ FillCodeStr, [SlotVar], !.ModuleInfo, Context, CallGoal), list.append(PrefixGoals, [CallGoal], Goals). @@ -500,21 +500,22 @@ generate_new_var(Name, Type, !ProcInfo, Var) :- proc_info_set_varset(VarSet, !ProcInfo), proc_info_set_vartypes(VarTypes, !ProcInfo). -:- pred complexity_generate_foreign_proc(string::in, determinism::in, +:- pred complexity_generate_call_foreign_proc(string::in, determinism::in, list(foreign_arg)::in, list(foreign_arg)::in, string::in, list(prog_var)::in, module_info::in, term.context::in, hlds_goal::out) is det. -complexity_generate_foreign_proc(PredName, Detism, Args, ExtraArgs, +complexity_generate_call_foreign_proc(PredName, Detism, Args, ExtraArgs, Code, BoundVars, ModuleInfo, Context, Goal) :- BuiltinModule = mercury_term_size_prof_builtin_module, Attrs0 = default_attributes(lang_c), set_may_call_mercury(proc_will_not_call_mercury, Attrs0, Attrs), MaybeTraceRuntimeCond = no, - goal_util.generate_foreign_proc(ModuleInfo, BuiltinModule, PredName, - pf_predicate, only_mode, Detism, purity_impure, Attrs, - [], Args, ExtraArgs, MaybeTraceRuntimeCond, Code, [], - instmap_delta_bind_vars(BoundVars), Context, Goal). + generate_call_foreign_proc(ModuleInfo, pf_predicate, + BuiltinModule, PredName, + [], Args, ExtraArgs, instmap_delta_bind_vars(BoundVars), + only_mode, Detism, purity_impure, [], Attrs, + MaybeTraceRuntimeCond, Code, Context, Goal). %-----------------------------------------------------------------------------% diff --git a/compiler/dep_par_conj.m b/compiler/dep_par_conj.m index 977e45f94..c45809358 100644 --- a/compiler/dep_par_conj.m +++ b/compiler/dep_par_conj.m @@ -3136,9 +3136,9 @@ allocate_future(ModuleInfo, SharedVar, Goals, !VarSet, !VarTypes, ( ShouldInline = do_not_inline_par_builtins, ArgVars = [FutureNameVar, FutureVar], - generate_simple_call(ModuleInfo, ModuleName, PredName, pf_predicate, - only_mode, detism_det, purity_pure, [], ArgVars, Features, - InstMapDelta, Context, AllocGoal) + generate_plain_call(ModuleInfo, pf_predicate, ModuleName, PredName, + [], ArgVars, InstMapDelta, only_mode, detism_det, purity_pure, + Features, Context, AllocGoal) ; ShouldInline = inline_par_builtins, ForeignAttrs = par_builtin_foreign_proc_attributes(purity_pure, no), @@ -3152,10 +3152,10 @@ allocate_future(ModuleInfo, SharedVar, Goals, !VarSet, !VarTypes, Args = [ArgName, ArgFuture], ExtraArgs = [], Code = new_future_code, - generate_foreign_proc(ModuleInfo, ModuleName, PredName, pf_predicate, - only_mode, detism_det, purity_pure, ForeignAttrs, - [], Args, ExtraArgs, no, Code, Features, InstMapDelta, - Context, AllocGoal) + generate_call_foreign_proc(ModuleInfo, pf_predicate, + ModuleName, PredName, [], Args, ExtraArgs, InstMapDelta, + only_mode, detism_det, purity_pure, Features, ForeignAttrs, + no, Code, Context, AllocGoal) ), Goals = [SetNameGoal, AllocGoal]. @@ -3241,9 +3241,9 @@ make_wait_or_get(ModuleInfo, VarTypes, FutureVar, ConsumedVar, WaitOrGetPred, ( ShouldInline = do_not_inline_par_builtins, ArgVars = [FutureVar, ConsumedVar], - generate_simple_call(ModuleInfo, ModuleName, PredName, pf_predicate, - only_mode, detism_det, Purity, [], ArgVars, Features, - InstMapDelta, Context, WaitGoal) + generate_plain_call(ModuleInfo, pf_predicate, ModuleName, PredName, + [], ArgVars, InstMapDelta, only_mode, detism_det, Purity, + Features, Context, WaitGoal) ; ShouldInline = inline_par_builtins, ForeignAttrs = par_builtin_foreign_proc_attributes(Purity, no), @@ -3257,9 +3257,10 @@ make_wait_or_get(ModuleInfo, VarTypes, FutureVar, ConsumedVar, WaitOrGetPred, ConsumedVarType, bp_native_if_possible), Args = [Arg1, Arg2], ExtraArgs = [], - generate_foreign_proc(ModuleInfo, ModuleName, PredName, pf_predicate, - only_mode, detism_det, Purity, ForeignAttrs, [], Args, ExtraArgs, - no, Code, Features, InstMapDelta, Context, WaitGoal) + generate_call_foreign_proc(ModuleInfo, pf_predicate, + ModuleName, PredName, [], Args, ExtraArgs, InstMapDelta, only_mode, + detism_det, Purity, Features, ForeignAttrs, + no, Code, Context, WaitGoal) ). :- pred make_signal_goal(module_info::in, future_map::in, prog_var::in, @@ -3276,9 +3277,9 @@ make_signal_goal(ModuleInfo, FutureMap, ProducedVar, VarTypes, SignalGoal) :- ( ShouldInline = do_not_inline_par_builtins, ArgVars = [FutureVar, ProducedVar], - generate_simple_call(ModuleInfo, ModuleName, PredName, pf_predicate, - only_mode, detism_det, purity_impure, [], ArgVars, Features, - InstMapDelta, Context, SignalGoal) + generate_plain_call(ModuleInfo, pf_predicate, ModuleName, PredName, + [], ArgVars, InstMapDelta, only_mode, detism_det, purity_impure, + Features, Context, SignalGoal) ; ShouldInline = inline_par_builtins, ForeignAttrs = par_builtin_foreign_proc_attributes(purity_impure, @@ -3294,10 +3295,10 @@ make_signal_goal(ModuleInfo, FutureMap, ProducedVar, VarTypes, SignalGoal) :- Args = [Arg1, Arg2], ExtraArgs = [], Code = "MR_par_builtin_signal_future(Future, Value);", - generate_foreign_proc(ModuleInfo, ModuleName, PredName, pf_predicate, - only_mode, detism_det, purity_impure, ForeignAttrs, - [], Args, ExtraArgs, no, Code, Features, InstMapDelta, - Context, SignalGoal) + generate_call_foreign_proc(ModuleInfo, pf_predicate, + ModuleName, PredName, [], Args, ExtraArgs, InstMapDelta, + only_mode, detism_det, purity_impure, Features, ForeignAttrs, + no, Code, Context, SignalGoal) ). :- pred is_wait_goal(hlds_goal::in) is semidet. diff --git a/compiler/direct_arg_in_out.m b/compiler/direct_arg_in_out.m index fd00ad9c8..7f44e3e2c 100644 --- a/compiler/direct_arg_in_out.m +++ b/compiler/direct_arg_in_out.m @@ -2099,21 +2099,21 @@ maybe_add_foreign_proc_error(ModuleInfo, DirectArgProcMap, DirectArgProcInOutMap, PredProcId, !Specs) :- ( if map.search(DirectArgProcMap, PredProcId, DirectArgProc) then % The original procedure has been deleted; we want - % generate_foreign_proc_error to look up its name and context + % generate_call_foreign_proc_error to look up its name and context % in its clone. map.lookup(DirectArgProcInOutMap, PredProcId, ProcInOut), ProcInOut = direct_arg_proc_in_out(ClonePredProcId, _), - generate_foreign_proc_error(ModuleInfo, ClonePredProcId, DirectArgProc, + generate_call_foreign_proc_error(ModuleInfo, ClonePredProcId, DirectArgProc, Spec), !:Specs = [Spec | !.Specs] else true ). -:- pred generate_foreign_proc_error(module_info::in, pred_proc_id::in, +:- pred generate_call_foreign_proc_error(module_info::in, pred_proc_id::in, direct_arg_proc::in, error_spec::out) is det. -generate_foreign_proc_error(ModuleInfo, PredProcId, DirectArgProc, Spec) :- +generate_call_foreign_proc_error(ModuleInfo, PredProcId, DirectArgProc, Spec) :- StartPieces = [words("Error: a procedure implemented using a"), pragma_decl("foreign_proc"), words("declaration"), words("may not have any arguments"), diff --git a/compiler/format_call.m b/compiler/format_call.m index c1ab7fcf9..2627b80b4 100644 --- a/compiler/format_call.m +++ b/compiler/format_call.m @@ -1596,12 +1596,12 @@ replace_string_format_nonempty(ModuleInfo, HeadSpec, TailSpecs, _HeadSpecContext, !ValueVars, !VarSet, !VarTypes), make_result_var_if_needed(MaybeResultVar, ResultVar, !VarSet, !VarTypes), - generate_simple_call(ModuleInfo, mercury_string_module, "++", - pf_function, only_mode, detism_det, purity_pure, - [], [HeadSpecVar, TailSpecsVar, ResultVar], [], + generate_plain_call(ModuleInfo, pf_function, + mercury_string_module, "++", + [], [HeadSpecVar, TailSpecsVar, ResultVar], instmap_delta_from_assoc_list( [ResultVar - ground(unique, none_or_default_func)]), - Context, AppendGoal), + only_mode, detism_det, purity_pure, [], Context, AppendGoal), Goals = TailSpecsGoals ++ HeadSpecGoals ++ [AppendGoal] ). @@ -1733,10 +1733,10 @@ replace_one_io_format(ModuleInfo, Spec, MaybeStreamVar, ArgVars = [SpecVar, IOInVar, IOOutVar] ), make_di_uo_instmap_delta(IOInVar, IOOutVar, InstMapDelta), - generate_simple_call(ModuleInfo, mercury_io_module, "write_string", - pf_predicate, only_mode, detism_det, purity_pure, [], ArgVars, - [feature_do_not_warn_implicit_stream], InstMapDelta, SpecContext, - CallGoal), + generate_plain_call(ModuleInfo, pf_predicate, + mercury_io_module, "write_string", [], ArgVars, InstMapDelta, + only_mode, detism_det, purity_pure, + [feature_do_not_warn_implicit_stream], SpecContext, CallGoal), Goals = SpecGoals ++ [CallGoal]. %---------------------------------------------------------------------------% @@ -1769,11 +1769,10 @@ create_stream_string_writer_format_replacement(ModuleInfo, Specs, Context, replace_string_format(ModuleInfo, Specs, Context, no, ResultVar, StringFormatGoals, ValueVars, !VarSet, !VarTypes), make_di_uo_instmap_delta(StateInVar, StateOutVar, InstMapDelta), - generate_simple_call(ModuleInfo, mercury_stream_module, "put", - pf_predicate, only_mode, detism_det, purity_pure, + generate_plain_call(ModuleInfo, pf_predicate, mercury_stream_module, "put", [TC_InfoVarForStream], [StreamVar, ResultVar, StateInVar, StateOutVar], - [feature_do_not_warn_implicit_stream], InstMapDelta, Context, - CallGoal), + InstMapDelta, only_mode, detism_det, purity_pure, + [feature_do_not_warn_implicit_stream], Context, CallGoal), Goals = StringFormatGoals ++ [CallGoal], set_of_var.insert_list([TC_InfoVarForStream, StreamVar, @@ -1807,11 +1806,12 @@ represent_spec(ModuleInfo, Spec, MaybeResultVar, ResultVar, Goals, Context, !VarSet, !VarTypes), maybe_build_width_arg(MaybeWidth, WidthSuffix, WidthVars, WidthGoals, !VarSet, !VarTypes), - generate_simple_call(ModuleInfo, mercury_string_format_module, + generate_plain_call(ModuleInfo, pf_predicate, + mercury_string_format_module, "format_char_component" ++ WidthSuffix, - pf_predicate, only_mode, detism_det, purity_pure, - [], [FlagsVar] ++ WidthVars ++ [ValueVar, ResultVar], [], - instmap_delta_bind_var(ResultVar), Context, CallGoal), + [], [FlagsVar] ++ WidthVars ++ [ValueVar, ResultVar], + instmap_delta_bind_var(ResultVar), only_mode, + detism_det, purity_pure, [], Context, CallGoal), Goals = FlagsGoals ++ WidthGoals ++ [CallGoal] ; Spec = compiler_spec_string(Context, Flags, @@ -1844,11 +1844,12 @@ represent_spec(ModuleInfo, Spec, MaybeResultVar, ResultVar, Goals, Context, WidthGoals, !VarSet, !VarTypes), maybe_build_prec_arg(MaybePrec, PrecSuffix, PrecVars, PrecGoals, !VarSet, !VarTypes), - generate_simple_call(ModuleInfo, mercury_string_format_module, - "format_string_component" ++ WidthSuffix ++ PrecSuffix, - pf_predicate, only_mode, detism_det, purity_pure, [], + generate_plain_call(ModuleInfo, pf_predicate, + mercury_string_format_module, + "format_string_component" ++ WidthSuffix ++ PrecSuffix, [], [FlagsVar] ++ WidthVars ++ PrecVars ++ [ValueVar, ResultVar], - [], instmap_delta_bind_var(ResultVar), Context, CallGoal), + instmap_delta_bind_var(ResultVar), only_mode, + detism_det, purity_pure, [], Context, CallGoal), Goals = FlagsGoals ++ WidthGoals ++ PrecGoals ++ [CallGoal] ) ; @@ -1899,12 +1900,13 @@ represent_spec(ModuleInfo, Spec, MaybeResultVar, ResultVar, Goals, Context, !VarSet, !VarTypes), maybe_build_prec_arg(MaybePrec, PrecSuffix, PrecVars, PrecGoals, !VarSet, !VarTypes), - generate_simple_call(ModuleInfo, mercury_string_format_module, + generate_plain_call(ModuleInfo, pf_predicate, + mercury_string_format_module, FormatPredBase ++ WidthSuffix ++ PrecSuffix, - pf_predicate, only_mode, detism_det, purity_pure, [], [FlagsVar] ++ WidthVars ++ PrecVars ++ BaseVars ++ - [ValueVar, ResultVar], [], - instmap_delta_bind_var(ResultVar), Context, CallGoal), + [ValueVar, ResultVar], + instmap_delta_bind_var(ResultVar), only_mode, + detism_det, purity_pure, [], Context, CallGoal), Goals = ValueCastGoals ++ FlagsGoals ++ WidthGoals ++ PrecGoals ++ BaseGoals ++ [CallGoal] ; @@ -1920,12 +1922,13 @@ represent_spec(ModuleInfo, Spec, MaybeResultVar, ResultVar, Goals, Context, maybe_build_prec_arg(MaybePrec, PrecSuffix, PrecVars, PrecGoals, !VarSet, !VarTypes), build_float_kind_arg(Kind, KindVar, KindGoal, !VarSet, !VarTypes), - generate_simple_call(ModuleInfo, mercury_string_format_module, + generate_plain_call(ModuleInfo, pf_predicate, + mercury_string_format_module, "format_float_component" ++ WidthSuffix ++ PrecSuffix, - pf_predicate, only_mode, detism_det, purity_pure, [], [FlagsVar] ++ WidthVars ++ PrecVars ++ - [KindVar, ValueVar, ResultVar], [], - instmap_delta_bind_var(ResultVar), Context, CallGoal), + [KindVar, ValueVar, ResultVar], + instmap_delta_bind_var(ResultVar), only_mode, + detism_det, purity_pure, [], Context, CallGoal), Goals = FlagsGoals ++ WidthGoals ++ PrecGoals ++ [KindGoal, CallGoal] ). @@ -1948,11 +1951,12 @@ cast_int_value_var_if_needed(ModuleInfo, Context, IntSize, ), varset.new_var(ValueVar, !VarSet), add_var_type(ValueVar, int_type, !VarTypes), - generate_simple_call(ModuleInfo, mercury_string_format_module, + generate_plain_call(ModuleInfo, pf_predicate, + mercury_string_format_module, "format_cast_int" ++ Size ++ "_to_int", - pf_predicate, only_mode, detism_det, purity_pure, - [], [OrigValueVar, ValueVar], [], - instmap_delta_bind_var(ValueVar), Context, ValueCastGoal), + [], [OrigValueVar, ValueVar], + instmap_delta_bind_var(ValueVar), only_mode, + detism_det, purity_pure, [], Context, ValueCastGoal), ValueCastGoals = [ValueCastGoal] ). @@ -1975,11 +1979,12 @@ cast_uint_value_var_if_needed(ModuleInfo, Context, UIntSize, ), varset.new_var(ValueVar, !VarSet), add_var_type(ValueVar, uint_type, !VarTypes), - generate_simple_call(ModuleInfo, mercury_string_format_module, + generate_plain_call(ModuleInfo, pf_predicate, + mercury_string_format_module, "format_cast_uint" ++ Size ++ "_to_uint", - pf_predicate, only_mode, detism_det, purity_pure, - [], [OrigValueVar, ValueVar], [], - instmap_delta_bind_var(ValueVar), Context, ValueCastGoal), + [], [OrigValueVar, ValueVar], + instmap_delta_bind_var(ValueVar), only_mode, + detism_det, purity_pure, [], Context, ValueCastGoal), ValueCastGoals = [ValueCastGoal] ). diff --git a/compiler/goal_util.m b/compiler/goal_util.m index 55a216b43..92cefbe90 100644 --- a/compiler/goal_util.m +++ b/compiler/goal_util.m @@ -364,8 +364,8 @@ hlds_goal::in, hlds_goal::in, bool::out, module_info::in, module_info::out) is det. - % generate_simple_call(ModuleInfo, ModuleName, ProcName, PredOrFunc, - % ModeNo, Detism, Purity, TIArgVars, ArgVars, Features, InstMapDelta, + % generate_plain_call(ModuleInfo, PredOrFunc, ModuleName, ProcName, + % TIArgVars, ArgVars, InstMapDelta, ModeNo, Detism, Purity, Features, % Context, CallGoal): % % Generate a call to a builtin procedure (e.g. from the private_builtin @@ -377,31 +377,29 @@ % % If ModeNo = mode_no(N) then the Nth procedure is used, counting from 0. % -:- pred generate_simple_call(module_info::in, module_name::in, string::in, - pred_or_func::in, mode_no::in, determinism::in, purity::in, - list(prog_var)::in, list(prog_var)::in, list(goal_feature)::in, - instmap_delta::in, term.context::in, hlds_goal::out) is det. +:- pred generate_plain_call(module_info::in, pred_or_func::in, + module_name::in, string::in, list(prog_var)::in, list(prog_var)::in, + instmap_delta::in, mode_no::in, determinism::in, purity::in, + list(goal_feature)::in, term.context::in, hlds_goal::out) is det. - % generate_foreign_proc(ModuleInfo, ModuleName, ProcName, PredOrFunc, - % ModeNo, Detism, Purity, Attributes, TIArgs, Args, ExtraArgs, - % MaybeTraceRuntimeCond, Code, Features, InstMapDelta, Context, - % CallGoal): + % generate_call_foreign_proc(ModuleInfo, PredOrFunc, ModuleName, ProcName, + % TIArgs, Args, ExtraArgs, InstMapDelta, ModeNo, Detism, Purity, + % Features, Attributes, MaybeTraceRuntimeCond, Code, Context, CallGoal): % - % generate_foreign_proc is similar to generate_simple_call, + % generate_call_foreign_proc is similar to generate_plain_call, % but also assumes that the called predicate is defined via a % foreign_proc, that the foreign_proc's arguments are as given in % TIArgs and Args, its attributes are Attributes, and its code is Code. % As well as returning a foreign_code instead of a call, effectively - % inlining the call, generate_foreign_proc also passes ExtraArgs + % inlining the call, generate_call_foreign_proc also passes ExtraArgs % as well as TIArgs and Args. % -:- pred generate_foreign_proc(module_info::in, module_name::in, string::in, - pred_or_func::in, mode_no::in, determinism::in, purity::in, - pragma_foreign_proc_attributes::in, - list(foreign_arg)::in, list(foreign_arg)::in, list(foreign_arg)::in, - maybe(trace_expr(trace_runtime))::in, string::in, - list(goal_feature)::in, instmap_delta::in, - term.context::in, hlds_goal::out) is det. +:- pred generate_call_foreign_proc(module_info::in, pred_or_func::in, + module_name::in, string::in, list(foreign_arg)::in, list(foreign_arg)::in, + list(foreign_arg)::in, instmap_delta::in, mode_no::in, + determinism::in, purity::in, list(goal_feature)::in, + pragma_foreign_proc_attributes::in, maybe(trace_expr(trace_runtime))::in, + string::in, term.context::in, hlds_goal::out) is det. % Generate a cast goal. The input and output insts are just ground. % @@ -1985,9 +1983,9 @@ goal_depends_on_earlier_goal(LaterGoal, EarlierGoal, InstMapBeforeEarlierGoal, %-----------------------------------------------------------------------------% -generate_simple_call(ModuleInfo, ModuleName, ProcName, PredOrFunc, ModeNo, - Detism, Purity, TIArgVars, NonTIArgVars, Features, InstMapDelta0, - Context, Goal) :- +generate_plain_call(ModuleInfo, PredOrFunc, ModuleName, ProcName, + TIArgVars, NonTIArgVars, InstMapDelta0, ModeNo, Detism, Purity, + Features, Context, Goal) :- PredFormArity = arg_list_arity(NonTIArgVars), user_arity_pred_form_arity(PredOrFunc, UserArity, PredFormArity), lookup_builtin_pred_proc_id(ModuleInfo, ModuleName, ProcName, @@ -2022,9 +2020,9 @@ generate_simple_call(ModuleInfo, ModuleName, ProcName, PredOrFunc, ModeNo, list.foldl(goal_info_add_feature, Features, GoalInfo0, GoalInfo), Goal = hlds_goal(GoalExpr, GoalInfo). -generate_foreign_proc(ModuleInfo, ModuleName, ProcName, PredOrFunc, ModeNo, - Detism, Purity, Attributes, TIArgs, NonTIArgs, ExtraArgs, - MaybeTraceRuntimeCond, Code, Features, InstMapDelta0, Context, Goal) :- +generate_call_foreign_proc(ModuleInfo, PredOrFunc, ModuleName, ProcName, + TIArgs, NonTIArgs, ExtraArgs, InstMapDelta0, ModeNo, Detism, Purity, + Features, Attributes, MaybeTraceRuntimeCond, Code, Context, Goal) :- PredFormArity = arg_list_arity(NonTIArgs), user_arity_pred_form_arity(PredOrFunc, UserArity, PredFormArity), lookup_builtin_pred_proc_id(ModuleInfo, ModuleName, ProcName, diff --git a/compiler/granularity.m b/compiler/granularity.m index 642839478..9faa248ce 100644 --- a/compiler/granularity.m +++ b/compiler/granularity.m @@ -136,11 +136,11 @@ runtime_granularity_test_in_goal(Goal0, Goal, !Changed, SCC, ModuleInfo) :- !Attributes), Attributes = !.Attributes ), - generate_foreign_proc(ModuleInfo, ModuleName, ProcName, - pf_predicate, only_mode, detism_semi, purity_impure, - Attributes, [], Args, ExtraArgs, MaybeRuntimeCond, - runtime_test_code, Features, instmap_delta_bind_no_var, - Context, Cond), + generate_call_foreign_proc(ModuleInfo, pf_predicate, + ModuleName, ProcName, + [], Args, ExtraArgs, instmap_delta_bind_no_var, only_mode, + detism_semi, purity_impure, Features, Attributes, + MaybeRuntimeCond, runtime_test_code, Context, Cond), Then = hlds_goal(conj(parallel_conj, Goals), GoalInfo), Else = hlds_goal(conj(plain_conj, Goals), GoalInfo), diff --git a/compiler/lco.m b/compiler/lco.m index 327c4c2f7..6036a265d 100644 --- a/compiler/lco.m +++ b/compiler/lco.m @@ -1935,10 +1935,10 @@ make_store_goal(ModuleInfo, InstMap, GroundVar - StoreTarget, Goal, ( % Low-level data. MaybeFieldId = no, - generate_simple_call(ModuleInfo, mercury_private_builtin_module, - "store_at_ref_impure", pf_predicate, only_mode, detism_det, - purity_impure, [], [AddrVar, GroundVar], [], - instmap_delta_bind_vars([]), term.context_init, Goal) + generate_plain_call(ModuleInfo, pf_predicate, + mercury_private_builtin_module, "store_at_ref_impure", + [], [AddrVar, GroundVar], instmap_delta_bind_vars([]), only_mode, + detism_det, purity_impure, [], term.context_init, Goal) ; % High-level data. MaybeFieldId = yes(field_id(AddrVarType, ConsId, ArgNum)), diff --git a/compiler/modecheck_goal.m b/compiler/modecheck_goal.m index ea1aa5218..d49df603b 100644 --- a/compiler/modecheck_goal.m +++ b/compiler/modecheck_goal.m @@ -1159,10 +1159,10 @@ modecheck_goal_make_ground_term_unique(TermVar, SubGoal0, GoalInfo0, GoalExpr, InstMapDelta = instmap_delta_from_assoc_list([TermVar - TermVarUniqueInst]), mode_info_get_module_info(!.ModeInfo, ModuleInfo), - generate_simple_call(ModuleInfo, mercury_public_builtin_module, "copy", - pf_predicate, mode_no(1), detism_det, purity_pure, - [TypeInfoVar], [CloneVar, TermVar], [], InstMapDelta, - Context, CopyGoal), + generate_plain_call(ModuleInfo, pf_predicate, + mercury_public_builtin_module, "copy", + [TypeInfoVar], [CloneVar, TermVar], InstMapDelta, + mode_no(1), detism_det, purity_pure, [], Context, CopyGoal), mode_info_get_instmap(!.ModeInfo, InstMap2), instmap_set_var(TermVar, TermVarUniqueInst, InstMap2, InstMap), mode_info_set_instmap(InstMap, !ModeInfo), diff --git a/compiler/polymorphism_type_class_info.m b/compiler/polymorphism_type_class_info.m index 534d88415..5ddd72e71 100644 --- a/compiler/polymorphism_type_class_info.m +++ b/compiler/polymorphism_type_class_info.m @@ -320,11 +320,11 @@ make_typeclass_info_from_subclass(Constraint, Seen, SubClassConstraint, % We extract the superclass typeclass_info by inserting a call % to superclass_from_typeclass_info in private_builtin. - generate_simple_call(ModuleInfo, + generate_plain_call(ModuleInfo, pf_predicate, mercury_private_builtin_module, "superclass_from_typeclass_info", - pf_predicate, only_mode, detism_det, purity_pure, - [], [SubClassVar, IndexVar, TypeClassInfoVar], [], - instmap_delta_bind_no_var, term.context_init, SuperClassGoal), + [], [SubClassVar, IndexVar, TypeClassInfoVar], + instmap_delta_bind_no_var, only_mode, detism_det, purity_pure, [], + term.context_init, SuperClassGoal), Goals = SubClassVarGoals ++ IndexGoals ++ [SuperClassGoal], MaybeTCIConstArg = no, diff --git a/compiler/polymorphism_type_info.m b/compiler/polymorphism_type_info.m index a44cb56cf..44a685781 100644 --- a/compiler/polymorphism_type_info.m +++ b/compiler/polymorphism_type_info.m @@ -738,10 +738,11 @@ gen_extract_type_info(ModuleInfo, TypeVar, Kind, TypeClassInfoVar, Type = type_variable(TypeVar, Kind), new_type_info_var_raw(Type, type_info, TypeInfoVar, !VarSet, !VarTypes, !RttiVarMaps), - generate_simple_call(ModuleInfo, mercury_private_builtin_module, - "type_info_from_typeclass_info", pf_predicate, only_mode, detism_det, - purity_pure, [], [TypeClassInfoVar, IndexVar, TypeInfoVar], [], - instmap_delta_bind_var(TypeInfoVar), Context, CallGoal), + generate_plain_call(ModuleInfo, pf_predicate, + mercury_private_builtin_module, "type_info_from_typeclass_info", + [], [TypeClassInfoVar, IndexVar, TypeInfoVar], + instmap_delta_bind_var(TypeInfoVar), only_mode, + detism_det, purity_pure, [], Context, CallGoal), Goals = IndexGoals ++ [CallGoal]. polymorphism_extract_type_info(TypeVar, TypeClassInfoVar, Index, Context, diff --git a/compiler/pragma_c_gen.m b/compiler/pragma_c_gen.m index 065423051..eeafd719a 100644 --- a/compiler/pragma_c_gen.m +++ b/compiler/pragma_c_gen.m @@ -41,7 +41,7 @@ %---------------------------------------------------------------------------% -:- pred generate_foreign_proc_code(code_model::in, +:- pred generate_code_for_foreign_proc(code_model::in, pragma_foreign_proc_attributes::in, pred_id::in, proc_id::in, list(foreign_arg)::in, list(foreign_arg)::in, maybe(trace_expr(trace_runtime))::in, pragma_foreign_proc_impl::in, @@ -310,7 +310,7 @@ % The procedure prolog creates a nondet stack frame that includes space for % a struct that is saved across calls. Since the position of this struct in % the nondet stack frame is not known until the procedure prolog is created, -% which is *after* the call to generate_foreign_proc_code, the prolog will +% which is *after* the call to generate_code_for_foreign_proc, the prolog will % #define MR_ORDINARY_SLOTS as the number of ordinary slots in the nondet % frame. From the size of the fixed portion of the nondet stack frame, from % MR_ORDINARY_SLOTS and from the size of the save struct itself, one can @@ -367,7 +367,7 @@ %---------------------------------------------------------------------------% -generate_foreign_proc_code(CodeModel, Attributes, PredId, ProcId, +generate_code_for_foreign_proc(CodeModel, Attributes, PredId, ProcId, Args, ExtraArgs, MaybeTraceRuntimeCond, PragmaImpl, GoalInfo, Code, !CI, !CLD) :- PragmaImpl = fp_impl_ordinary(C_Code, Context), diff --git a/compiler/purity.m b/compiler/purity.m index 0e8c8b3a5..cfdc5724f 100644 --- a/compiler/purity.m +++ b/compiler/purity.m @@ -1395,16 +1395,16 @@ wrap_inner_outer_goals(Outer, Goal0 - Inner, Goal, !Info) :- ModuleInfo = !.Info ^ pi_module_info, Clobbered = ground(clobbered, none_or_default_func), Unique = ground(unique, none_or_default_func), - generate_simple_call(ModuleInfo, mercury_stm_builtin_module, - OuterToInnerPred, pf_predicate, only_mode, - detism_det, purity_pure, [], [OuterDI, InnerDI], [], + generate_plain_call(ModuleInfo, pf_predicate, + mercury_stm_builtin_module, OuterToInnerPred, + [], [OuterDI, InnerDI], instmap_delta_from_assoc_list([OuterDI - Clobbered, InnerDI - Unique]), - Context, OuterToInnerGoal), - generate_simple_call(ModuleInfo, mercury_stm_builtin_module, - InnerToOuterPred, pf_predicate, only_mode, - detism_det, purity_pure, [], [InnerUO, OuterUO], [], + only_mode, detism_det, purity_pure, [], Context, OuterToInnerGoal), + generate_plain_call(ModuleInfo, pf_predicate, + mercury_stm_builtin_module, InnerToOuterPred, + [], [InnerUO, OuterUO], instmap_delta_from_assoc_list([InnerUO - Clobbered, OuterUO - Unique]), - Context, InnerToOuterGoal), + only_mode, detism_det, purity_pure, [], Context, InnerToOuterGoal), WrapExpr = conj(plain_conj, [OuterToInnerGoal, Goal0, InnerToOuterGoal]), % After the addition of OuterToInnerGoal and InnerToOuterGoal, diff --git a/compiler/rbmm.region_transformation.m b/compiler/rbmm.region_transformation.m index 1d0d2488b..8fb704352 100644 --- a/compiler/rbmm.region_transformation.m +++ b/compiler/rbmm.region_transformation.m @@ -859,7 +859,7 @@ region_name_to_var_with_renaming(Name0, ResurRenaming, RegVar, % The region name in a region instruction is subjected to renaming due % to if-then-else and region resurrection. This predicate turns such an % instruction into a call to a suitable region builtin. - % XXX Call to generate_simple_call here seems to be an overkill because we + % XXX Call to generate_plain_call here seems to be an overkill because we % will recompute nonlocals, instmap delta anyway. % :- pred region_instruction_to_conj(module_info::in, term.context::in, @@ -874,18 +874,18 @@ region_instruction_to_conj(ModuleInfo, Context, ResurRenaming, IteRenaming, RegionInstruction = create_region(RegionName), region_name_to_var_with_both_renamings(RegionName, ResurRenaming, IteRenaming, RegionVar, !NameToVar, !VarSet, !VarTypes), - generate_simple_call(ModuleInfo, mercury_region_builtin_module, - create_region_pred_name, pf_predicate, only_mode, detism_det, - purity_impure, [], [RegionVar], [], instmap_delta_bind_no_var, - Context, CallGoal) + generate_plain_call(ModuleInfo, pf_predicate, + mercury_region_builtin_module, create_region_pred_name, + [], [RegionVar], instmap_delta_bind_no_var, only_mode, + detism_det, purity_impure, [], Context, CallGoal) ; RegionInstruction = remove_region(RegionName), region_name_to_var_with_both_renamings(RegionName, ResurRenaming, IteRenaming, RegionVar, !NameToVar, !VarSet, !VarTypes), - generate_simple_call(ModuleInfo, mercury_region_builtin_module, - remove_region_pred_name, pf_predicate, only_mode, detism_det, - purity_impure, [], [RegionVar], [], instmap_delta_bind_no_var, - Context, CallGoal) + generate_plain_call(ModuleInfo, pf_predicate, + mercury_region_builtin_module, remove_region_pred_name, + [], [RegionVar], instmap_delta_bind_no_var, only_mode, + detism_det, purity_impure, [], Context, CallGoal) ; RegionInstruction = rename_region(_, _), unexpected($pred, "neither create nor remove instruction") @@ -908,19 +908,19 @@ region_instruction_to_conj_before(ModuleInfo, Context, ResurRenaming, RegionInstruction = create_region(RegionName), region_name_to_var_with_both_renamings(RegionName, ResurRenaming, IteRenaming, RegionVar, !NameToVar, !VarSet, !VarTypes), - generate_simple_call(ModuleInfo, mercury_region_builtin_module, - create_region_pred_name, pf_predicate, only_mode, detism_det, - purity_impure, [], [RegionVar], [], instmap_delta_bind_no_var, - Context, CallGoal) + generate_plain_call(ModuleInfo, pf_predicate, + mercury_region_builtin_module, create_region_pred_name, + [], [RegionVar], instmap_delta_bind_no_var, only_mode, + detism_det, purity_impure, [], Context, CallGoal) ; RegionInstruction = remove_region(RegionName), region_name_to_var_with_both_renamings_before(RegionName, ResurRenaming, IteRenaming, RegionVar, !NameToVar, !VarSet, !VarTypes), - generate_simple_call(ModuleInfo, mercury_region_builtin_module, - remove_region_pred_name, pf_predicate, only_mode, detism_det, - purity_impure, [], [RegionVar], [], instmap_delta_bind_no_var, - Context, CallGoal) + generate_plain_call(ModuleInfo, pf_predicate, + mercury_region_builtin_module, remove_region_pred_name, + [], [RegionVar], instmap_delta_bind_no_var, only_mode, + detism_det, purity_impure, [], Context, CallGoal) ; RegionInstruction = rename_region(_, _), unexpected($pred, "neither create nor remove instruction") diff --git a/compiler/simplify_goal_call.m b/compiler/simplify_goal_call.m index c78ba7e3d..aff018fe9 100644 --- a/compiler/simplify_goal_call.m +++ b/compiler/simplify_goal_call.m @@ -1091,10 +1091,9 @@ simplify_inline_builtin_inequality(TI, X, Y, Inequality, Invert, GoalInfo, Unique = ground(unique, none_or_default_func), ArgInsts = [CmpRes - Unique], BuiltinModule = mercury_public_builtin_module, - generate_simple_call(ModuleInfo, BuiltinModule, "compare", - pf_predicate, mode_no(ModeNo), detism_det, purity_pure, - [TI], ArgVars, [], instmap_delta_from_assoc_list(ArgInsts), - Context, CmpGoal0), + generate_plain_call(ModuleInfo, pf_predicate, BuiltinModule, "compare", + [TI], ArgVars, instmap_delta_from_assoc_list(ArgInsts), + mode_no(ModeNo), detism_det, purity_pure, [], Context, CmpGoal0), CmpGoal0 = hlds_goal(CmpExpr, CmpInfo0), CmpNonLocals0 = goal_info_get_nonlocals(CmpInfo0), set_of_var.insert(CmpRes, CmpNonLocals0, CmpNonLocals), @@ -1162,14 +1161,14 @@ simplify_improve_builtin_compare(_ModeNum, Args, Context, % to determine the final outcome in almost 50% of cases, it would % let us avoid the cost of the second test *much* more frequently. - generate_simple_call(ModuleInfo, + generate_plain_call(ModuleInfo, pf_predicate, mercury_private_builtin_module, "builtin_compound_eq", - pf_predicate, only_mode, detism_semi, purity_pure, [], [X, Y], [], - instmap_delta_bind_no_var, Context, CmpEqGoal), - generate_simple_call(ModuleInfo, + [], [X, Y], instmap_delta_bind_no_var, only_mode, + detism_semi, purity_pure, [], Context, CmpEqGoal), + generate_plain_call(ModuleInfo, pf_predicate, mercury_private_builtin_module, "builtin_compound_lt", - pf_predicate, only_mode, detism_semi, purity_pure, [], [X, Y], [], - instmap_delta_bind_no_var, Context, CmpLtGoal), + [], [X, Y], instmap_delta_bind_no_var, only_mode, + detism_semi, purity_pure, [], Context, CmpLtGoal), Builtin = mercury_public_builtin_module, CmpRes = qualified(mercury_public_builtin_module, "comparison_result"), @@ -1558,9 +1557,10 @@ simplify_improve_arith_shift_cmp_ops(IntType, InstMap0, ModuleName, PredName, cons(ExceptionWrapperCtorSymName, 1, ExceptionTypeCtor), construct_functor(ExceptionVar, ExceptionWrapperCtorConsId, [ErrorMsgStrVar], WrapErrorMsgGoal), - generate_simple_call(ModuleInfo, mercury_exception_module, - "throw", pf_predicate, only_mode, detism_erroneous, - purity_pure, [], [ExceptionVar], [], instmap_delta_bind_no_var, + generate_plain_call(ModuleInfo, pf_predicate, + mercury_exception_module, "throw", + [], [ExceptionVar], instmap_delta_bind_no_var, only_mode, + detism_erroneous, purity_pure, [], term.dummy_context_init, ThrowGoal), goal_info_init(set_of_var.init, instmap_delta_bind_no_var, detism_erroneous, purity_pure, Context, ThrowConjGoalInfo), diff --git a/compiler/simplify_goal_scope.m b/compiler/simplify_goal_scope.m index 8c7945112..b3190c96d 100644 --- a/compiler/simplify_goal_scope.m +++ b/compiler/simplify_goal_scope.m @@ -411,10 +411,11 @@ simplify_goal_trace_goal(MaybeCompiletimeExpr, MaybeRuntimeExpr, SubGoal, EvalCode = "", Goal0 = hlds_goal(_GoalExpr0, GoalInfo0), Context = goal_info_get_context(GoalInfo0), - generate_foreign_proc(ModuleInfo, PrivateBuiltin, EvalPredName, - pf_predicate, only_mode, detism_semi, purity_semipure, - EvalAttributes, [], [], [], yes(RuntimeExpr), EvalCode, - EvalFeatures, instmap_delta_bind_no_var, Context, CondGoal), + generate_call_foreign_proc(ModuleInfo, pf_predicate, + PrivateBuiltin, EvalPredName, + [], [], [], instmap_delta_bind_no_var, only_mode, + detism_semi, purity_semipure, EvalFeatures, EvalAttributes, + yes(RuntimeExpr), EvalCode, Context, CondGoal), GoalExpr = if_then_else([], CondGoal, SubGoal, true_goal), Goal = hlds_goal(GoalExpr, GoalInfo0) ) diff --git a/compiler/simplify_goal_unify.m b/compiler/simplify_goal_unify.m index 1a1d9ddae..b2984eb73 100644 --- a/compiler/simplify_goal_unify.m +++ b/compiler/simplify_goal_unify.m @@ -165,10 +165,10 @@ process_compl_unify(XVar, YVar, UnifyMode, CanFail, _OldTypeInfoVars, % Convert higher-order unifications into calls to % builtin_unify_pred (which calls error/1). Context = goal_info_get_context(GoalInfo0), - generate_simple_call(ModuleInfo, mercury_private_builtin_module, - "builtin_unify_pred", pf_predicate, mode_no(0), detism_semi, - purity_pure, [], [XVar, YVar], [], instmap_delta_bind_no_var, - Context, hlds_goal(Call0, _)), + generate_plain_call(ModuleInfo, pf_predicate, + mercury_private_builtin_module, "builtin_unify_pred", + [], [XVar, YVar], instmap_delta_bind_no_var, mode_no(0), + detism_semi, purity_pure, [], Context, hlds_goal(Call0, _)), simplify_goal_expr(Call0, Call1, GoalInfo0, GoalInfo, NestedContext0, InstMap0, !Common, !Info), Call = hlds_goal(Call1, GoalInfo), @@ -195,10 +195,10 @@ process_compl_unify(XVar, YVar, UnifyMode, CanFail, _OldTypeInfoVars, then ExtraGoals = [], Context = goal_info_get_context(GoalInfo0), - generate_simple_call(ModuleInfo, mercury_private_builtin_module, - "builtin_compound_eq", pf_predicate, only_mode, detism_semi, - purity_pure, [], [XVar, YVar], [], instmap_delta_bind_no_var, - Context, Call) + generate_plain_call(ModuleInfo, pf_predicate, + mercury_private_builtin_module, "builtin_compound_eq", + [], [XVar, YVar], instmap_delta_bind_no_var, only_mode, + detism_semi, purity_pure, [], Context, Call) else if hlds_pred.in_in_unification_proc_id(ProcId), @@ -238,10 +238,10 @@ process_compl_unify(XVar, YVar, UnifyMode, CanFail, _OldTypeInfoVars, call_generic_unify(TypeInfoVar, XVar, YVar, ModuleInfo, _, _, GoalInfo, Call) :- Context = goal_info_get_context(GoalInfo), - generate_simple_call(ModuleInfo, mercury_public_builtin_module, "unify", - pf_predicate, mode_no(0), detism_semi, purity_pure, - [TypeInfoVar], [XVar, YVar], [], instmap_delta_bind_no_var, - Context, Call). + generate_plain_call(ModuleInfo, pf_predicate, + mercury_public_builtin_module, "unify", + [TypeInfoVar], [XVar, YVar], instmap_delta_bind_no_var, mode_no(0), + detism_semi, purity_pure, [], Context, Call). :- pred call_specific_unify(type_ctor::in, list(prog_var)::in, prog_var::in, prog_var::in, proc_id::in, diff --git a/compiler/size_prof.m b/compiler/size_prof.m index b8b7a9032..e0a4c821d 100644 --- a/compiler/size_prof.m +++ b/compiler/size_prof.m @@ -776,10 +776,10 @@ size_prof_process_cons_deconstruct(Var, Args, ArgModes, UnifyGoal, GoalExpr, % The increment_size primitive doesn't need Var's type_info, % so we make it a no_type_info_builtin. TermSizeProfBuiltin = mercury_term_size_prof_builtin_module, - generate_simple_call(!.Info ^ spi_module_info, - TermSizeProfBuiltin, "increment_size", pf_predicate, only_mode, - detism_det, purity_impure, [], [Var, SizeVar], [], - instmap_delta_bind_no_var, Context, UpdateGoal), + generate_plain_call(!.Info ^ spi_module_info, pf_predicate, + TermSizeProfBuiltin, "increment_size", + [], [Var, SizeVar], instmap_delta_bind_no_var, only_mode, + detism_det, purity_impure, [], Context, UpdateGoal), % Put UnifyGoal first in case it fails. Goals = [UnifyGoal] ++ ArgGoals ++ SizeGoals ++ [UpdateGoal], GoalExpr = conj(plain_conj, Goals) @@ -844,10 +844,11 @@ generate_size_var(SizeVar0, KnownSize, Context, SizeVar, Goals, !Info) :- !Info ^ spi_vartypes := VarTypes1, get_new_var(int_type, "FinalSizeVar", SizeVar, !Info), TermSizeProfModule = mercury_term_size_prof_builtin_module, - generate_simple_call(!.Info ^ spi_module_info, - TermSizeProfModule, "term_size_plus", pf_function, mode_no(0), - detism_det, purity_pure, [], [SizeVar0, KnownSizeVar, SizeVar], [], - instmap_delta_bind_var(SizeVar), Context, AddGoal), + generate_plain_call(!.Info ^ spi_module_info, pf_function, + TermSizeProfModule, "term_size_plus", + [], [SizeVar0, KnownSizeVar, SizeVar], + instmap_delta_bind_var(SizeVar), mode_no(0), + detism_det, purity_pure, [], Context, AddGoal), Goals = [KnownSizeGoal, AddGoal] ). @@ -906,11 +907,11 @@ make_type_info(Context, Type, TypeInfoVar, TypeInfoGoals, !Info) :- !Info ^ spi_varset := VarSet, !Info ^ spi_vartypes := VarTypes, PrivateBuiltin = mercury_private_builtin_module, - generate_simple_call(!.Info ^ spi_module_info, - PrivateBuiltin, "type_info_from_typeclass_info", pf_predicate, - only_mode, detism_det, purity_pure, - [], [TypeClassInfoVar, SlotVar, TypeInfoVar], [], - instmap_delta_bind_var(TypeInfoVar), Context, ExtractGoal), + generate_plain_call(!.Info ^ spi_module_info, pf_predicate, + PrivateBuiltin, "type_info_from_typeclass_info", + [], [TypeClassInfoVar, SlotVar, TypeInfoVar], + instmap_delta_bind_var(TypeInfoVar), only_mode, + detism_det, purity_pure, [], Context, ExtractGoal), record_type_info_var(Type, TypeInfoVar, !Info), TypeInfoGoals = [SlotGoal, ExtractGoal] ) @@ -1032,10 +1033,10 @@ make_size_goal(TypeInfoVar, Arg, Context, SizeGoal, ArgVars = [Arg, SizeVar] ), TermSizeProfBuiltin = mercury_term_size_prof_builtin_module, - generate_simple_call(!.Info ^ spi_module_info, TermSizeProfBuiltin, Pred, - pf_predicate, only_mode, detism_det, purity_pure, - [TypeInfoVar], ArgVars, [], instmap_delta_bind_var(SizeVar), - Context, SizeGoal), + generate_plain_call(!.Info ^ spi_module_info, pf_predicate, + TermSizeProfBuiltin, Pred, + [TypeInfoVar], ArgVars, instmap_delta_bind_var(SizeVar), only_mode, + detism_det, purity_pure, [], Context, SizeGoal), MaybeSizeVar = yes(SizeVar). %---------------------------------------------------------------------------% diff --git a/compiler/ssdebug.m b/compiler/ssdebug.m index adfbe019f..f7ed63666 100644 --- a/compiler/ssdebug.m +++ b/compiler/ssdebug.m @@ -506,9 +506,10 @@ insert_context_update_call(ModuleInfo, Goal0, Goal, !ProcInfo) :- ArgVars = [FileNameVar, LineNumberVar], Features = [], instmap_delta_init_reachable(InstMapDelta), - generate_simple_call(ModuleInfo, mercury_ssdb_builtin_module, - "set_context", pf_predicate, only_mode, detism_det, purity_impure, - [], ArgVars, Features, InstMapDelta, Context, SetContextGoal), + generate_plain_call(ModuleInfo, pf_predicate, + mercury_ssdb_builtin_module, "set_context", + [], ArgVars, InstMapDelta, only_mode, + detism_det, purity_impure, Features, Context, SetContextGoal), conj_list_to_goal([MakeFileName, MakeLineNumber, SetContextGoal, Goal0], GoalInfo, Goal). @@ -1217,9 +1218,10 @@ make_handle_event(HandleTypeString, ArgVars, HandleEventGoal, !ModuleInfo, SSDBModule = mercury_ssdb_builtin_module, Features = [], Context = term.context_init, - generate_simple_call(!.ModuleInfo, SSDBModule, HandleTypeString, - pf_predicate, only_mode, detism_det, purity_impure, [], ArgVars, - Features, instmap_delta_bind_no_var, Context, HandleEventGoal). + generate_plain_call(!.ModuleInfo, pf_predicate, + SSDBModule, HandleTypeString, + [], ArgVars, instmap_delta_bind_no_var, only_mode, + detism_det, purity_impure, Features, Context, HandleEventGoal). % make_proc_id_construction(ModuleInfo, PredInfo, Goals, Var, % !VarSet, !VarTypes) diff --git a/compiler/stm_expand.m b/compiler/stm_expand.m index 61516aadb..d6678fd40 100644 --- a/compiler/stm_expand.m +++ b/compiler/stm_expand.m @@ -2313,9 +2313,9 @@ create_simple_call(ModuleName, ProcName, PredOrFunc, TIArgVars, NonTIArgVars, !NewPredInfo) :- Context = !.NewPredInfo ^ new_pred_context, ModuleInfo = !.NewPredInfo ^ new_pred_module_info, - generate_simple_call(ModuleInfo, ModuleName, ProcName, PredOrFunc, Mode, - Detism, Purity, TIArgVars, NonTIArgVars, GoalFeatures, InstmapDelta, - Context, Goal). + generate_plain_call(ModuleInfo, PredOrFunc, ModuleName, ProcName, + TIArgVars, NonTIArgVars, InstmapDelta, Mode, + Detism, Purity, GoalFeatures, Context, Goal). % Creates a closure for a predicate. % diff --git a/compiler/table_gen.m b/compiler/table_gen.m index be5764aeb..6a8db1943 100644 --- a/compiler/table_gen.m +++ b/compiler/table_gen.m @@ -892,7 +892,7 @@ create_new_loop_goal(OrigGoal, Statistics, PredId, ProcId, Context = goal_info_get_context(OrigGoalInfo), ModuleInfo = !.TableInfo ^ table_module_info, - generate_simple_call_table_lookup_goal(loop_status_type, + generate_plain_call_table_lookup_goal(loop_status_type, "table_loop_setup_shortcut", "MR_tbl_loop_setup", NumberedInputVars, PredId, ProcId, Statistics, Context, !VarSet, !VarTypes, !TableInfo, TableTipVar, StatusVar, @@ -920,15 +920,15 @@ create_new_loop_goal(OrigGoal, Statistics, PredId, ProcId, MarkActiveFailCode = "\t" ++ MarkActiveFailMacroName ++ "(" ++ DebugArgStr ++ ", " ++ cur_table_node_name ++ ");\n", - table_generate_foreign_proc(ModuleInfo, MarkInactivePredName, + table_call_foreign_proc(ModuleInfo, MarkInactivePredName, [TableTipArg], [], instmap_delta_bind_no_var, detism_det, purity_impure, tabling_c_attributes_dupl, MarkInactiveCode, Context, MarkInactiveGoal), - table_generate_foreign_proc(ModuleInfo, MarkInactiveFailPredName, + table_call_foreign_proc(ModuleInfo, MarkInactiveFailPredName, [TableTipArg], [], instmap_delta_bind_no_var, detism_failure, purity_impure, tabling_c_attributes_dupl, MarkInactiveFailCode, Context, MarkInactiveFailGoal), - table_generate_foreign_proc(ModuleInfo, MarkActiveFailPredName, + table_call_foreign_proc(ModuleInfo, MarkActiveFailPredName, [TableTipArg], [], instmap_delta_bind_no_var, detism_failure, purity_impure, tabling_c_attributes_dupl, MarkActiveFailCode, Context, MarkActiveFailGoal), @@ -1172,7 +1172,7 @@ create_new_memo_goal(Detism, OrigGoal, Statistics, _MaybeSizeLimit, CodeModel = model_non, unexpected($pred, "model_non") ), - generate_simple_call_table_lookup_goal(StatusType, + generate_plain_call_table_lookup_goal(StatusType, SetupPredName, SetupMacroName, NumberedInputVars, PredId, ProcId, Statistics, Context, !VarSet, !VarTypes, !TableInfo, TableTipVar, StatusVar, LookUpGoal, Steps), @@ -1226,7 +1226,7 @@ create_new_memo_goal(Detism, OrigGoal, Statistics, _MaybeSizeLimit, DebugArgStr = get_debug_arg_string(!.TableInfo), MarkAsFailedCode = MarkAsFailedMacroName ++ "(" ++ DebugArgStr ++ ", " ++ cur_table_node_name ++ ");", - table_generate_foreign_proc(ModuleInfo, MarkAsFailedPredName, + table_call_foreign_proc(ModuleInfo, MarkAsFailedPredName, [TableTipArg], [], instmap_delta_bind_no_var, detism_failure, purity_impure, tabling_c_attributes_dupl, MarkAsFailedCode, Context, ElseGoal), @@ -1316,15 +1316,15 @@ create_new_memo_non_goal(Detism, OrigGoal, Statistics, _MaybeSizeLimit, MarkCompleteCode = MarkCompleteMacroName ++ "(" ++ DebugArgStr ++ ", " ++ RecordVarName ++ ");\n", - table_generate_foreign_proc(ModuleInfo, MarkIncompletePredName, + table_call_foreign_proc(ModuleInfo, MarkIncompletePredName, [RecordArg], [], instmap_delta_bind_no_var, detism_det, purity_impure, tabling_c_attributes_dupl, MarkIncompleteCode, Context, MarkIncompleteGoal), - table_generate_foreign_proc(ModuleInfo, MarkActivePredName, + table_call_foreign_proc(ModuleInfo, MarkActivePredName, [RecordArg], [], instmap_delta_bind_no_var, detism_failure, purity_impure, tabling_c_attributes_dupl, MarkActiveCode, Context, MarkActiveGoal), - table_generate_foreign_proc(ModuleInfo, MarkCompletePredName, + table_call_foreign_proc(ModuleInfo, MarkCompletePredName, [RecordArg], [], instmap_delta_bind_no_var, detism_failure, purity_impure, tabling_c_attributes_dupl, MarkCompleteCode, Context, MarkCompleteGoal), @@ -1498,17 +1498,17 @@ create_new_io_goal(OrigGoal, TableIoEntryKind, Unitize, TableIoStates, CounterVar), generate_new_table_var("StartVar", int_type, !VarSet, !VarTypes, StartVar), - table_generate_call(ModuleInfo, "table_io_in_range", + table_plain_call(ModuleInfo, "table_io_in_range", [TableVar, CounterVar, StartVar], instmap_delta_bind_vars([TableVar, CounterVar, StartVar]), detism_semi, purity_impure, Context, InRangeGoal), generate_new_table_var("TipVar", trie_node_type, !VarSet, !VarTypes, TipVar), - table_generate_call(ModuleInfo, "table_lookup_insert_start_int", + table_plain_call(ModuleInfo, "table_lookup_insert_start_int", [TableVar, StartVar, CounterVar, TipVar], instmap_delta_bind_var(TipVar), detism_det, purity_impure, Context, LookupGoal), - table_generate_call(ModuleInfo, "table_io_has_occurred", + table_plain_call(ModuleInfo, "table_io_has_occurred", [TipVar], instmap_delta_bind_no_var, detism_semi, purity_impure, Context, OccurredGoal), ( @@ -1579,7 +1579,7 @@ create_new_io_goal(OrigGoal, TableIoEntryKind, Unitize, TableIoStates, % table_gen_process_procs should ensure that we never get here. unexpected($pred, "one in / one out violation") ), - table_generate_call(ModuleInfo, "table_io_copy_io_state", + table_plain_call(ModuleInfo, "table_io_copy_io_state", [IoStateAssignFromVar, IoStateAssignToVar], instmap_delta_from_assoc_list([ IoStateAssignFromVar - ground(clobbered, none_or_default_func), @@ -1612,11 +1612,11 @@ create_new_io_goal(OrigGoal, TableIoEntryKind, Unitize, TableIoStates, Unitize = table_io_unitize, generate_new_table_var("SavedTraceEnabled", int_type, !VarSet, !VarTypes, SavedTraceEnabledVar), - table_generate_call(ModuleInfo, "table_io_left_bracket_unitized_goal", + table_plain_call(ModuleInfo, "table_io_left_bracket_unitized_goal", [SavedTraceEnabledVar], instmap_delta_bind_var(SavedTraceEnabledVar), detism_det, purity_impure, Context, LeftBracketGoal), - table_generate_call(ModuleInfo, "table_io_right_bracket_unitized_goal", + table_plain_call(ModuleInfo, "table_io_right_bracket_unitized_goal", [SavedTraceEnabledVar], instmap_delta_bind_no_var, detism_det, purity_impure, Context, RightBracketGoal), CallSaveAnswerGoalList = [LeftBracketGoal, NewGoal, @@ -1762,7 +1762,7 @@ create_new_mm_goal(Detism, OrigGoal, Statistics, PredId, ProcId, Context, MainGoalInfo), MainGoal = hlds_goal(MainExpr, MainGoalInfo), - table_generate_call(ModuleInfo, "table_mm_completion", + table_plain_call(ModuleInfo, "table_mm_completion", [SubgoalVar], instmap_delta_bind_no_var, detism_det, purity_impure, Context, ResumeGoal0), append_fail(ResumeGoal0, ResumeGoal), @@ -1927,7 +1927,7 @@ do_own_stack_transform(Detism, OrigGoal, Statistics, PredId, ProcId, "\t" ++ consumer_name ++ " = " ++ "MR_table_mmos_setup_consumer(" ++ generator_name ++ ", """ ++ PredName ++ """);\n", - table_generate_foreign_proc(ModuleInfo, SetupPredName, + table_call_foreign_proc(ModuleInfo, SetupPredName, [InfoArg, GeneratorPredArg, ConsumerArg], LookupForeignArgs, instmap_delta_bind_var(ConsumerVar), detism_det, purity_impure, make_generator_c_attributes, @@ -1951,7 +1951,7 @@ do_own_stack_transform(Detism, OrigGoal, Statistics, PredId, ProcId, unexpected($pred, "invalid determinism") ), % XXX consider inlining the predicate being called - table_generate_call(ModuleInfo, ConsumePredName, + table_plain_call(ModuleInfo, ConsumePredName, [ConsumerVar, AnswerBlockVar], instmap_delta_bind_var(AnswerBlockVar), Detism, purity_impure, Context, GetNextAnswerGoal), DebugArgStr = get_debug_arg_string(!.TableInfo), @@ -1962,7 +1962,7 @@ do_own_stack_transform(Detism, OrigGoal, Statistics, PredId, ProcId, yes(foreign_arg_name_mode(answer_block_name, in_mode)), answer_block_type, bp_native_if_possible), RestoreAllPredName = "table_mmos_restore_answers", - table_generate_foreign_proc(ModuleInfo, RestoreAllPredName, + table_call_foreign_proc(ModuleInfo, RestoreAllPredName, [AnswerBlockArg], RestoreArgs, instmap_delta_from_assoc_list(RestoreInstMapDeltaSrc), detism_det, purity_semipure, tabling_c_attributes_no_dupl, @@ -2041,7 +2041,7 @@ do_own_stack_create_generator(PredId, ProcId, !.PredInfo, !.ProcInfo, PickupGeneratorArg = foreign_arg(GeneratorVar, yes(foreign_arg_name_mode(generator_name, out_mode)), generator_type, bp_native_if_possible), - table_generate_foreign_proc(ModuleInfo0, "table_mmos_pickup_inputs", + table_call_foreign_proc(ModuleInfo0, "table_mmos_pickup_inputs", [PickupGeneratorArg], PickupForeignArgs, instmap_delta_from_assoc_list(PickupInstMapDeltaSrc), detism_det, purity_impure, tabling_c_attributes_no_dupl, @@ -2069,7 +2069,7 @@ do_own_stack_create_generator(PredId, ProcId, !.PredInfo, !.ProcInfo, CompletionArg = foreign_arg(GeneratorVar, yes(foreign_arg_name_mode(generator_name, in_mode)), generator_type, bp_native_if_possible), - table_generate_foreign_proc(ModuleInfo0, "table_mmos_completion", + table_call_foreign_proc(ModuleInfo0, "table_mmos_completion", [CompletionArg], [], instmap_delta_bind_no_var, detism_failure, purity_impure, tabling_c_attributes_no_dupl, CompletionCode, Context, CompletionGoal), @@ -2299,14 +2299,14 @@ generate_gen_proc_table_info(TableInfo, PredId, ProcId, TabledMethod, % Generate a goal for doing lookups in call tables for % loopcheck and memo predicates. % -:- pred generate_simple_call_table_lookup_goal(mer_type::in, +:- pred generate_plain_call_table_lookup_goal(mer_type::in, string::in, string::in, list(var_mode_pos_method)::in, pred_id::in, proc_id::in, table_attr_statistics::in, term.context::in, prog_varset::in, prog_varset::out, vartypes::in, vartypes::out, table_info::in, table_info::out, prog_var::out, prog_var::out, hlds_goal::out, list(table_step_desc)::out) is det. -generate_simple_call_table_lookup_goal(StatusType, PredName, +generate_plain_call_table_lookup_goal(StatusType, PredName, SetupMacroName, NumberedVars, PredId, ProcId, Statistics, Context, !VarSet, !VarTypes, !TableInfo, TableTipVar, StatusVar, Goal, Steps) :- generate_call_table_lookup_goals(NumberedVars, PredId, ProcId, @@ -2334,7 +2334,7 @@ generate_simple_call_table_lookup_goal(StatusType, PredName, LookupCodeStr ++ CallTableTipAssignStr ++ MainPredCodeStr, - table_generate_foreign_proc(ModuleInfo, PredName, + table_call_foreign_proc(ModuleInfo, PredName, Args, LookupForeignArgs, instmap_delta_bind_vars(BoundVars), detism_det, purity_impure, tabling_c_attributes_no_dupl, CodeStr, Context, SetupGoal0), @@ -2392,7 +2392,7 @@ generate_memo_non_call_table_lookup_goal(NumberedVars, PredId, ProcId, DebugArgStr ++ ", " ++ BackArgStr ++ ", " ++ cur_table_node_name ++ ", " ++ RecordVarName ++ ", " ++ StatusVarName ++ ");\n", - table_generate_foreign_proc(ModuleInfo, SetupPredName, + table_call_foreign_proc(ModuleInfo, SetupPredName, Args, LookupForeignArgs, instmap_delta_bind_vars(BoundVars), detism_det, purity_impure, tabling_c_attributes_no_dupl, @@ -2452,7 +2452,7 @@ generate_mm_call_table_lookup_goal(NumberedVars, PredId, ProcId, StatusVarName ++ ");\n", CodeStr = LookupDeclStr ++ LookupCodeStr ++ SetupCodeStr, ModuleInfo = !.TableInfo ^ table_module_info, - table_generate_foreign_proc(ModuleInfo, SetupPredName, + table_call_foreign_proc(ModuleInfo, SetupPredName, Args, LookupForeignArgs, instmap_delta_bind_vars(BoundVars), detism_det, purity_impure, tabling_c_attributes_no_dupl, @@ -2896,7 +2896,7 @@ generate_memo_save_goal(NumberedSaveVars, TableTipVar, BlockSize, generate_all_save_goals(NumberedSaveVars, TipVarName, BlockSize, CreateMacroName, Context, !VarSet, !VarTypes, !TableInfo, SaveArgs, SavePrefixGoals, SaveDeclCode, SaveCode), - table_generate_foreign_proc(ModuleInfo, CreatePredName, + table_call_foreign_proc(ModuleInfo, CreatePredName, [TableArg], SaveArgs, instmap_delta_bind_no_var, detism_det, purity_impure, tabling_c_attributes_dupl, SaveDeclCode ++ SaveCode, Context, SaveGoal), @@ -2907,7 +2907,7 @@ generate_memo_save_goal(NumberedSaveVars, TableTipVar, BlockSize, MarkAsSucceededMacroName = "MR_tbl_memo_mark_as_succeeded", MarkAsSucceededCode = MarkAsSucceededMacroName ++ "(" ++ DebugArgStr ++ ", " ++ cur_table_node_name ++ ");", - table_generate_foreign_proc(ModuleInfo, MarkAsSucceededPredName, + table_call_foreign_proc(ModuleInfo, MarkAsSucceededPredName, [TableArg], [], instmap_delta_bind_no_var, detism_det, purity_impure, tabling_c_attributes_dupl, MarkAsSucceededCode, Context, SaveGoal), @@ -2966,7 +2966,7 @@ generate_memo_non_save_goals(NumberedSaveVars, PredId, ProcId, DuplCheckCodeStr ++ "\tif (" ++ SuccName ++ ") {\n" ++ CreateSaveCode ++ "\t}\n" ++ AssignSuccessCodeStr, - table_generate_foreign_proc(ModuleInfo, DuplCheckPredName, + table_call_foreign_proc(ModuleInfo, DuplCheckPredName, [RecordArg], LookupForeignArgs, instmap_delta_bind_no_var, detism_semi, purity_impure, tabling_c_attributes_dupl, CodeStr, Context, DuplicateCheckSaveGoal), @@ -3023,7 +3023,7 @@ generate_mm_save_goals(NumberedSaveVars, SubgoalVar, PredId, ProcId, BlockSize, CodeStr = LookupDeclCodeStr ++ SaveDeclCode ++ GetCodeStr ++ LookupCodeStr ++ DuplCheckCodeStr ++ CondSaveStr ++ AssignSuccessCodeStr, - table_generate_foreign_proc(ModuleInfo, DuplCheckPredName, + table_call_foreign_proc(ModuleInfo, DuplCheckPredName, Args, LookupForeignArgs, instmap_delta_bind_no_var, detism_semi, purity_impure, tabling_c_attributes_dupl, CodeStr, Context, DuplicateCheckSaveGoal), @@ -3109,7 +3109,7 @@ generate_own_stack_save_return_goal(NumberedOutputVars, GeneratorVar, CodeStr = LookupSaveDeclCodeStr ++ GetCodeStr ++ LookupCodeStr ++ DuplCheckCodeStr ++ CondSaveCodeStr ++ AssignSuccessCodeStr, ModuleInfo = !.TableInfo ^ table_module_info, - table_generate_foreign_proc(ModuleInfo, DuplCheckPredName, + table_call_foreign_proc(ModuleInfo, DuplCheckPredName, Args, LookupForeignArgs, instmap_delta_bind_no_var, detism_semi, purity_impure, tabling_c_attributes_dupl, CodeStr, Context, DuplicateCheckSaveGoal), @@ -3211,7 +3211,7 @@ generate_memo_restore_goal(NumberedOutputVars, OrigInstMapDelta, TipVar, DebugArgStr ++ ", " ++ BaseVarName ++ ", " ++ answer_block_name ++ ");\n" ++ RestoreCodeStr, - table_generate_foreign_proc(ModuleInfo, GetPredName, + table_call_foreign_proc(ModuleInfo, GetPredName, Args, RestoreArgs, instmap_delta_from_assoc_list(RestoreInstMapDeltaSrc), detism_det, purity_semipure, tabling_c_attributes_dupl, @@ -3242,7 +3242,7 @@ generate_memo_non_restore_goal(Detism, NumberedOutputVars, OrigInstMapDelta, generate_new_table_var("AnswerBlock", answer_block_type, !VarSet, !VarTypes, AnswerBlockVar), ModuleInfo = TableInfo ^ table_module_info, - table_generate_call(ModuleInfo, ReturnAllAns, + table_plain_call(ModuleInfo, ReturnAllAns, [RecordVar, AnswerBlockVar], instmap_delta_bind_var(AnswerBlockVar), Detism, purity_semipure, Context, ReturnAnswerBlocksGoal), DebugArgStr = get_debug_arg_string(TableInfo), @@ -3255,7 +3255,7 @@ generate_memo_non_restore_goal(Detism, NumberedOutputVars, OrigInstMapDelta, answer_block_type, bp_native_if_possible), Args = [Arg], PredName = "table_memo_non_return_all_shortcut", - table_generate_foreign_proc(ModuleInfo, PredName, + table_call_foreign_proc(ModuleInfo, PredName, Args, RestoreArgs, instmap_delta_from_assoc_list(RestoreInstMapDeltaSrc), detism_det, purity_semipure, tabling_c_attributes_no_dupl, @@ -3317,7 +3317,7 @@ generate_mm_restore_or_suspend_goal(PredName, Detism, Purity, generate_new_table_var("AnswerBlock", answer_block_type, !VarSet, !VarTypes, AnswerBlockVar), ModuleInfo = TableInfo ^ table_module_info, - table_generate_call(ModuleInfo, PredName, + table_plain_call(ModuleInfo, PredName, [SubgoalVar, AnswerBlockVar], instmap_delta_bind_var(AnswerBlockVar), Detism, Purity, Context, ReturnAnswerBlocksGoal), DebugArgStr = get_debug_arg_string(TableInfo), @@ -3331,7 +3331,7 @@ generate_mm_restore_or_suspend_goal(PredName, Detism, Purity, answer_block_type, bp_native_if_possible), Args = [Arg], ReturnAllPredName = "table_mm_return_all_shortcut", - table_generate_foreign_proc(ModuleInfo, ReturnAllPredName, + table_call_foreign_proc(ModuleInfo, ReturnAllPredName, Args, RestoreArgs, instmap_delta_from_assoc_list(RestoreInstMapDeltaSrc), detism_det, purity_semipure, tabling_c_attributes_no_dupl, @@ -3419,14 +3419,12 @@ generate_error_goal(TableInfo, Context, Msg, !VarSet, !VarTypes, Goal) :- PredOrFunc = pred_info_is_pred_or_func(PredInfo), PredOrFuncStr = pred_or_func_to_str(PredOrFunc), NameStr = sym_name_to_string(qualified(Module, Name)), - string.int_to_string(Arity, ArityStr), - Message = Msg ++ " in " ++ PredOrFuncStr ++ " " ++ NameStr - ++ "/" ++ ArityStr, - + Message = string.format("%s in %s %s/%d", + [s(Msg), s(PredOrFuncStr), s(NameStr), i(Arity)]), make_string_const_construction_alloc(Message, yes("Message"), MessageStrGoal, MessageVar, !VarSet, !VarTypes), - table_generate_call(ModuleInfo, "table_error", + table_plain_call(ModuleInfo, "table_error", [MessageVar], instmap_delta_bind_no_var, detism_erroneous, purity_pure, Context, CallGoal), @@ -3445,11 +3443,11 @@ generate_new_table_var(Name, Type, !VarSet, !VarTypes, Var) :- varset.new_named_var(Name, Var, !VarSet), add_var_type(Var, Type, !VarTypes). -:- pred table_generate_call(module_info::in, string::in, list(prog_var)::in, +:- pred table_plain_call(module_info::in, string::in, list(prog_var)::in, instmap_delta::in, determinism::in, purity::in, term.context::in, hlds_goal::out) is det. -table_generate_call(ModuleInfo, PredName, ArgVars, InstMapDelta, +table_plain_call(ModuleInfo, PredName, ArgVars, InstMapDelta, Detism, Purity, Context, Goal) :- BuiltinModule = mercury_table_builtin_module, ( @@ -3466,17 +3464,17 @@ table_generate_call(ModuleInfo, PredName, ArgVars, InstMapDelta, else Features = Features0 ), - generate_simple_call(ModuleInfo, BuiltinModule, PredName, pf_predicate, - only_mode, Detism, Purity, [], ArgVars, Features, InstMapDelta, - Context, Goal). + generate_plain_call(ModuleInfo, pf_predicate, BuiltinModule, PredName, + [], ArgVars, InstMapDelta, only_mode, Detism, Purity, + Features, Context, Goal). -:- pred table_generate_foreign_proc(module_info::in, string::in, +:- pred table_call_foreign_proc(module_info::in, string::in, list(foreign_arg)::in, list(foreign_arg)::in, instmap_delta::in, determinism::in, purity::in, pragma_foreign_proc_attributes::in, string::in, term.context::in, hlds_goal::out) is det. -table_generate_foreign_proc(ModuleInfo, PredName, Args, ExtraArgs, - InstMapDelta, Detism, Purity, Attributes, Code, Context, Goal) :- +table_call_foreign_proc(ModuleInfo, PredName, Args, ExtraArgs, InstMapDelta, + Detism, Purity, Attributes, Code, Context, Goal) :- ( Purity = purity_pure, Features0 = [] @@ -3493,10 +3491,10 @@ table_generate_foreign_proc(ModuleInfo, PredName, Args, ExtraArgs, ), BuiltinModule = mercury_table_builtin_module, MaybeTraceRuntimCond = no, - goal_util.generate_foreign_proc( ModuleInfo,BuiltinModule, PredName, - pf_predicate, only_mode, Detism, Purity, Attributes, - [], Args, ExtraArgs, MaybeTraceRuntimCond, Code, Features, - InstMapDelta, Context, Goal). + generate_call_foreign_proc(ModuleInfo, pf_predicate, + BuiltinModule, PredName, [], Args, ExtraArgs, InstMapDelta, only_mode, + Detism, Purity, Features, Attributes, + MaybeTraceRuntimCond, Code, Context, Goal). :- pred append_fail(hlds_goal::in, hlds_goal::out) is det. diff --git a/compiler/try_expand.m b/compiler/try_expand.m index 2699d6760..9a89c5c83 100644 --- a/compiler/try_expand.m +++ b/compiler/try_expand.m @@ -885,10 +885,11 @@ make_try_call(PredName, LambdaVar, ResultVar, ExtraArgs, OutputTupleType, % The mode will be fixed up by a later analysis. Mode = mode_no(0), Features = [], - generate_simple_call(!.ModuleInfo, mercury_exception_module, PredName, - pf_predicate, Mode, detism_cc_multi, purity_pure, - [TypeInfoVar], [LambdaVar, ResultVar] ++ ExtraArgs, Features, - instmap_delta_bind_no_var, Context, CallGoal0), + generate_plain_call(!.ModuleInfo, pf_predicate, + mercury_exception_module, PredName, + [TypeInfoVar], [LambdaVar, ResultVar] ++ ExtraArgs, + instmap_delta_bind_no_var, Mode, + detism_cc_multi, purity_pure, Features, Context, CallGoal0), goal_info_init(Context, GoalInfo), @@ -911,9 +912,10 @@ make_try_call(PredName, LambdaVar, ResultVar, ExtraArgs, OutputTupleType, :- pred make_unreachable_call(module_info::in, hlds_goal::out) is det. make_unreachable_call(ModuleInfo, Goal) :- - generate_simple_call(ModuleInfo, mercury_exception_module, "unreachable", - pf_predicate, only_mode, detism_erroneous, purity_pure, - [], [], [], instmap_delta_bind_no_var, term.context_init, Goal). + generate_plain_call(ModuleInfo, pf_predicate, + mercury_exception_module, "unreachable", + [], [], instmap_delta_bind_no_var, only_mode, + detism_erroneous, purity_pure, [], term.context_init, Goal). :- pred make_output_tuple_inst_cast(prog_var::in, prog_var::in, list(mer_inst)::in, hlds_goal::out) is det. diff --git a/compiler/typecheck.m b/compiler/typecheck.m index c72615fb4..c535eb543 100644 --- a/compiler/typecheck.m +++ b/compiler/typecheck.m @@ -806,9 +806,10 @@ generate_stub_clause_2(PredName, !PredInfo, ModuleInfo, StubClause, !VarSet) :- else CalleeName = "no_clauses" ), - generate_simple_call(ModuleInfo, mercury_private_builtin_module, - CalleeName, pf_predicate, only_mode, detism_det, purity_pure, - [], [PredNameVar], [], instmap_delta_bind_no_var, Context, CallGoal), + generate_plain_call(ModuleInfo, pf_predicate, + mercury_private_builtin_module, CalleeName, + [], [PredNameVar], instmap_delta_bind_no_var, only_mode, + detism_det, purity_pure, [], Context, CallGoal), % Combine the unification and call into a conjunction. goal_info_init(Context, GoalInfo), diff --git a/compiler/unify_proc.m b/compiler/unify_proc.m index 1e6d39fd8..8199628e5 100644 --- a/compiler/unify_proc.m +++ b/compiler/unify_proc.m @@ -859,11 +859,11 @@ build_bulk_unify_foreign_proc(ModuleInfo, Ptag, TermType, TermVarX, TermVarY, WordsArgs, WordsGoals, !VarSet, !VarTypes), ForeignArgs = [TermVarArgX, TermVarArgY] ++ WordsArgs, - generate_foreign_proc(ModuleInfo, mercury_private_builtin_module, - PredName, pf_predicate, only_mode, detism_semi, - purity_pure, pure_proc_foreign_attributes, [], ForeignArgs, [], - no, ForeignCode, [], instmap_delta_bind_no_var, - Context, UnifyRemoteArgWordGoal), + generate_call_foreign_proc(ModuleInfo, pf_predicate, + mercury_private_builtin_module, PredName, + [], ForeignArgs, [], instmap_delta_bind_no_var, only_mode, + detism_semi, purity_pure, [], pure_proc_foreign_attributes, + no, ForeignCode, Context, UnifyRemoteArgWordGoal), Goals = WordsGoals ++ [UnifyRemoteArgWordGoal]. :- func pure_proc_foreign_attributes = pragma_foreign_proc_attributes. @@ -2076,12 +2076,11 @@ select_and_build_signed_comparison_foreign_proc(ModuleInfo, ArgsLocn, ForeignCode = WordsDecl ++ ValuesDecl ++ WordsCode ++ ValuesCode ++ CompareValuesCode, - generate_foreign_proc(ModuleInfo, mercury_private_builtin_module, - ComparePredName, pf_predicate, only_mode, - detism_semi, purity_pure, pure_proc_foreign_attributes, - [], ForeignArgs, [], no, ForeignCode, [], - instmap_delta_bind_var(CompareResultVar), - Context, CompareGoal), + generate_call_foreign_proc(ModuleInfo, pf_predicate, + mercury_private_builtin_module, ComparePredName, + [], ForeignArgs, [], instmap_delta_bind_var(CompareResultVar), + only_mode, detism_semi, purity_pure, [], pure_proc_foreign_attributes, + no, ForeignCode, Context, CompareGoal), CompareConjGoalExpr = conj(plain_conj, MaybeWordsGoals ++ [MakeShiftGoal, CompareGoal]), goal_info_init(Context, ContextGoalInfo), @@ -2204,12 +2203,11 @@ select_and_build_bulk_comparison_foreign_proc(ModuleInfo, ArgsLocn, ForeignCode = WordsDecl ++ ValuesDecl ++ WordsCode ++ ValuesCode ++ CompareValuesCode, - generate_foreign_proc(ModuleInfo, mercury_private_builtin_module, - ComparePredName, pf_predicate, only_mode, - detism_semi, purity_pure, pure_proc_foreign_attributes, - [], ForeignArgs, [], no, ForeignCode, [], - instmap_delta_bind_var(CompareResultVar), - Context, CompareGoal), + generate_call_foreign_proc(ModuleInfo, pf_predicate, + mercury_private_builtin_module, ComparePredName, + [], ForeignArgs, [], instmap_delta_bind_var(CompareResultVar), + only_mode, detism_semi, purity_pure, [], pure_proc_foreign_attributes, + no, ForeignCode, Context, CompareGoal), CompareConjGoalExpr = conj(plain_conj, MaybeWordsGoals ++ MaybeShiftMaskGoals ++ [CompareGoal]), goal_info_init(Context, ContextGoalInfo), @@ -2625,9 +2623,9 @@ merge_tvarsets_and_subst_type_args(TVarSet, TypeArgs, list(prog_var)::in, prog_context::in, hlds_goal::out) is det. build_simple_call(ModuleInfo, ModuleName, PredName, ArgVars, Context, Goal) :- - generate_simple_call(ModuleInfo, ModuleName, PredName, pf_predicate, - mode_no(0), detism_erroneous, purity_pure, [], ArgVars, [], - instmap_delta_bind_no_var, Context, Goal). + generate_plain_call(ModuleInfo, pf_predicate, ModuleName, PredName, + [], ArgVars, instmap_delta_bind_no_var, mode_no(0), + detism_erroneous, purity_pure, [], Context, Goal). :- pred build_spec_pred_call(type_ctor::in, special_pred_id::in, list(prog_var)::in, instmap_delta::in, determinism::in,