Files
mercury/compiler/hlds.m
Zoltan Somogyi daa4513894 Add the new compiler option --show-local-call-tree.
When specified, this option causes the compiler to output,
to <module>.local_call_tree, a flattened form of the part of the
module call tree restricted to local predicates and functions, like this:

    pred polymorphism_process_module/5
        pred maybe_polymorphism_process_pred/7
        pred polymorphism_update_arg_types/5

    pred maybe_polymorphism_process_pred/7
        pred polymorphism_process_pred_msg/7

    pred polymorphism_process_pred_msg/7
        pred polymorphism_process_pred/6

    pred polymorphism_process_pred/6
        pred polymorphism_process_clause_info/6
        pred add_extra_arg_modes_to_proc/3

This output consists of a list of entries, with each entry naming
a predicate or function, and listing all the local predicates and functions
it calls. Both the callees in a single entry and the entries themselves
are in the order in which a depth-first left-to-right traversal of the
module, starting at the exported predicates and functions, would encounter
them. That order is also output to <module>.local_call_tree_order.
This information can give useful guidance about how the contents
of a module should be ordered.

doc/user_guide.texi:
compiler/options.m:
    As above.

NEWS:
    Announce the new option.

compiler/hlds_call_tree.m:
    A new module to implement the new option.

compiler/hlds.m:
compiler/notes/compiler_design.html:
    Add and document the new module.

compiler/mercury_compile_front_end.m:
    Invoke the new module if the new option is set.

compiler/hlds_desc.m:
    Add describe_pred and describe_pred_from_id. Reimplement
    describe_proc and describe_proc_from_id in terms of those.
    Allow callers of all four to decide whether we want the descriptions
    to include the names of the defining module.

compiler/dead_proc_elim.m:
compiler/ml_proc_gen.m:
compiler/proc_gen.m:
    Conform to the change to hlds_desc.m.

compiler/hlds_goal.m:
    Document when it is ok for traversals of goals to assume that
    they won't find any rhs_lambda_goals or complicated_unifys
    in unifications.

    Change the documentation of the five classes of unifications
    (construct/deconstruct/assign/simple_test/complicated_unify)
    to refer to the LHS as X and the RHS as Y, since pretty much
    all the modules focusing on unifications (such as superhomoneous.m)
    use that naming convention. Having the opposite convention here
    was not a good idea.

compiler/prog_data.m:
    Fix comment rot.
2022-09-25 18:04:20 +10:00

98 lines
3.4 KiB
Mathematica

%-----------------------------------------------------------------------------%
% vim: ft=mercury ts=4 sw=4 et
%-----------------------------------------------------------------------------%
% Copyright (C) 2002-2010, 2012 The University of Melbourne.
% Copyright (C) 2017 The Mercury Team.
% This file may only be copied under the terms of the GNU General
% Public License - see the file COPYING in the Mercury distribution.
%-----------------------------------------------------------------------------%
%
% This package contains the HLDS data structure, together with modules
% for creating and manipulating it.
%
:- module hlds.
:- interface.
%-----------------------------------------------------------------------------%
% The HLDS data structure itself.
:- include_module assertion.
:- include_module const_struct.
:- include_module hlds_args.
:- include_module hlds_class.
:- include_module hlds_clauses.
:- include_module hlds_cons.
:- include_module hlds_data.
:- include_module hlds_goal.
:- include_module hlds_inst_mode.
:- include_module hlds_llds.
:- include_module hlds_module.
:- include_module hlds_pred.
:- include_module hlds_promise.
:- include_module hlds_rtti.
:- include_module inst_graph.
:- include_module instmap.
:- include_module pred_table.
:- include_module special_pred.
:- include_module status.
% Modules for creating the HLDS.
:- include_module add_foreign_enum.
:- include_module add_pred.
:- include_module add_special_pred.
:- include_module du_type_layout.
:- include_module default_func_mode.
:- include_module hhf.
:- include_module make_hlds.
:- include_module make_hlds_error.
:- include_module pre_quantification.
:- include_module quantification.
% A start on the infrastructure needed to transition mode analysis
% from the current abstract interpretation based system to the propagation
% based solver.
%
% Logically, the code of mode analysis belongs in the check_hlds package,
% not the hlds package. However, while goal_modes are experimental, we want
% to keep changes to their representations as cheap as possible, and
% specifically, we do not want to require recompilation of the whole compiler
% after every such change. This is possible only if the goal_mode structure
% is *not* included in hlds_goal.m, but is kept as an abstract type in
% goal_mode.m. Since hlds_goal.m should include modules only from the
% hlds package and not from the check_hlds package, this requires goal_mode.m
% to be here.
:- include_module goal_mode.
% Modules for pretty-printing it.
:- include_module hlds_desc.
:- include_module hlds_out.
% Modules for handling errors.
:- include_module hlds_error_util.
:- include_module error_msg_inst.
% Miscellaneous utilities.
:- include_module arg_info.
:- include_module code_model.
:- include_module hlds_dependency_graph.
:- include_module from_ground_term_util.
:- include_module goal_form.
:- include_module goal_path.
:- include_module goal_util.
:- include_module headvar_names.
:- include_module hlds_call_tree.
:- include_module hlds_defns.
:- include_module hlds_code_util.
:- include_module hlds_statistics.
:- include_module introduced_call_table.
:- include_module make_goal.
:- include_module mark_static_terms.
:- include_module mark_tail_calls.
:- include_module passes_aux.
:- include_module pred_name.
%-----------------------------------------------------------------------------%
:- end_module hlds.
%-----------------------------------------------------------------------------%