mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-16 06:14:59 +00:00
Estimated hours taken: 12 Branches: main Split up three big compiler modules: llds_out.m, hlds_out.m (5000+ lines each) and deep_profiling.m (3000+ lines). Put the predicates in the resulting smaller modules into cohesive groups where possible. A few of the predicates in the original modules were unused; this diff deletes them. There are no algorithmic changes. compiler/llds_out_code_addr.m: New module containing the part of llds_out.m that outputs code addresses and labels. compiler/llds_out_data.m: New module containing the part of llds_out.m that outputs lvals, rvals and their components. compiler/llds_out_global.m: New module containing the part of llds_out.m that generates global static C data structures. compiler/llds_out_instr.m: New module containing the part of llds_out.m that outputs instructions compiler/llds_out_file.m: New module containing the top level part of llds_out.m, which coordinates the generation of a whole C source file. compiler/llds_out_util.m: New module containing the utility parts of llds_out.m. compiler/llds_out.m: Replace everything in this file with just the includes of the submodules that now have all its previous contents. compiler/hlds_llds.m: Move a predicate here from llds_out.m, since it is a utility predicate operating on a type defined here. compiler/rtti_out.m: Move a predicate here from llds_out.m, since it is a predicate generating output from a rtti type. compiler/hlds_out_mode.m: The part of hlds_out.m that deals with writing out insts and modes. compiler/hlds_out_goal.m: The part of hlds_out.m that deals with writing out goals. compiler/hlds_out_pred.m: The part of hlds_out.m that deals with writing out predicates and procedures. compiler/hlds_out_module.m: The part of hlds_out.m that deals with writing out module-wide tables. compiler/hlds_out_util.m: Parts of hlds_out.m that don't fit in anywhere else. compiler/hlds_out.m: Replace everything in this file with just the includes of the submodules that now have all its previous contents. compiler/simplify.m: compiler/hlds_goal.m: Move some insts from simplify.m to hlds_goal.m to allow hlds_out_goal.m to use them also. compiler/coverage_profiling.m: The part of deep_profiling.m that deals with coverage profiling. compiler/deep_profiling.m: Remove the code moved to coverage_profiling.m, and export the utility predicates needed by coverage_profiling.m. Remove the things moved to prog_data.m and hlds_goal.m. Put the predicates into a more logical order. compiler/hlds_goal.m: Move some predicates here from deep_profiling.m, since they belong here. compiler/prog_data.m: Move a type from deep_profiling.m here, since it belongs here. compiler/add_pragma.m: Add a predicate from llds_out.m that is used only here. compiler/*.m: Conform to the changes above.
113 lines
3.5 KiB
Mathematica
113 lines
3.5 KiB
Mathematica
%-----------------------------------------------------------------------------%
|
|
% vim: ft=mercury ts=4 sw=4 et
|
|
%-----------------------------------------------------------------------------%
|
|
% Copyright (C) 2002,2003-2008 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.
|
|
%-----------------------------------------------------------------------------%
|
|
%
|
|
% This package contains the low-level back-end
|
|
% (a.k.a. the LLDS back-end).
|
|
%
|
|
:- module ll_backend.
|
|
:- interface.
|
|
|
|
:- import_module hlds.
|
|
:- import_module mdbcomp.
|
|
:- import_module parse_tree.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
% Pre-passes to transform or annotate the HLDS.
|
|
:- include_module deep_profiling. % transform
|
|
:- include_module coverage_profiling. % transform
|
|
:- include_module saved_vars. % transform
|
|
:- include_module stack_opt. % transform
|
|
:- include_module follow_code. % transform
|
|
:- include_module liveness. % annotate
|
|
:- include_module stack_alloc. % annotate
|
|
:- include_module live_vars. % annotate
|
|
:- include_module follow_vars. % annotate
|
|
:- include_module store_alloc. % annotate
|
|
|
|
% The LLDS data structure itself.
|
|
:- include_module llds.
|
|
:- include_module code_util.
|
|
|
|
% The HLDS->LLDS code generator.
|
|
:- include_module proc_gen.
|
|
:- include_module code_gen.
|
|
:- include_module ite_gen.
|
|
:- include_module call_gen.
|
|
:- include_module disj_gen.
|
|
:- include_module unify_gen.
|
|
:- include_module commit_gen.
|
|
:- include_module switch_gen.
|
|
:- include_module dense_switch.
|
|
:- include_module lookup_switch.
|
|
:- include_module string_switch.
|
|
:- include_module tag_switch.
|
|
:- include_module switch_case.
|
|
:- include_module pragma_c_gen.
|
|
:- include_module par_conj_gen.
|
|
:- include_module middle_rec.
|
|
:- include_module trace_gen.
|
|
|
|
:- include_module code_info.
|
|
:- include_module lookup_util.
|
|
:- include_module exprn_aux.
|
|
:- include_module continuation_info.
|
|
:- include_module var_locn.
|
|
|
|
% An alternative HLDS->LLDS code generator for fact tables.
|
|
:- include_module fact_table.
|
|
|
|
%:- module llds_data.
|
|
:- include_module ll_pseudo_type_info.
|
|
:- include_module layout.
|
|
:- include_module stack_layout.
|
|
:- include_module prog_rep.
|
|
:- include_module global_data.
|
|
%:- end_module llds_data.
|
|
|
|
% LLDS->LLDS optimization passes.
|
|
:- include_module optimize.
|
|
:- include_module jumpopt.
|
|
:- include_module dupelim.
|
|
:- include_module dupproc.
|
|
:- include_module frameopt.
|
|
:- include_module delay_slot.
|
|
:- include_module labelopt.
|
|
:- include_module stdlabel.
|
|
:- include_module peephole.
|
|
:- include_module use_local_vars.
|
|
:- include_module wrap_blocks.
|
|
:- include_module livemap.
|
|
:- include_module reassign.
|
|
:- include_module basic_block.
|
|
:- include_module opt_util.
|
|
:- include_module opt_debug.
|
|
|
|
% The LLDS->C output phase.
|
|
:- include_module transform_llds.
|
|
:- include_module llds_out.
|
|
:- include_module layout_out.
|
|
:- include_module rtti_out.
|
|
|
|
% The LLDS->x86_64 asm phase.
|
|
:- include_module llds_to_x86_64.
|
|
:- include_module llds_to_x86_64_out.
|
|
:- include_module x86_64_instrs.
|
|
:- include_module x86_64_out.
|
|
:- include_module x86_64_regs.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module check_hlds. % needed for type_util, mode_util etc
|
|
:- import_module backend_libs.
|
|
:- import_module libs.
|
|
|
|
:- end_module ll_backend.
|
|
|
|
%-----------------------------------------------------------------------------%
|