Files
mercury/compiler/rbmm.region_analysis.m
Zoltan Somogyi 3dd0f2e03b Act on all remaining warnings about unused state vars.
compiler/add_heap_ops.m:
compiler/check_import_accessibility.m:
compiler/comp_unit_interface.m:
compiler/convert_import_use.m:
compiler/deforest.m:
compiler/dep_par_conj.m:
compiler/distance_granularity.m:
compiler/equiv_type.m:
compiler/generate_dep_d_files.m:
compiler/generate_mmakefile_fragments.m:
compiler/get_dependencies.m:
compiler/grab_modules.m:
compiler/higher_order.specialize_unify_compare.m:
compiler/jumpopt.m:
compiler/layout_out.m:
compiler/lco.m:
compiler/live_vars.m:
compiler/liveness.m:
compiler/llds_out_file.m:
compiler/make.build.m:
compiler/make.get_module_dep_info.m:
compiler/make.library_install.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.track_flags.m:
compiler/make_hlds_passes.m:
compiler/make_module_file_names.m:
compiler/mercury_compile_front_end.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_main.m:
compiler/mercury_compile_middle_passes.m:
compiler/ml_call_gen.m:
compiler/ml_closure_gen.m:
compiler/ml_code_gen.m:
compiler/ml_code_util.m:
compiler/ml_disj_gen.m:
compiler/ml_elim_nested.m:
compiler/ml_foreign_proc_gen.m:
compiler/ml_lookup_switch.m:
compiler/ml_switch_gen.m:
compiler/ml_unify_gen_deconstruct.m:
compiler/ml_unify_gen_test.m:
compiler/mlds_to_c_file.m:
compiler/mlds_to_target_util.m:
compiler/module_cmds.m:
compiler/opt_deps_spec.m:
compiler/optimize.m:
compiler/parse_dcg_goal.m:
compiler/parse_goal.m:
compiler/parse_item.m:
compiler/parse_module.m:
compiler/parse_string_format.m:
compiler/proc_gen.m:
compiler/prop_mode_constraints.m:
compiler/rbmm.points_to_analysis.m:
compiler/rbmm.region_analysis.m:
compiler/rbmm.region_transformation.m:
compiler/simplify_goal_disj.m:
compiler/ssdebug.m:
compiler/stack_opt.m:
compiler/string_switch.m:
compiler/switch_gen.m:
compiler/term_constr_build.m:
compiler/trace_gen.m:
compiler/tupling.m:
compiler/untupling.m:
compiler/write_deps_file.m:
deep_profiler/autopar_calc_overlap.m:
deep_profiler/autopar_find_best_par.m:
deep_profiler/html_format.m:
deep_profiler/startup.m:
profiler/mercury_profile.m:
profiler/propagate.m:
    Act on the new warnings. In a few cases, conform to the changes
    resulting from acting on the warnings in other modules.

browser/Mercury.options:
compiler/Mercury.options:
library/Mercury.options:
mdbcomp/Mercury.options:
ssdb/Mercury.options:
    Specify options for disabling the new warnings for modules
    where we (probably) won't want them.

configure.ac:
    Require the installed compiler to understand the options that
    we now reference in the Mercury.options files above.

tests/debugger/tailrec1.exp:
    Expect variable names for the middle versions of state vars
    using the new naming scheme.

tests/invalid/Mercury.options:
    Fix references to obsolete test names.

tests/warnings/Mercury.options:
    Avoid a test failure with intermodule optimization.
2025-05-19 00:33:06 +10:00

114 lines
5.5 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ft=mercury ts=4 sw=4 et
%---------------------------------------------------------------------------%
% Copyright (C) 2007, 2009-2010 The University of Melbourne.
% This file may only be copied under the terms of the GNU General
% Public License - see the file COPYING in the Mercury distribution.
%---------------------------------------------------------------------------%
%
% File: rbmm.analysis.m.
% Main author: quan.
%
% This is the main file for the region-based memory management package.
%
%---------------------------------------------------------------------------%
:- module transform_hlds.rbmm.region_analysis.
:- interface.
:- import_module hlds.
:- import_module hlds.hlds_module.
:- pred do_region_analysis(module_info::in, module_info::out) is det.
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
:- implementation.
:- import_module transform_hlds.rbmm.add_rbmm_goal_infos.
:- import_module transform_hlds.rbmm.condition_renaming.
:- import_module transform_hlds.rbmm.execution_path.
:- import_module transform_hlds.rbmm.interproc_region_lifetime.
:- import_module transform_hlds.rbmm.live_region_analysis.
:- import_module transform_hlds.rbmm.live_variable_analysis.
:- import_module transform_hlds.rbmm.points_to_analysis.
:- import_module transform_hlds.rbmm.region_arguments.
:- import_module transform_hlds.rbmm.region_instruction.
:- import_module transform_hlds.rbmm.region_resurrection_renaming.
:- import_module transform_hlds.rbmm.region_transformation.
:- import_module map.
%---------------------------------------------------------------------------%
do_region_analysis(!ModuleInfo) :-
region_points_to_analysis(!.ModuleInfo, RptaInfoTable),
execution_path_analysis(!.ModuleInfo, ExecPathTable),
live_variable_analysis(!.ModuleInfo, ExecPathTable, LVBeforeTable,
LVAfterTable, VoidVarTable),
live_region_analysis(!.ModuleInfo, RptaInfoTable,
LVBeforeTable, LVAfterTable, VoidVarTable, LRBeforeTable0,
LRAfterTable0, VoidVarRegionTable0, InputRTable, OutputRTable,
BornRTable0, DeadRTable0, LocalRTable0),
compute_interproc_region_lifetime(!.ModuleInfo, RptaInfoTable,
ExecPathTable, LRBeforeTable0, LRAfterTable0, InputRTable,
OutputRTable, ConstantRTable0, BornRTable0, BornRTable1,
DeadRTable0, DeadRTable1),
ignore_primitive_regions(!.ModuleInfo, RptaInfoTable,
BornRTable1, BornRTable, DeadRTable1, DeadRTable,
ConstantRTable0, ConstantRTable, LocalRTable0, LocalRTable,
LRBeforeTable0, LRBeforeTable, LRAfterTable0, LRAfterTable,
VoidVarRegionTable0, VoidVarRegionTable),
introduce_region_instructions(!.ModuleInfo, RptaInfoTable,
ExecPathTable, LRBeforeTable, LRAfterTable, VoidVarRegionTable,
BornRTable, DeadRTable, LocalRTable,
BecomeLiveTable, BecomeDeadBeforeTable, BecomeDeadAfterTable,
RegionInstructionTable),
record_region_arguments(!.ModuleInfo, RptaInfoTable,
ConstantRTable, DeadRTable, BornRTable, FormalRegionArgTable,
ActualRegionArgTable),
% The region analysis treats region variables as if they are
% imperative-style updatable variables. They may also have scopes
% which are not valid in Mercury. In order for Mercury code to
% manipulate regions, we need to map these "region variables"
% on to Mercury variables.
% The calls below derive the necessary mapping to resolve the problem.
compute_resurrection_paths(ExecPathTable, LRBeforeTable, LRAfterTable,
BornRTable, DeadRTable, LocalRTable,
BecomeLiveTable, BecomeDeadBeforeTable, BecomeDeadAfterTable,
ResurrectionPathTable0),
collect_join_points(ResurrectionPathTable0, ExecPathTable,
JoinPointTable),
collect_paths_containing_join_points(ExecPathTable, JoinPointTable,
ResurrectionPathTable0, ResurrectionPathTable),
collect_region_resurrection_renaming(BecomeLiveTable, LocalRTable,
RptaInfoTable, ResurrectionPathTable, ResurrectionRenameTable),
collect_renaming_and_annotation(ResurrectionRenameTable, JoinPointTable,
LRBeforeTable, LRAfterTable, BornRTable, RptaInfoTable,
ResurrectionPathTable, ExecPathTable, ResurRenamingAnnoTable,
ResurRenamingTable),
collect_non_local_and_in_cond_regions(!.ModuleInfo, RptaInfoTable,
LRBeforeTable, LRAfterTable, ResurRenamingTable,
ResurRenamingAnnoTable, LocalRegionsTable, InCondRegionsTable),
collect_ite_renamed_regions(LocalRegionsTable, InCondRegionsTable,
RenamedRegionsTable),
collect_ite_renaming(!.ModuleInfo, RptaInfoTable, RenamedRegionsTable,
IteRenamingTable0),
collect_ite_annotation(RenamedRegionsTable, ExecPathTable,
RptaInfoTable, IteRenamingTable0, IteRenamingTable,
IteRenamingAnnoTable),
region_transform(RptaInfoTable, FormalRegionArgTable,
ActualRegionArgTable, ResurRenamingTable,
IteRenamingTable, RegionInstructionTable, ResurRenamingAnnoTable,
IteRenamingAnnoTable, map.init, NameToVarTable, !ModuleInfo),
collect_rbmm_goal_info(RptaInfoTable, ActualRegionArgTable,
ResurRenamingTable, IteRenamingTable, NameToVarTable, !ModuleInfo).
%---------------------------------------------------------------------------%
:- end_module transform_hlds.rbmm.region_analysis.
%---------------------------------------------------------------------------%