Commit Graph

18 Commits

Author SHA1 Message Date
Zoltan Somogyi
5638bca5bf Fix too-long lines. 2022-11-18 20:23:11 +11:00
Zoltan Somogyi
181f49fafb Split a predicate that had two independent halves. 2022-10-11 23:31:50 +11:00
Zoltan Somogyi
0997b8ecbb Make output_quoted_X actually put quotes around X ...
... since the vast majority of callers do want to put quotes around
the X being quoted. (X being string, multi_string or char.)

compiler/c_util.m:
    Rename predicates whose names are output_quoted_X for some X
    to output_to_be_quoted_X, because while they escaped the characters in X
    if needed, they did not put quotes around the result.

    Add new predicates to take over the output_quoted_X names
    which *do* add the quotes.

    Likewise, rename quote_X functions to prepare_to_quote_X,
    and add new functions to take over the quote_X names
    that do add quotes.

compiler/llds_out_global.m:
    Conform to the changes above, and fix a bug in an earlier diff
    in this series.

compiler/bytecode.m:
compiler/fact_table.m:
compiler/layout_out.m:
compiler/llds_out_data.m:
compiler/llds_out_instr.m:
compiler/ml_foreign_proc_gen.m:
compiler/mlds_to_c_data.m:
compiler/mlds_to_c_global.m:
compiler/mlds_to_cs_data.m:
compiler/mlds_to_java_data.m:
compiler/opt_debug.m:
compiler/pragma_c_gen.m:
compiler/rtti_out.m:
    Conform to the changes above.

    Mark two places in rtti_out.m where the use of output_to_be_quoted_string
    is likely to be a bug.
2022-09-27 22:50:38 +10:00
Zoltan Somogyi
d9585a5dd7 Use separate code for C, Java and C# in c_util.m.
compiler/c_util.m:
    As above. The resulting code is significantly simpler.

compiler/mlds_to_cs_data.m:
compiler/mlds_to_java_data.m:
    Conform to the changes above.
2022-09-27 14:12:28 +10:00
Zoltan Somogyi
ea4f95a7ed Use var_tables in lco.m, and when dumping goals.
Since this is the first converted module that dumps out goals when
debugging trace flags are enabled, this required generalizing the code
that does that, to take either varsets or var_tables as a means of
specifying the names of variables. We do this via a new type,
var_name_source, which contains either a varset or a var_table.

Almost all of this diff is there to implement this generalization.
A large part of it affects code in the parse_tree package that we use
to write out the parts of HLDS goals that are defined by types defined
in that package. Since we want to avoid making any part of the parse_tree
package dependent on the hlds package, this required defining the
var_name_source type in the parse_tree package, which in turn requires
var_table.m to be in that same package.

compiler/lco.m:
    Convert this module to use var_tables instead of varsets and vartypes.

compiler/var_table.m:
    Move this module from the hlds package to the parse_tree package.

    To make this, possible, move the parts that required access to the HLDS
    to hlds_pred.m, from where it was usually invoked.

    Export some utility predicates to allow the moved code to work
    in hlds_pred.m without access to the actual definition of the
    var_table type.

    Define the var_name_source type.

    Add some utility functions for use by code writing out variable names.

compiler/hlds_pred.m:
    Add the code moved from var_table.m.

compiler/vartypes.m:
    Move this module from the hlds package to the parse_tree package,
    for symmetry with var_table.m. It did not depend on being in hlds
    in any way.

compiler/hlds.m:
compiler/parse_tree.m:
    Move vartypes.m and var_table.m from the hlds package
    to the parse_tree package.

compiler/hlds_out_goal.m:
    Change all the predicates in this module to take a var_name_source
    instead of a prog_varset.

    Fix some comments.

compiler/hlds_out_util.m:
    Change some of the predicates in this module (those called from
    hlds_out_goal.m) to take a var_name_source instead of a prog_varset.

compiler/parse_tree_out_term.m:
    Provide variants of some existing predicates and functions that take
    var_name_sources instead of varsets. The code of the copies
    duplicates the logic of the originals, though I hope that this
    duplication can be done away with at the end of the transition.
    (The best solution would be to use a typeclass with methods
    that convert vars to their names, but we would want to ensure
    that the compiler can specialize all the affected predicates
    and functions to the two instances of this typeclass, which is
    something that we cannot do yet. In the meantime, the lack of
    any generalization in the old versions preserves their performance.)

tools/sort_imports:
tools/filter_sort_imports:
    A new tool that automatically sorts any occurrences of consecutive
    ":- import_module" declarations in the named files. The sorting is done
    in filter_sort_imports; sort_imports loops over the named files.

    After automatically replacing all occurrences of hlds.{vartypes,var_table}
    in import_module declarations with their parse_tree versions, the updated
    import_module declarations were usually out of order with respect to
    their neighbours. I used this script to fix that, and some earlier
    out-of-order imports.

compiler/accumulator.m:
compiler/add_class.m:
compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_heap_ops.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/add_trail_ops.m:
compiler/analysis.m:
compiler/arg_info.m:
compiler/build_mode_constraints.m:
compiler/bytecode_gen.m:
compiler/call_gen.m:
compiler/check_promise.m:
compiler/closure_analysis.m:
compiler/closure_gen.m:
compiler/code_info.m:
compiler/code_loc_dep.m:
compiler/common.m:
compiler/compile_target_code.m:
compiler/complexity.m:
compiler/const_prop.m:
compiler/constraint.m:
compiler/continuation_info.m:
compiler/convert_parse_tree.m:
compiler/coverage_profiling.m:
compiler/cse_detection.m:
compiler/ctgc.datastruct.m:
compiler/ctgc.util.m:
compiler/dead_proc_elim.m:
compiler/deep_profiling.m:
compiler/deforest.m:
compiler/delay_construct.m:
compiler/delay_partial_inst.m:
compiler/dep_par_conj.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/det_util.m:
compiler/direct_arg_in_out.m:
compiler/disj_gen.m:
compiler/distance_granularity.m:
compiler/equiv_type_hlds.m:
compiler/exception_analysis.m:
compiler/file_names.m:
compiler/float_regs.m:
compiler/follow_vars.m:
compiler/format_call.m:
compiler/generate_dep_d_files.m:
compiler/get_dependencies.m:
compiler/goal_expr_to_goal.m:
compiler/goal_mode.m:
compiler/goal_path.m:
compiler/goal_store.m:
compiler/goal_util.m:
compiler/granularity.m:
compiler/hhf.m:
compiler/higher_order.m:
compiler/hlds_clauses.m:
compiler/hlds_code_util.m:
compiler/hlds_error_util.m:
compiler/hlds_goal.m:
compiler/hlds_llds.m:
compiler/hlds_out_pred.m:
compiler/hlds_rtti.m:
compiler/hlds_statistics.m:
compiler/inlining.m:
compiler/inst_check.m:
compiler/inst_test.m:
compiler/inst_user.m:
compiler/instance_method_clauses.m:
compiler/instmap.m:
compiler/intermod.m:
compiler/intermod_analysis.m:
compiler/interval.m:
compiler/introduce_exists_casts.m:
compiler/introduce_parallelism.m:
compiler/item_util.m:
compiler/lambda.m:
compiler/live_vars.m:
compiler/liveness.m:
compiler/llds.m:
compiler/llds_out_data.m:
compiler/llds_out_file.m:
compiler/llds_out_util.m:
compiler/lookup_switch.m:
compiler/loop_inv.m:
compiler/make.module_target.m:
compiler/make.util.m:
compiler/make_goal.m:
compiler/make_hlds_separate_items.m:
compiler/make_hlds_types.m:
compiler/mark_tail_calls.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/middle_rec.m:
compiler/ml_accurate_gc.m:
compiler/ml_args_util.m:
compiler/ml_call_gen.m:
compiler/ml_closure_gen.m:
compiler/ml_code_gen.m:
compiler/ml_code_util.m:
compiler/ml_commit_gen.m:
compiler/ml_disj_gen.m:
compiler/ml_foreign_proc_gen.m:
compiler/ml_gen_info.m:
compiler/ml_lookup_switch.m:
compiler/ml_proc_gen.m:
compiler/ml_simplify_switch.m:
compiler/ml_switch_gen.m:
compiler/ml_tag_switch.m:
compiler/ml_unify_gen.m:
compiler/ml_unify_gen_construct.m:
compiler/ml_unify_gen_deconstruct.m:
compiler/ml_unify_gen_test.m:
compiler/ml_unify_gen_util.m:
compiler/mlds_to_c_data.m:
compiler/mlds_to_c_func.m:
compiler/mlds_to_c_global.m:
compiler/mlds_to_cs_class.m:
compiler/mlds_to_cs_file.m:
compiler/mlds_to_java_data.m:
compiler/mlds_to_java_file.m:
compiler/mlds_to_java_stmt.m:
compiler/mlds_to_java_type.m:
compiler/mmc_analysis.m:
compiler/mode_comparison.m:
compiler/mode_constraints.m:
compiler/mode_debug.m:
compiler/mode_errors.m:
compiler/mode_info.m:
compiler/mode_ordering.m:
compiler/modecheck_call.m:
compiler/modecheck_coerce.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/modes.m:
compiler/module_cmds.m:
compiler/old_type_constraints.m:
compiler/opt_debug.m:
compiler/optimize.m:
compiler/options_file.m:
compiler/ordering_mode_constraints.m:
compiler/par_loop_control.m:
compiler/parse_item.m:
compiler/parse_string_format.m:
compiler/parse_tree_out_inst.m:
compiler/parse_tree_to_term.m:
compiler/parse_util.m:
compiler/pd_debug.m:
compiler/pd_info.m:
compiler/pd_util.m:
compiler/peephole.m:
compiler/polymorphism.m:
compiler/polymorphism_info.m:
compiler/polymorphism_lambda.m:
compiler/polymorphism_type_class_info.m:
compiler/polymorphism_type_info.m:
compiler/post_typecheck.m:
compiler/pragma_c_gen.m:
compiler/pred_name.m:
compiler/pred_table.m:
compiler/prog_item.m:
compiler/prog_rep.m:
compiler/prop_mode_constraints.m:
compiler/purity.m:
compiler/push_goals_together.m:
compiler/qual_info.m:
compiler/quantification.m:
compiler/rbmm.execution_path.m:
compiler/rbmm.m:
compiler/rbmm.points_to_analysis.m:
compiler/rbmm.points_to_graph.m:
compiler/rbmm.points_to_info.m:
compiler/rbmm.region_resurrection_renaming.m:
compiler/rbmm.region_transformation.m:
compiler/recompilation.used_file.m:
compiler/recompilation.version.m:
compiler/recompute_instmap_deltas.m:
compiler/resolve_unify_functor.m:
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/saved_vars.m:
compiler/set_of_var.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_conj.m:
compiler/simplify_goal_disj.m:
compiler/simplify_goal_ite.m:
compiler/simplify_goal_scope.m:
compiler/simplify_goal_switch.m:
compiler/simplify_goal_unify.m:
compiler/simplify_info.m:
compiler/simplify_proc.m:
compiler/size_prof.m:
compiler/smm_common.m:
compiler/ssdebug.m:
compiler/stack_alloc.m:
compiler/stack_layout.m:
compiler/stack_opt.m:
compiler/stm_expand.m:
compiler/store_alloc.m:
compiler/structure_reuse.analysis.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/structure_reuse.direct.detect_garbage.m:
compiler/structure_reuse.domain.m:
compiler/structure_reuse.indirect.m:
compiler/structure_reuse.lbu.m:
compiler/structure_reuse.lfu.m:
compiler/structure_sharing.analysis.m:
compiler/structure_sharing.domain.m:
compiler/superhomogeneous.m:
compiler/switch_detection.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/tabling_analysis.m:
compiler/term_constr_build.m:
compiler/term_constr_data.m:
compiler/term_constr_initial.m:
compiler/term_constr_main.m:
compiler/term_constr_main_types.m:
compiler/term_constr_util.m:
compiler/term_pass1.m:
compiler/term_traversal.m:
compiler/term_util.m:
compiler/trace_gen.m:
compiler/trailing_analysis.m:
compiler/transform_llds.m:
compiler/try_expand.m:
compiler/tupling.m:
compiler/type_assign.m:
compiler/type_ctor_info.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/typecheck_debug.m:
compiler/typecheck_errors.m:
compiler/typecheck_info.m:
compiler/unify_gen_construct.m:
compiler/unify_gen_deconstruct.m:
compiler/unify_proc.m:
compiler/unique_modes.m:
compiler/unneeded_code.m:
compiler/untupling.m:
compiler/unused_args.m:
compiler/unused_imports.m:
compiler/var_locn.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
    Conform to the changes above.
2022-04-18 02:00:38 +10:00
Julien Fischer
81afc0c9bb Fix div and mod for 32-bit uints in the Java backend.
These were broken by commit 9a2c9dc which accidentally removed a suffix and
turned a mask constant from a long into an int.

compiler/mlds_to_java_data.m:
     Add the missing suffixes.
2021-08-13 02:54:27 +10:00
Zoltan Somogyi
0d7c8a7654 Specify pred or func for all pragmas.
*/*.m:
    As above.

configure.ac:
    Require the installed compiler to support this capability.
2021-06-16 15:23:58 +10:00
Zoltan Somogyi
d273494121 Rename a functor to avoid ambiguity. 2021-05-17 18:52:24 +10:00
Zoltan Somogyi
9a2c9dc497 Simplify the output of MLDS binops.
compiler/mlds_to_cs_data.m:
compiler/mlds_to_java_data.m:
    Instead of switching on two things (the operator, and the type of its
    arguments) at once, switch on one thing at a time.

    In many places, replace several cut-and-pasted versions of the same code
    with one parameterised copy.

    Set the string implementing each operator in the case arm
    implementing the output of binops with that operator;
    delete the old separate "look up the operator string" predicate,
    which repeated that switch.

    Abort the top level switch on the binops for which the old
    "look up the operator string" predicate used to abort.
2021-05-13 07:07:37 +10:00
Peter Wang
993b68c5bc Reduce memory requirement to build compiler in profdeep grade.
The compiler fails to compile in the asm_fast.gc.profdeep.stseg grade on
our (virtual) test server because the C file for mlds_to_java_data.m
causes gcc 7.5.0 (at the usual -O2 optimisation level) to use more than
2 GB RAM. I can also reproduce the problem with gcc 8.3.0 at least.

compiler/builtin_ops.m:
    Define an inst for binary_op.

compiler/mlds_to_java_data.m:
    Break up a large switch in output_binop_for_java.

compiler/mlds_to_cs_data.m:
    Break up output_binop_for_csharp in the same way, for consistency.
2021-05-11 17:50:52 +10:00
Zoltan Somogyi
24078e6e75 Write to explicitly named streams in the MLDS backend.
compiler/mlds_to_c_class.m:
compiler/mlds_to_c_data.m:
compiler/mlds_to_c_export.m:
compiler/mlds_to_c_file.m:
compiler/mlds_to_c_func.m:
compiler/mlds_to_c_global.m:
compiler/mlds_to_c_name.m:
compiler/mlds_to_c_stmt.m:
compiler/mlds_to_c_type.m:
compiler/mlds_to_c_util.m:
compiler/mlds_to_cs_class.m:
compiler/mlds_to_cs_data.m:
compiler/mlds_to_cs_export.m:
compiler/mlds_to_cs_file.m:
compiler/mlds_to_cs_func.m:
compiler/mlds_to_cs_global.m:
compiler/mlds_to_cs_name.m:
compiler/mlds_to_cs_stmt.m:
compiler/mlds_to_cs_type.m:
compiler/mlds_to_cs_util.m:
compiler/mlds_to_java_class.m:
compiler/mlds_to_java_data.m:
compiler/mlds_to_java_export.m:
compiler/mlds_to_java_file.m:
compiler/mlds_to_java_func.m:
compiler/mlds_to_java_global.m:
compiler/mlds_to_java_name.m:
compiler/mlds_to_java_stmt.m:
compiler/mlds_to_java_type.m:
compiler/mlds_to_java_util.m:
compiler/mlds_to_target_util.m:
    As above.

compiler/Mercury.options:
    Specify --warn-impliciy-stream-calls for all the modules above.

compiler/file_util.m:
    Delete a utility predicate that expects its clients to operate on
    implicit streams, since the changes above replaced the last calls to it
    with the variant that expects its client to operate on explicit streams.
2020-11-17 11:20:43 +11:00
Zoltan Somogyi
78e001183f Generate more readable C# and Java initializers.
compiler/mlds_to_cs_data.m:
compiler/mlds_to_java_data.m:
    Generate C# and Java code for initializers that shows its structure
    by its indentation. To make this possible, make the affected predicates
    take arguments that say what to put after the initializer(s).
    Document what these predicates do in terms of indentation as well as
    in terms of the code they are writing out.

    Put a space after cast operators.

compiler/mlds_to_cs_class.m:
compiler/mlds_to_cs_export.m:
compiler/mlds_to_cs_global.m:
compiler/mlds_to_cs_stmt.m:
compiler/mlds_to_java_class.m:
compiler/mlds_to_java_export.m:
compiler/mlds_to_java_global.m:
compiler/mlds_to_java_stmt.m:
    Use the new mechanisms in mlds_to_{cs,java}_data.m to generate code
    that shows its structure by indentation.

    Fix bad line breaks when writing out lists of arguments.

    When all call sites to a predicate specify the same value of an argument,
    and no other value makes sense for that argument, then delete the argument
    after "inlining" its value.

    Delete obsolete comments.

compiler/mlds_to_target_util.m:
    Add a utility predicate and a type needed by new code in the files above.
2020-08-10 19:41:04 +10:00
Zoltan Somogyi
ba59f6313c Make unsigned_lt a builtin operation, step 1.
Step 1 is making it a builtin; step 2 will be declaring it.
(We won't define it, since builtins may not have definitions.)

compiler/builtin_ops.m:
    Make unsigned_lt a builtin operation, and recognize
    private_builtin.unsigned_lt which does not exist yet,
    as that operation.

    We already had a builtin operation unsigned_le, which the compiler
    generated references to internally. Recognize private_builtin.unsigned_le
    as this builtin operation. The difference is that just having a builtin op
    is enough for compiler passes inside the LLDS/MLDS/ELDS backends
    that generate LLDS/MLDS/ELDS code that refer to the builtin op,
    (though the ELDS backend does not have any code that does such things),
    while code that wants to create references to builtin ops in the HLDS
    needs to have access to the predicate declaration of each builtin.
    So far, we intend to use only unsigned_lt, not unsigned_le, in this manner,
    but treating two such closely related ops differently would violate
    the law of least astonishment.

    Fix an old XXX that is related to this diff only in affecting the same
    type: standardize on add/sub/mil/div terminology over
    plus/minus/times/divide terminology.

compiler/erl_call_gen.m:
    Abort on references to unsigned_lt as well as unsigned_le.

compiler/llds_out_data.m:
compiler/ml_global_data.m:
compiler/mlds_to_c_data.m:
    The C backends already implemented unsigned_le. Handle unsigned_lt
    the same way as unsigned_le, only with s/<=/</.

compiler/mlds_to_cs_data.m:
    Implement both unsigned_lt and unsigned_le, using the C# foreign_proc
    implementation of unsigned_lt in library/int.m as a basis.

compiler/mlds_to_java_data.m:
    Implement both unsigned_lt and unsigned_le, using the Java foreign_proc
    implementation of unsigned_lt in library/int.m as a basis.

compiler/options.m:
    Provide a way to detect whether the installed compiler has this diff.
    We will need such a test in configure.ac for stage 2.

compiler/bytecode.m:
compiler/llds.m:
compiler/mlds_dump.m:
compiler/opt_debug.m:
    Conform to the changes above.

library/int.m:
    Module qualify references to unsigned_lt. This is to allow the
    affected code to compile even after the declaration of unsigned_lt
    as a predicate in private_builtin.m. (The last step of this sequence
    would be the deletion of both int.unsigned_lt and the references to it.)
2020-05-02 20:07:46 +10:00
Zoltan Somogyi
13e6050f16 Step one of adding unchecked shifts by uint amounts.
compiler/builtin_ops.m:
    Parameterize the unchecked left and right shift builtin ops
    by whether the shift amount is an int or an uint. So far,
    the shift amount has always been an int; allowing the shift amount
    to be a uint is new.

    Recognize the Mercury functions unchecked_{left,right}_ushift
    as being builtins implemented by the new variants of the unchecked
    shift builtin ops mentioned above. These Mercury functions do not
    exist yet. They will be added in step two of this diff, *after* this
    change has been installed. (Making something a builtin, and *then*
    defining it, is easier than defining it, and *then* making it a builtin,
    because in the latter case, the stage 1 and stage 2 compilers disagree
    on whether the function in question needs to have a definition.)

compiler/options.m:
    Provide a way to check whether an installed compiler has this diff.
    (This is needed for step 2.)

compiler/lookup_switch.m:
compiler/ml_lookup_switch.m:
compiler/ml_unify_gen_util.m:
compiler/unify_gen_util.m:
    When generating references to unchecked shift ops, specify that the
    shift amount is an int.

compiler/erl_call_gen.m:
    Don't treat unchecked shifts by uint amounts as builtins, since I (zs)
    don't know how this should be done in Erlang.

compiler/llds_out_data.m:
compiler/mlds_to_c_data.m:
compiler/mlds_to_cs_data.m:
    When writing out unchecked shifts for C or C#, cast the shift amount
    to int if it was originally uint.

compiler/mlds_to_java_data.m:
    When writing out unchecked shifts for Java, ignore the type of the
    shift amount, since (in the absence of a uint type in Java) we
    represent both int and uint values the same way.

compiler/bytecode.m:
compiler/c_util.m:
compiler/llds.m:
compiler/ml_global_data.m:
compiler/mlds_dump.m:
compiler/opt_debug.m:
    Conform to the changes above.
2020-04-30 17:16:30 +10:00
Peter Wang
3199d08987 Avoid 0xffffffff in code to write csharp/java ints.
compiler/mlds_to_cs_data.m:
compiler/mlds_to_java_data.m:
    Implement output_int_const_for_{csharp,java} without using
    0xffffffff. When that constant appears in a C source file,
    the C compiler may warn about it as it will not fit in a 32-bit
    signed int.
2020-04-14 22:25:48 +10:00
Zoltan Somogyi
b66f45e4db Tighten the mlds_type type.
compiler/mlds.m:
    Make two changes to mlds_type.

    The simpler change is the deletion of the maybe(foreign_type_assertions)
    field from the MLDS representations of Mercury types. It was never used,
    because Mercury types that are defined in a foreign language that is
    acceptable for the current MLDS target platform are represented
    as mlds_foreign_type, not as mercury_type.

    The more involved change is to change the representation of builtin types.
    Until now, we had separate function symbols in mlds_type to represent
    ints, uints, floats and chars, but not strings or values of the sized
    types {int,uint}{8,16,32,64}; those had to be represented as Mercury types.
    This is an unnecessary inconsistency. It also had two allowed
    representations for ints, uints, floats and chars, which meant that
    some of the code handling those conceptual types had to be duplicated
    to handle both representations.

    This diff provides mlds_builtin_type_{int(_),float,string,char} function
    symbols to represent every builtin type, and changes mercury_type
    to mercury_nb_type to make clear that it is NOT to be used for builtins
    (the nb is short for "not builtin").

compiler/ml_code_util.m:
compiler/ml_util.m:
    Delete functions that used to construct MLDS representations of builtin
    types. The new representation of those types is so simple that using
    such functions is no less cumbersome than writing down the representations
    directly.

compiler/ml_accurate_gc.m:
compiler/ml_call_gen.m:
compiler/ml_closure_gen.m:
compiler/ml_disj_gen.m:
compiler/ml_foreign_proc_gen.m:
compiler/ml_global_data.m:
compiler/ml_lookup_switch.m:
compiler/ml_proc_gen.m:
compiler/ml_rename_classes.m:
compiler/ml_simplify_switch.m:
compiler/ml_string_switch.m:
compiler/ml_switch_gen.m:
compiler/ml_tag_switch.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen_construct.m:
compiler/ml_unify_gen_deconstruct.m:
compiler/ml_unify_gen_util.m:
compiler/mlds_dump.m:
compiler/mlds_to_c_data.m:
compiler/mlds_to_c_export.m:
compiler/mlds_to_c_func.m:
compiler/mlds_to_c_global.m:
compiler/mlds_to_c_stmt.m:
compiler/mlds_to_c_type.m:
compiler/mlds_to_cs_data.m:
compiler/mlds_to_cs_stmt.m:
compiler/mlds_to_cs_type.m:
compiler/mlds_to_java_data.m:
compiler/mlds_to_java_stmt.m:
compiler/mlds_to_java_type.m:
compiler/mlds_to_java_wrap.m:
compiler/rtti_to_mlds.m:
    Conform to the changes above.
2018-09-28 23:07:23 +10:00
Peter Wang
a033685ef6 Avoid right shift count overflow warnings.
compiler/mlds_to_cs_data.m:
compiler/mlds_to_java_data.m:
    In output_int_const_for_csharp and output_int_const_for_java,
    right shift by 31 instead of 32 to avoid shift count overflow
    warnings from 32-bit compilers.

    Simplify the code.
2018-07-30 17:42:13 +10:00
Zoltan Somogyi
4404d7d884 Split up mlds_to_java.m.
compiler/mlds_to_java.m:
    Delete this module. Move its contents to the following eleven modules.

compiler/mlds_to_java_class.m:
    Code to output class definitions.

compiler/mlds_to_java_data.m:
    Code to output lvals, rvals and initializers.

compiler/mlds_to_java_export.m:
    Code to output entities (e.g. enums) exported to Java.

compiler/mlds_to_java_file.m:
    The top level code, generating whole Java files.

compiler/mlds_to_java_func.m:
    Code to output function definitions.

compiler/mlds_to_java_global.m:
    Code to output the definitions of global variables.

compiler/mlds_to_java_name.m:
    Code to output various kinds of names.

compiler/mlds_to_java_stmt.m:
    Code to output statements.

compiler/mlds_to_java_type.m:
    Code to output types.

compiler/mlds_to_java_util.m:
    Utilities used by the other mlds_to_java_*.m modules.

compiler/mlds_to_java_wrap.m:
    Code to create wrapper classes, to help implement function pointers.

compiler/ml_backend.m:
    Delete the old module, add the new modules.

compiler/Mercury.options:
    Require the new modules to have the declarations and definitions
    of their predicates in a consistent order.

compiler/mercury_compile_mlds_back_end.m:
    Import mlds_to_java_file.m instead of mlds_to_java.m.

compiler/mlds.m:
compiler/mlds_to_cs.m:
    Update some references to the deleted file.

compiler/mlds_to_c_class.m:
    Delete some stray ZZZs.
2018-06-29 18:13:12 +02:00