[m-rev.] [reuse] springtime cleaning
Nancy Mazur
Nancy.Mazur at cs.kuleuven.ac.be
Fri Mar 16 00:11:01 AEDT 2001
Hi,
===================================================================
Estimated hours taken: 1
Branches: reuse
Simply cleaning up the files a bit.
pa_alias.m:
Remove obsolete code, work on my parentheses (remove spaces),
and rename variables from allcaps to normal names.
pa_alias_as.m:
Work on parentheses.
Index: pa_alias.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/pa_alias.m,v
retrieving revision 1.1.2.7
diff -u -r1.1.2.7 pa_alias.m
--- pa_alias.m 2001/03/08 18:27:01 1.1.2.7
+++ pa_alias.m 2001/03/15 12:57:55
@@ -4,9 +4,9 @@
% Public License - see the file COPYING in the Mercury distribution.
%-----------------------------------------------------------------------------%
-% module pa_alias: manipulation of the type "alias", essential component
-% of the abstract datatype alias_as, used during possible alias
-% analysis.
+% module pa_alias: Manipulation of the type "alias", an intermediate
+% form for representing one single alias as a pair of
+% datastructures.
% main author: nancy
:- module pa_alias.
@@ -17,7 +17,7 @@
%-- import_module
% library module
-:- import_module set, list, std_util, map.
+:- import_module set, list, std_util.
:- import_module io, string, term.
% compiler module
@@ -35,151 +35,34 @@
%-------------------------------------------------------------------%
%-- exported predicates
- % Extract the vars from the alias.
-:- pred alias_vars( alias, pair(prog_var)).
-:- mode alias_vars( in, out ) is det.
-
- % Check whether the alias concerns variables which belong to
- % the given set.
-:- pred contains_vars( list(prog_var), alias).
-:- mode contains_vars( in, in) is semidet.
-
-:- pred contains_one_of_vars_in_list( list(prog_var), alias).
-:- mode contains_one_of_vars_in_list( in, in) is semidet.
-
-/* was before:
-:- pred project_alias( list(prog_var), alias,
- list(alias), list(alias)).
-:- mode project_alias( in, in, in, out) is det.
-*/
-
- % aliased_to( AL, D1, D2) such that AL = D1 - D2
-:- pred aliased_to( module_info, proc_info, alias, datastruct, datastruct ).
-:- mode aliased_to( in, in, in, in, out) is semidet.
-
- % Rename the variables of the alias using the given mapping.
-:- pred rename( map(prog_var, prog_var), alias, alias).
-:- mode rename( in, in, out) is det.
-/* was before:
-:- pred rename_alias( map(prog_var, prog_var), alias,
- list(alias), list(alias)).
-:- mode rename_alias( in, in, in, out) is det.
-*/
-
-:- pred rename_types( term__substitution(tvar_type)::in,
- alias::in, alias::out) is det.
-
- % Check whether a given alias is a member of the given list.
-:- pred occurs_in( alias, list(alias)).
-:- mode occurs_in( in, in ) is semidet.
-/* was before alias_occurs_in( list(alias), alias). */
-
- % Check whether two aliases are equal.
-:- pred equal( alias, alias ).
-:- mode equal( in, in ) is semidet.
-/* was before
-:- pred alias_equal( alias, alias ).
-:- mode alias_equal( in, in ) is semidet.
-*/
-
- % Check whether a given alias is already covered (subsumed) by
- % the given list of aliases.
- % proc_info, and module_info are needed for the normalization
- % which is done when checking subsumption.
- % XXX at this moment normalization is not used for subsumption
-:- pred subsumed_by_list( proc_info, module_info, alias, list(alias) ).
-:- mode subsumed_by_list( in, in, in, in) is semidet.
-/* was before:
-:- pred alias_subsumed_by_list( proc_info, module_info, list(alias), alias ).
-:- mode alias_subsumed_by_list( in, in, in, in) is semidet.
-*/
-
- % less_or_equal( ProcInfo, HLDS, Alias1, Alias2)
- % Check whether the first alias is covered by the second one.
-:- pred less_or_equal( proc_info, module_info, alias, alias).
-:- mode less_or_equal( in, in, in, in ) is semidet.
-/* was before:
-:- pred alias_leq( proc_info, module_info, alias, alias).
-:- mode alias_leq( in, in, in, in ) is semidet.
-*/
-
-:- pred add_subsuming(proc_info, module_info,
- alias,list(alias),list(alias)).
-:- mode add_subsuming(in, in, in,in, out) is det.
-/* was before: alias_add_subsuming/5 */
-
-:- pred least_upper_bound_lists(proc_info, module_info,
- list(alias), list(alias), list(alias)).
-:- mode least_upper_bound_lists(in, in, in, in, out) is det.
-
- % extend( ProcInfo, ModuelInfo, List1, List2, List)
- % Extend the first list with the second one, obtaining List.
- % List1 must be the old, initial set of aliases.
- % List2 is the list of new additional aliases.
- % Order is important, as the underlying implementation can then
- % provide some optimizations with regard to the plain normal
- % way of computing the result.
-:- pred extend( proc_info, module_info, list(alias), list(alias),
- list(alias)).
-:- mode extend( in, in, in, in, out) is det.
-
- % given a unification, extract the aliases it creates.
- % assignmenents between primitive types do not lead to new
+ % Given a unification, extract the aliases it creates.
+ % Assignmenents between primitive types do not lead to new
% aliases.
-:- pred from_unification( proc_info, module_info,
- hlds_goal__unification, hlds_goal__hlds_goal_info,
- list(alias)).
-:- mode from_unification( in, in, in, in, out) is det.
-/* was before:
-:- pred alias_from_unification(proc_info, module_info,
- hlds_goal__unification, alias_as).
-:- mode alias_from_unification(in, in, in, out) is det.
-*/
-
- % Normalize the given alias. Normalization can be done in
- % several ways. The goal of this operation is to simplify
- % an alias as much as possible, and without losing too much
- % information.
- % At this moment, simplification is done based on the type-info
- % of the variables involved: e.g. tail of a list, is reduced to
- % list.
-:- pred normalize_wti(proc_info, module_info, alias, alias).
-:- mode normalize_wti(in, in, in, out) is det.
-
- % extend_prog_var_from_alias( Var, Alias, SetIn, SetOut )
- % Extend SetIn with additional program variables which are aliased
- % with Var.
-:- pred extend_prog_var_from_alias( prog_var, alias,
- set(prog_var), set(prog_var)).
-:- mode extend_prog_var_from_alias( in, in, in, out) is det.
+ % XXX TO-DO: make certain that no aliases between primitive
+ % types are created, even for constructions and deconstructions.
+:- pred from_unification(proc_info::in, module_info::in,
+ hlds_goal__unification::in, hlds_goal__hlds_goal_info::in,
+ list(alias)::out) is det.
% printing routines
-:- pred print( proc_info, pred_info, string, string,
- alias, io__state, io__state).
-:- mode print( in, in, in, in, in, di, uo) is det.
+:- pred print(proc_info::in, pred_info::in, string::in, string::in,
+ alias::in, io__state::di, io__state::uo) is det.
% parsing routines
-:- pred parse_term( term(T), alias).
-:- mode parse_term( in, out) is det.
+:- pred parse_term(term(T)::in , alias::out) is det.
-:- pred live_from_in_use(set(prog_var), list(alias), live_set).
-:- mode live_from_in_use(in, in, out) is det.
+:- pred live_from_in_use(set(prog_var)::in, list(alias)::in,
+ live_set::out) is det.
-:- pred live_from_live0(module_info, proc_info,
- live_set, list(alias), live_set).
-:- mode live_from_live0(in, in, in, in, out) is det.
-
-:- pred apply_widening( module_info::in, proc_info::in, alias::in,
- alias::out) is det.
-:- pred apply_widening_list( module_info::in, proc_info::in, list(alias)::in,
- list(alias)::out) is det.
+:- pred live_from_live0(module_info::in, proc_info::in,
+ live_set::in, list(alias)::in, live_set::out) is det.
%-------------------------------------------------------------------%
%-------------------------------------------------------------------%
:- implementation.
% library module
-:- import_module varset, require, int.
+:- import_module varset, require, int, map.
% compiler module
:- import_module hlds_data, mercury_to_mercury, type_util.
@@ -187,58 +70,35 @@
:- import_module pa_selector.
%-------------------------------------------------------------------%
-%-- type definitions
-
-%:- type alias == pair(datastruct).
-
-%-------------------------------------------------------------------%
-
-extend_prog_var_from_alias( Var, Alias, Set0, Set):-
- (
- alias_vars( Alias, Var - OtherVar )
- ->
- set__insert( Set0, OtherVar, Set)
- ;
- alias_vars( Alias, OtherVar - Var )
- ->
- set__insert( Set0, OtherVar, Set)
- ;
-
- Set = Set0
- ).
-
-
-
-%-------------------------------------------------------------------%
% printing routines
%-------------------------------------------------------------------%
-print( ProcInfo, PredInfo, FrontString, EndString, ALIAS ) -->
- { ALIAS = D1 - D2 },
- io__write_string( FrontString ),
- io__write_string( "pair( " ),
- pa_datastruct__print( D1, ProcInfo, PredInfo ),
+print(ProcInfo, PredInfo, FrontString, EndString, Alias0) -->
+ { Alias0 = D1 - D2 },
+ io__write_string(FrontString),
+ io__write_string("pair( "),
+ pa_datastruct__print(D1, ProcInfo, PredInfo),
io__write_string(" , "),
- pa_datastruct__print( D2, ProcInfo, PredInfo ),
+ pa_datastruct__print(D2, ProcInfo, PredInfo),
io__write_string(" ) "),
- io__write_string( EndString ).
+ io__write_string(EndString).
%-------------------------------------------------------------------%
% parsing routines
%-------------------------------------------------------------------%
-pa_alias__parse_term( TERM, A) :-
+pa_alias__parse_term(Term, A) :-
(
- TERM = term__functor( term__atom(CONS), Args, _)
+ Term = term__functor(term__atom(Cons), Args, _)
->
(
- CONS = "pair"
+ Cons = "pair"
->
(
Args = [ First, Second ]
->
- pa_datastruct__parse_term( First, D1 ),
- pa_datastruct__parse_term( Second, D2 ),
+ pa_datastruct__parse_term(First, D1),
+ pa_datastruct__parse_term(Second, D2),
A = D1 - D2
;
list__length(Args, L),
@@ -250,9 +110,9 @@
error(Msg)
)
;
- term__det_term_to_type( TERM, TYPE),
+ term__det_term_to_type(Term, Type),
varset__init(V),
- mercury_type_to_string(V, TYPE, StringTerm),
+ mercury_type_to_string(V, Type, StringTerm),
string__append_list([
"(pa_alias) parse_term: ",
"wrong constructor. `",
@@ -263,58 +123,23 @@
;
error("(pa_alias) parse_term: term is not a functor")
).
-
-
-alias_vars( Data1 - Data2, Var1 - Var2 ):-
- pa_datastruct__get_var(Data1, Var1),
- pa_datastruct__get_var(Data2, Var2).
-
-contains_vars( Vars, Alias) :-
- Alias = Data1 - Data2,
- pa_datastruct__get_var(Data1, Var1),
- pa_datastruct__get_var(Data2, Var2),
- list__member(Var1, Vars),
- list__member(Var2, Vars).
-
-contains_one_of_vars_in_list( Vars, Alias) :-
- Alias = Data1 - Data2,
- pa_datastruct__get_var(Data1, Var1),
- pa_datastruct__get_var(Data2, Var2),
- ( list__member(Var1, Vars); list__member(Var2, Vars)).
-
-aliased_to( ModuleInfo, ProcInfo, Alias, Data1, Data2 ) :-
- Alias = D1 - D2,
- (
- pa_datastruct__less_or_equal(ModuleInfo, ProcInfo,
- Data1, D1, EXT)
- ->
- pa_datastruct__termshift(D2, EXT, Data2)
- ;
- pa_datastruct__less_or_equal(ModuleInfo, ProcInfo,
- Data1, D2, EXT)
- ->
- pa_datastruct__termshift(D1, EXT, Data2)
- ;
- fail
- ).
-
- % contains_one_of_vars( SET, ALIAS, DATA)
+ % contains_one_of_vars(SET, ALIAS, DATA)
% returns true if ALIAS = DATA1 - DATA,
% where DATA1 \in SET
% and DATA \not\in SET
-:- pred contains_one_of_vars( set(prog_var), alias, datastruct).
-:- mode contains_one_of_vars( in, in, out) is semidet.
+:- pred contains_one_of_vars(set(prog_var), alias, datastruct).
+:- mode contains_one_of_vars(in, in, out) is semidet.
-contains_one_of_vars( Set, Alias, DATA) :-
+contains_one_of_vars(Set, Alias, DATA) :-
Alias = Data1 - Data2,
pa_datastruct__get_var(Data1, Var1),
pa_datastruct__get_var(Data2, Var2),
(
set__member(Var1, Set)
->
- not(set__member(Var2, Set) ),
+ not(set__member(Var2, Set)),
DATA = Data2
;
set__member(Var2, Set)
@@ -325,318 +150,28 @@
fail
).
-
-rename( MAP, Alias, RAlias) :-
- Alias = Data1 - Data2,
- pa_datastruct__rename( MAP, Data1, RData1),
- pa_datastruct__rename( MAP, Data2, RData2),
- RAlias = RData1 - RData2.
-
-rename_types( Subst, Alias0, Alias ):-
- Alias0 = Data10 - Data20,
- pa_datastruct__rename_types( Subst, Data10, Data1),
- pa_datastruct__rename_types( Subst, Data20, Data2),
- Alias = Data1 - Data2.
-
-occurs_in( A2, [A1 | R ] ):-
- (
- pa_alias__equal(A1,A2)
- ->
- true
- ;
- occurs_in( A2, R )
- ).
-
-equal( A1, A2 ) :-
- A1 = D1a - D1b,
- A2 = D2a - D2b,
- (
- pa_datastruct__equal(D1a,D2a),
- pa_datastruct__equal(D1b,D2b)
- ;
- pa_datastruct__equal(D1a,D2b),
- pa_datastruct__equal(D1b,D2a)
- ).
-
-subsumed_by_list( ProcInfo, HLDS, A2, [A1 | R ] ) :-
- (
- less_or_equal(ProcInfo, HLDS,A2,A1)
- ->
- true
- ;
- subsumed_by_list( ProcInfo, HLDS, A2, R)
- ).
-
-
-less_or_equal( ProcInfo, HLDS, A1, A2 ) :-
- A1 = D1a - D1b,
- A2 = D2a - D2b,
- (
- % XXX TEST underscored extensions!
- pa_datastruct__less_or_equal(HLDS, ProcInfo, D1a,D2a, EXT1),
- pa_datastruct__less_or_equal(HLDS, ProcInfo, D1b,D2b, EXT1)
- % the extension should be the same wrt normalization
- % normalize(D1b.EXT1) == normalize(D1b.EXT2)
- % where normalize(D1b.EXT2) == D2b as D2b is a normalized
- % datastructure.
- % ==> normalize(D1b.EXT1) == D2b
- % datastruct_termshift(D1b, EXT1, D_temp),
- % normalize_datastruct(ProcInfo,HLDS,D_temp,D2b)
- % XXX
- % verifying the leq-operation wrt normalize operation
- % is not really recommended as datastructs are not
- % normalized during the analysis of a procedure, only
- % at the end.
- ;
- % XXX TEST underscored extensions!
- pa_datastruct__less_or_equal(HLDS, ProcInfo, D1a,D2b, EXT1),
- pa_datastruct__less_or_equal(HLDS, ProcInfo, D1b,D2a, EXT1)
- ).
-
-
-add_subsuming( _ProcInfo, _HLDS, ALIAS, [], [ALIAS]).
-add_subsuming( ProcInfo, HLDS, ALIAS, [ A | R ], RESULT ):-
- (
- less_or_equal( ProcInfo, HLDS, ALIAS,A)
- ->
- RESULT = [ A | R ]
- ;
- less_or_equal( ProcInfo, HLDS, A, ALIAS)
- ->
- add_subsuming( ProcInfo, HLDS, ALIAS, R, RESULT)
- % RESULT = [ ALIAS | R ]
- ;
- add_subsuming( ProcInfo, HLDS, ALIAS, R, TEMP),
- RESULT = [ A | TEMP ]
- ).
-
-least_upper_bound_lists(ProcInfo, HLDS, L1, L2, L):-
- list__foldl(pa_alias__add_subsuming(ProcInfo, HLDS),
- L1, L2, L).
-
-extend( ProcInfo, HLDS, NEW, OLD, RESULT) :-
-% alias_altclosure( ProcInfo, HLDS, NEW, OLD, RESULT).
- altclosure_altclos( HLDS, ProcInfo, NEW, OLD, RESULT).
-
-%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
-
-:- type altclos_path ---> undirected(alias) % can be rotated
- ; directed(alias). % fixed order: shortcut of
- % path(alias, ... , alias)
-
-:- pred alias_to_altclos_path(alias::in, altclos_path::out) is det.
-alias_to_altclos_path(Alias, undirected(Alias)).
-
-:- pred altclos_path_to_alias(altclos_path::in, alias::out) is det.
-altclos_path_to_alias( undirected(Alias), Alias ).
-altclos_path_to_alias( directed(Alias), Alias ).
-
%-----------------------------------------------------------------------------%
-% altclos computations.
-
- % altclosure_altclos( ModuleInfo, ProcInfo, NEW, OLD, RESULT)
- % computes the alternating closure of two lists of aliases.
- % RESULT = NEW + OLD + path2(NEW,OLD) + path3(NEW,OLD).
- % where path2(NEW,OLD) is: (a,b), such that (a,c) in NEW,
- % and (c,b) in OLD
- % where path3(NEW,OLD) is: (a,b), such that (a,c) in NEW,
- % (c,d) in OLD,
- % (d,b) in NEW
- % taking into account termshifts.
-:- pred altclosure_altclos( module_info::in, proc_info::in,
- list(alias)::in, list(alias)::in,
- list(alias)::out ) is det.
-altclosure_altclos( ModuleInfo, ProcInfo, NewAliases, OldAliases,
- ComputedAliases ):-
- (
- NewAliases = []
- ->
- ComputedAliases = OldAliases
- ;
- OldAliases = []
- ->
- ComputedAliases = NewAliases
- ;
- altclosure_altclos_path2_3( ModuleInfo, ProcInfo,
- NewAliases, OldAliases,
- Path2, Path3),
- list__foldl(
- pa_alias__least_upper_bound_lists(ProcInfo, ModuleInfo),
- [OldAliases,NewAliases,Path2,Path3],
- [],
- ComputedAliases)
- ).
-
- % altclosure_altclos_path2_3( NewAliases, OldAliases, Path2, Path3)
-:- pred altclosure_altclos_path2_3( module_info::in, proc_info::in,
- list(alias)::in, list(alias)::in,
- list(alias)::out, list(alias)::out) is det.
-altclosure_altclos_path2_3( ModuleInfo, ProcInfo,
- NewAliases, OldAliases, Path2, Path3):-
- list__map( alias_to_altclos_path, NewAliases, StartPaths ),
- list__foldl(
- pred( StartPath::in, Acc::in, NewPaths::out) is det :-
- (
- altclos_ordered_altclos_path( ModuleInfo,
- ProcInfo, StartPath,
- OldAliases, Acc, NewPaths)
- ),
- StartPaths,
- [],
- PathsLength2 ),
- list__foldl(
- pred( StartPath::in, Acc::in, NewPaths::out) is det :-
- (
- altclos_ordered_altclos_path( ModuleInfo,
- ProcInfo, StartPath,
- NewAliases, Acc, NewPaths)
- ),
- PathsLength2,
- [],
- PathsLength3),
- list__map( altclos_path_to_alias, PathsLength2, Path2),
- list__map( altclos_path_to_alias, PathsLength3, Path3).
-
-:- pred altclos_ordered_altclos_path( module_info::in, proc_info::in,
- altclos_path::in, list(alias)::in,
- list(altclos_path)::in, list(altclos_path)::out) is det.
-altclos_ordered_altclos_path( ModuleInfo, ProcInfo,
- StartPath, EndAliases, AccPaths, NewPaths):-
- list__filter_map(single_altclos_path( ModuleInfo, ProcInfo,
- StartPath ),
- EndAliases, NewPaths0 ),
- list__append( NewPaths0, AccPaths, NewPaths).
-
- % single_altclos_path( StartPath, EndAlias, NewPath).
- % Find a path starting from StartPath and ending in EndAlias.
- % EndAlias can always be rotated. StartPath can only be
- % rotated if it is a single path.
-:- pred single_altclos_path( module_info::in, proc_info::in,
- altclos_path::in, alias::in,
- altclos_path::out) is semidet.
-single_altclos_path( ModuleInfo, ProcInfo, StartPath, EndAlias, NewPath) :-
- (
- StartPath = undirected(StartAlias)
- ->
- (
- single_directed_altclos_path_verify(ModuleInfo,
- ProcInfo, StartAlias,
- EndAlias, NewPath0)
- ->
- NewPath = NewPath0
- ;
- switch(StartAlias, StartAliasSW),
- single_directed_altclos_path_verify(ModuleInfo,
- ProcInfo, StartAliasSW,
- EndAlias, NewPath)
- )
- ;
- StartPath = directed(StartAlias),
- single_directed_altclos_path_verify(ModuleInfo,
- ProcInfo, StartAlias,
- EndAlias, NewPath)
- ).
-
- % single_directed_altclos_path_verify( StartAlias, EndAlias, NewPath).
- % Compute a path starting from StartAlias to EndAlias. StartAlias
- % may not be rotated. EndAlias can be rotated if needed. The middle
- % alias still has to be verified.
-:- pred single_directed_altclos_path_verify( module_info::in,
- proc_info::in, alias::in, alias::in,
- altclos_path::out) is semidet.
-single_directed_altclos_path_verify( ModuleInfo, ProcInfo,
- StartAlias, EndAlias, Path ) :-
- StartAlias = _StartDatastructure1 - StartDatastructure2,
- EndAlias = EndDatastructure1 - EndDatastructure2,
- (
- pa_datastruct__same_vars( StartDatastructure2,
- EndDatastructure1)
- ->
- single_directed_altclos_path( ModuleInfo, ProcInfo,
- StartAlias, EndAlias,
- Path)
- ;
- pa_datastruct__same_vars( StartDatastructure2,
- EndDatastructure2),
- switch( EndAlias, EndAliasSW ),
- single_directed_altclos_path( ModuleInfo, ProcInfo,
- StartAlias, EndAliasSW,
- Path)
- ).
-
- % single_directed_altclos_path( StartAlias, EndAlias, NewPath).
- % they already have matching middle vars.
-:- pred single_directed_altclos_path( module_info::in, proc_info::in,
- alias::in, alias::in,
- altclos_path::out) is semidet.
-single_directed_altclos_path( ModuleInfo, ProcInfo,
- StartAlias, EndAlias, NewPath):-
- StartAlias = StartDatastructure1 - StartDatastructure2,
- EndAlias = EndDatastructure1 - EndDatastructure2,
- pa_datastruct__get_selector(StartDatastructure2, StartSelector),
- pa_datastruct__get_var( StartDatastructure2, Var),
- pa_datastruct__get_selector(EndDatastructure1, EndSelector),
-
- proc_info_vartypes( ProcInfo, VarTypes ),
- map__lookup( VarTypes, Var, CommonVarType),
-
- (
- % either EndSelector <= StartSelector
- %pa_selector__less_or_equal( EndSelector, StartSelector,
- % Ext)
- pa_selector__less_or_equal(ModuleInfo,
- EndSelector, StartSelector,
- CommonVarType, Ext)
- ->
- % StartSelector.Ext = EndSelector, and StartAlias has
- % to be termshifted:
- pa_datastruct__termshift(StartDatastructure1, Ext,
- NewStartDatastructure1),
- NewPath = directed( NewStartDatastructure1 -
- EndDatastructure2 )
- ;
- % or StartSelector <= EndSelector
- %pa_selector__less_or_equal( StartSelector, EndSelector,
- % Ext)
- pa_selector__less_or_equal(ModuleInfo,
- StartSelector, EndSelector,
- CommonVarType, Ext)
- ->
- % EndSelector.Ext = StartSelector, and EndAlias has to
- % be termshifted:
- pa_datastruct__termshift(EndDatastructure2, Ext,
- NewEndDatastructure2),
- NewPath = directed(StartDatastructure1 - NewEndDatastructure2)
- ;
- fail
- ).
-
-
-%-----------------------------------------------------------------------------%
-%-----------------------------------------------------------------------------%
-
-:- pred number_args( list(prog_var), list(pair(int, prog_var))).
-:- mode number_args( in, out) is det.
-
-number_args( ARGS, NUMBEREDARGS ) :-
+:- pred number_args(list(prog_var)::in,
+ list(pair(int, prog_var))::out) is det.
+number_args(Args, NumberedArgs) :-
list__map_foldl(
- pred( A::in, AP::out, Nin::in, Nout::out) is det:-
+ pred(A::in, AP::out, Nin::in, Nout::out) is det:-
(
AP = std_util:'-'(Nin, A),
Nout = Nin + 1
),
- ARGS,
- NUMBEREDARGS,
- 1, _ ).
+ Args,
+ NumberedArgs,
+ 1, _).
from_unification(_ProcInfo, _HLDS,
construct(Var, Cons, Args0, _, _, _, _), _Info, AS) :-
- get_rid_of_damn_typeinfos( Cons, Args0, Args),
- number_args(Args, NumberedArsg),
- list__foldl(alias_from_unif(Var, Cons), NumberedArsg, [], AS0),
- internal_aliases(NumberedArsg, PosList),
+ get_rid_of_damn_typeinfos(Cons, Args0, Args),
+ number_args(Args, NumberedArgs),
+ list__foldl(alias_from_unif(Var, Cons), NumberedArgs, [], AS0),
+ internal_aliases(NumberedArgs, PosList),
create_internal_aliases(Var, Cons, PosList, AS1),
list__append(AS0, AS1, AS).
@@ -721,14 +256,14 @@
)
).
-:- pred get_rid_of_damn_typeinfos( cons_id::in, list(prog_var)::in,
- list(prog_var)::out) is det.
-get_rid_of_damn_typeinfos( Cons, Args0, Args ) :-
- cons_id_maybe_arity( Cons, MaybeArity ),
+:- pred get_rid_of_damn_typeinfos(cons_id::in, list(prog_var)::in,
+ list(prog_var)::out) is det.
+get_rid_of_damn_typeinfos(Cons, Args0, Args) :-
+ cons_id_maybe_arity(Cons, MaybeArity),
(
- MaybeArity = yes( RealArity )
+ MaybeArity = yes(RealArity)
->
- list__length( Args0, PseudoArity),
+ list__length(Args0, PseudoArity),
(
RealArity = PseudoArity
->
@@ -736,7 +271,7 @@
;
Diff = PseudoArity - RealArity,
(
- list__drop( Diff, Args0, Args1 )
+ list__drop(Diff, Args0, Args1)
->
Args = Args1
;
@@ -748,23 +283,18 @@
).
-from_unification( _ProcInfo, _HLDS,
- deconstruct( VAR, CONS, ARGS0, _, _, _ ), Info, AS) :-
- get_rid_of_damn_typeinfos( CONS, ARGS0, ARGS),
- number_args( ARGS, NUMBEREDARGS),
- optimize_for_deconstruct(NUMBEREDARGS, Info, ReducedARGS),
- list__foldl( alias_from_unif(VAR,CONS),ReducedARGS, [], AS).
-
-:- pred optimize_for_deconstruct(
- list(pair(int, prog_var)), hlds_goal_info,
- list(pair(int, prog_var))).
-:- mode optimize_for_deconstruct(in, in, out) is det.
+from_unification(_ProcInfo, _HLDS,
+ deconstruct(Var, Cons, Args0, _, _, _), Info, AS) :-
+ get_rid_of_damn_typeinfos(Cons, Args0, Args),
+ number_args(Args, NumberedArgs),
+ optimize_for_deconstruct(NumberedArgs, Info, ReducedArgs),
+ list__foldl(alias_from_unif(Var,Cons),ReducedArgs, [], AS).
+
+:- pred optimize_for_deconstruct(list(pair(int, prog_var))::in,
+ hlds_goal_info::in, list(pair(int, prog_var))::out) is det.
% For deconstructions, a huge optimization can be made by
% avoiding the construction of aliases involving variables
% which are not used anyway.
-/*************************************************************
-optimize_for_deconstruct(Args, _Info, Args).
-*************************************************************/
optimize_for_deconstruct(Args, Info, ReducedArgs) :-
% Of all the args of a deconstruct, only the ones that are
% in the pre-birth set are actually used during the subsequent
@@ -773,74 +303,26 @@
% deconstruction, it is enough to consider only those with
% the args which are in pre-birth.
hlds_goal__goal_info_get_pre_births(Info, PreB),
- % keep_only_the_prebirths( Args, [], ReducedArgs, PreB ).
- keep_only_the_prebirths_v2( PreB, Args, ReducedArgs).
-/*************************************************************
- list__filter(
- pred( NumVar::in ) is semidet :-
- ( NumVar = std_util:'-'(_, Var),
- set__member( Var, PreB ) ),
- Args,
- ReducedArgs).
-*************************************************************/
-
-:- pred keep_only_the_prebirths( list(pair(int, prog_var)),
- list(pair(int, prog_var)),
- list(pair(int, prog_var)),
- set(prog_var)).
-:- mode keep_only_the_prebirths( in, in, out, in) is det.
+ keep_only_the_prebirths_v2(PreB, Args, ReducedArgs).
-keep_only_the_prebirths( TODO, ACC, RES, PREB ) :-
+:- pred keep_only_the_prebirths_v2(set( prog_var)::in,
+ list(pair(int, prog_var))::in,
+ list(pair(int, prog_var))::out) is det.
+
+keep_only_the_prebirths_v2(PreB, AllArgs, RES) :-
+ set__to_sorted_list(PreB, ListPreB),
+ keep_only_the_prebirths_v2_2(ListPreB, AllArgs, [], RES).
+
+:- pred keep_only_the_prebirths_v2_2(list(prog_var)::in,
+ list(pair(int, prog_var))::in,
+ list(pair(int, prog_var))::in,
+ list(pair(int, prog_var))::out) is det.
+keep_only_the_prebirths_v2_2(PreB, AllArgs, ACC, RES):-
(
- TODO = [ X | Xs ]
- ->
- X = std_util:'-'(_, Var),
- (
- set__remove( PREB, Var, PREB_1)
- ->
- ACC_1 = [ X | ACC ],
- keep_only_the_prebirths( Xs, ACC_1, RES, PREB_1)
- ;
- keep_only_the_prebirths( Xs, ACC, RES, PREB)
- )
- ;
- RES = ACC
- ).
-
-:- pred keep_only_the_prebirths_v2( set( prog_var),
- list(pair(int, prog_var)),
- list(pair(int, prog_var))).
-:- mode keep_only_the_prebirths_v2( in, in, out) is det.
-
-keep_only_the_prebirths_v2( PreB, AllArgs, RES ) :-
- set__to_sorted_list( PreB, ListPreB),
- /**
- % This length-test is not correct anymore in the presence
- % of those *LLFD* typeinfos.
- list__length( ListPreB, L1),
- list__length( AllArgs, L2),
-
- (
- L1 = L2
- ->
- RES = AllArgs
- ;
- **/
- keep_only_the_prebirths_v2_2( ListPreB, AllArgs, [], RES).
-
-
-:- pred keep_only_the_prebirths_v2_2( list(prog_var),
- list(pair(int, prog_var)),
- list(pair(int, prog_var)),
- list(pair(int, prog_var))).
-:- mode keep_only_the_prebirths_v2_2( in, in, in, out) is det.
-
-keep_only_the_prebirths_v2_2( PreB, AllArgs, ACC, RES):-
- (
PreB = [ X | Xs ]
->
(
- list_find( X, Arg, AllArgs, AllArgs0)
+ list_find(X, Arg, AllArgs, AllArgs0)
->
ACC0 = [ Arg | ACC ],
AllArgs1 = AllArgs0
@@ -848,17 +330,16 @@
ACC0 = ACC,
AllArgs1 = AllArgs
),
- keep_only_the_prebirths_v2_2( Xs, AllArgs1, ACC0, RES)
+ keep_only_the_prebirths_v2_2(Xs, AllArgs1, ACC0, RES)
;
RES = ACC
).
-:- pred list_find( prog_var, pair(int, prog_var),
- list(pair(int, prog_var)),
- list(pair(int, prog_var))).
-:- mode list_find( in, out, in, out) is semidet.
+:- pred list_find(prog_var::in, pair(int, prog_var)::out,
+ list(pair(int, prog_var))::in,
+ list(pair(int, prog_var))::out) is semidet.
-list_find( Var, Arg, Lin, Lout) :-
+list_find(Var, Arg, Lin, Lout) :-
Lin = [ First | Rest ],
(
First = std_util:'-'(_, Var)
@@ -866,95 +347,76 @@
Arg = First,
Lout = Rest
;
- list_find( Var, Arg, Rest, Tmp),
+ list_find(Var, Arg, Rest, Tmp),
Lout = [ First | Tmp ]
).
-from_unification( ProcInfo, HLDS,
- assign(VAR1,VAR2), _, AS):-
+from_unification(ProcInfo, HLDS, assign(Var1,Var2), _, AS):-
(
- is_of_a_primitive_type(ProcInfo, HLDS, VAR1)
+ is_of_a_primitive_type(ProcInfo, HLDS, Var1)
->
AS = []
;
- pa_datastruct__init(VAR1,D1),
- pa_datastruct__init(VAR2,D2),
- ALIAS = D1 - D2,
- AS = [ALIAS]
+ pa_datastruct__init(Var1,D1),
+ pa_datastruct__init(Var2,D2),
+ Alias = D1 - D2,
+ AS = [Alias]
).
-from_unification( _ProcInfo, _HLDS,
- simple_test(_A,_B), _, AS):-
+from_unification(_ProcInfo, _HLDS, simple_test(_A,_B), _, AS):-
AS = [].
-from_unification( _ProcInfo, _HLDS,
- complicated_unify(_,_,_), _, AS):-
- % XXXX only if partially instantiated datastructures cannot
+from_unification(_ProcInfo, _HLDS, complicated_unify(_,_,_), _, AS):-
+ % XXX only if partially instantiated datastructures cannot
% exist.
AS = [].
-
-:- pred is_of_a_primitive_type(proc_info, module_info, prog_var).
-:- mode is_of_a_primitive_type(in,in,in) is semidet.
-is_of_a_primitive_type(ProcInfo, HLDS, VAR):-
- proc_info_vartypes( ProcInfo, VarTypes ),
- map__lookup( VarTypes, VAR, VarType ),
+:- pred is_of_a_primitive_type(proc_info::in, module_info::in,
+ prog_var::in) is semidet.
+is_of_a_primitive_type(ProcInfo, HLDS, Var):-
+ proc_info_vartypes(ProcInfo, VarTypes),
+ map__lookup(VarTypes, Var, VarType),
type_util__type_is_atomic(VarType, HLDS).
-:- pred alias_from_unif(prog_var, cons_id, pair(int, prog_var),
- list(alias),
- list(alias)).
-:- mode alias_from_unif(in, in, in, in, out) is det.
-alias_from_unif( VAR, CONS, N - ARG, LISTin, LISTout):-
- pa_datastruct__init( VAR, CONS, N, D1),
- pa_datastruct__init( ARG, D2 ),
- ALIAS = D1 - D2,
- LISTout = [ALIAS | LISTin].
+:- pred alias_from_unif(prog_var::in, cons_id::in, pair(int, prog_var)::in,
+ list(alias)::in, list(alias)::out) is det.
+alias_from_unif(Var, Cons, N - ARG, List0, List):-
+ pa_datastruct__init(Var, Cons, N, D1),
+ pa_datastruct__init(ARG, D2),
+ Alias = D1 - D2,
+ List = [Alias | List0].
% switch the order of the alias...
-:- pred switch(alias,alias).
-:- mode switch(in,out) is det.
-
-switch( D1 - D2, D2 - D1 ).
+:- pred switch(alias::in, alias::out) is det.
+switch(D1 - D2, D2 - D1).
%-----------------------------------------------------------------------------%
-% NORMALIZATION WITH TYPE INFORMATION
%-----------------------------------------------------------------------------%
-
-normalize_wti(ProcInfo, HLDS, A0, A):-
- A0 = Da0 - Db0,
- % the two datastructs are normalized independently!
- pa_datastruct__normalize_wti(ProcInfo, HLDS, Da0, Da),
- pa_datastruct__normalize_wti(ProcInfo, HLDS, Db0, Db),
- A = Da - Db.
-%-----------------------------------------------------------------------------%
-%-----------------------------------------------------------------------------%
-
-live_from_in_use(IN_USE, ALIASES, LIVE):-
+live_from_in_use(InUse, Aliases, Live):-
% filter the list of aliases, keeping only the ones that
% involve at least one variable from the IN_USE set
list__filter_map(
- pa_alias__contains_one_of_vars(IN_USE),
- ALIASES,
- DATASTRUCTS),
- sr_live__from_datastructs(DATASTRUCTS, LIVE).
+ pa_alias__contains_one_of_vars(InUse),
+ Aliases,
+ Datastructs),
+ sr_live__from_datastructs(Datastructs, Live).
-live_from_live0(ModuleInfo, ProcInfo, LIVE_0, ALIASES, LIVE):-
+live_from_live0(ModuleInfo, ProcInfo, Live0, Aliases, Live):-
(
- (sr_live__top(LIVE_0) ; sr_live__bottom(LIVE_0))
+ (sr_live__top(Live0) ; sr_live__bottom(Live0))
->
- LIVE = LIVE_0
+ Live = Live0
;
- sr_live__get_datastructs(LIVE_0, Datastructs),
+ sr_live__get_datastructs(Live0, Datastructs0),
list__map(
pa_alias__one_of_vars_is_live(ModuleInfo,
- ProcInfo, Datastructs),
- ALIASES,
- LL_DATASTRUCTS),
- list__condense(LL_DATASTRUCTS, DATASTRUCTS),
- sr_live__from_datastructs(DATASTRUCTS, LIVE)
+ ProcInfo, Datastructs0),
+ Aliases,
+ DatastructsLists),
+ list__condense(DatastructsLists, Datastructs),
+ sr_live__from_datastructs(Datastructs, Live)
).
% one_of_vars_is_live(LIST, ALIAS, X^sx1)
@@ -964,86 +426,60 @@
% sy = s1.s2 => sx1 = sx
% or
% sy.s2 = s1 => sx1 = sx.s2
-:- pred one_of_vars_is_live(module_info, proc_info,
- list(pa_datastruct__datastruct),
- alias,
- list(pa_datastruct__datastruct)).
-:- mode one_of_vars_is_live(in, in, in, in, out) is det.
-
-one_of_vars_is_live(ModuleInfo, ProcInfo, LIST, ALIAS, List_Xsx1) :-
- one_of_vars_is_live_ordered(ModuleInfo, ProcInfo, LIST, ALIAS, L1),
- switch(ALIAS, ALIASsw),
- one_of_vars_is_live_ordered(ModuleInfo, ProcInfo, LIST, ALIASsw, L2),
- list__append(L1,L2, List_Xsx1).
-
-:- pred one_of_vars_is_live_ordered( module_info, proc_info,
- list(pa_datastruct__datastruct),
- alias,
- list(pa_datastruct__datastruct) ).
-:- mode one_of_vars_is_live_ordered( in, in, in, in, out) is det.
-
-one_of_vars_is_live_ordered( ModuleInfo, ProcInfo, LIST, ALIAS, List_Xsx1 ) :-
+:- pred one_of_vars_is_live(module_info::in, proc_info::in,
+ list(pa_datastruct__datastruct)::in, alias::in,
+ list(pa_datastruct__datastruct)::out) is det.
+one_of_vars_is_live(ModuleInfo, ProcInfo, Datastructs0,
+ Alias0, Datastructs) :-
+ one_of_vars_is_live_ordered(ModuleInfo, ProcInfo,
+ Datastructs0, Alias0, L1),
+ switch(Alias0, AliasSW),
+ one_of_vars_is_live_ordered(ModuleInfo, ProcInfo,
+ Datastructs0, AliasSW, L2),
+ list__append(L1,L2, Datastructs).
+
+:- pred one_of_vars_is_live_ordered(module_info::in, proc_info::in,
+ list(pa_datastruct__datastruct)::in, alias::in,
+ list(pa_datastruct__datastruct)::out) is det.
+one_of_vars_is_live_ordered(ModuleInfo, ProcInfo, List, ALIAS, List_Xsx1) :-
ALIAS = Xsx - Ysy,
pa_datastruct__get_var(Ysy, Y),
list__filter(
- pred( D::in ) is semidet :-
- ( pa_datastruct__get_var(D,Y) ),
- LIST,
- Y_LIST),
+ pred(D::in) is semidet :-
+ (pa_datastruct__get_var(D,Y)),
+ List,
+ Y_List),
(
% first try to find one of the found datastructs which is
% fully alive: so that Ysy is less or equal to at least one
- % Ys1 in Y_LIST (sy = s1.s2)
+ % Ys1 in Y_List (sy = s1.s2)
list__filter(
- pred( Ys1::in ) is semidet :-
- ( pa_datastruct__less_or_equal( ModuleInfo,
- ProcInfo, Ysy, Ys1, _s2) ),
- Y_LIST,
- FY_LIST),
- FY_LIST = [_|_]
+ pred(Ys1::in) is semidet :-
+ (pa_datastruct__less_or_equal( ModuleInfo,
+ ProcInfo, Ysy, Ys1, _s2)),
+ Y_List,
+ FY_List),
+ FY_List = [_|_]
->
Xsx1 = Xsx,
List_Xsx1 = [Xsx1]
;
- % find all datastructs from Y_LIST which are less or
+ % find all datastructs from Y_List which are less or
% equal to Ysy, select the one with the shortest selector
% (note that there should be only one solution. if more
% than one such datastruct is found, the initial live_set
% is not minimal, while this should be somehow guaranteed).
list__filter_map(
- pred( Ys1::in, S2::out) is semidet :-
- ( pa_datastruct__less_or_equal( ModuleInfo,
+ pred(Ys1::in, S2::out) is semidet :-
+ (pa_datastruct__less_or_equal( ModuleInfo,
ProcInfo, Ysy, Ys1, S2)),
- Y_LIST,
- SELECTOR_LIST),
- % each sx1 = sx.s2, where s2 is one of SELECTOR_LIST
+ Y_List,
+ SelectorList),
+ % each sx1 = sx.s2, where s2 is one of SelectorList
list__map(
- pred( S2::in, Xsx1::out) is det :-
- ( pa_datastruct__termshift(Xsx, S2, Xsx1 ) ),
- SELECTOR_LIST,
- List_Xsx1 )
+ pred(S2::in, Xsx1::out) is det :-
+ (pa_datastruct__termshift(Xsx, S2, Xsx1)),
+ SelectorList,
+ List_Xsx1)
).
-%-----------------------------------------------------------------------------%
-%-----------------------------------------------------------------------------%
-
-apply_widening( ModuleInfo, ProcInfo, Alias0, Alias) :-
- Alias0 = Da0 - Db0,
- apply_widening( ModuleInfo, ProcInfo, Da0, Da),
- apply_widening( ModuleInfo, ProcInfo, Db0, Db),
- Alias = Da - Db.
-
-apply_widening_list(ModuleInfo, ProcInfo, AliasList0, AliasList) :-
- list__foldl(
- pred( Alias0::in, List0::in, List::out ) is det :-
- (
- apply_widening( ModuleInfo, ProcInfo, Alias0,
- Alias),
- add_subsuming(ProcInfo, ModuleInfo, Alias,
- List0, List )
- ),
- AliasList0,
- [],
- AliasList ).
-
-
Index: pa_alias_as.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/pa_alias_as.m,v
retrieving revision 1.1.2.13
diff -u -r1.1.2.13 pa_alias_as.m
--- pa_alias_as.m 2001/03/08 18:27:01 1.1.2.13
+++ pa_alias_as.m 2001/03/15 12:57:55
@@ -35,21 +35,21 @@
%-- exported predicates
-:- pred init( alias_as::out ) is det.
-:- pred is_bottom( alias_as::in ) is semidet.
+:- pred init(alias_as::out) is det.
+:- pred is_bottom(alias_as::in) is semidet.
-:- pred top( string::in, alias_as::out ) is det.
-:- pred top( alias_as::in, string::in, alias_as::out) is det.
-:- pred is_top( alias_as::in ) is semidet.
+:- pred top(string::in, alias_as::out) is det.
+:- pred top(alias_as::in, string::in, alias_as::out) is det.
+:- pred is_top(alias_as::in) is semidet.
% project alias abstract substitution on a list of variables.
% (for each alias in alias_as, the variables involved will belong
% to the given list of prog_var).
-:- pred project( list(prog_var), alias_as, alias_as).
-:- mode project( in, in, out ) is det.
+:- pred project(list(prog_var), alias_as, alias_as).
+:- mode project(in, in, out) is det.
-:- pred project_set( set(prog_var), alias_as, alias_as).
-:- mode project_set( in, in, out ) is det.
+:- pred project_set(set(prog_var), alias_as, alias_as).
+:- mode project_set(in, in, out) is det.
% Collect all the datastructures to which the datastructure
% is aliased, taking into account possible termshifting.
@@ -60,27 +60,27 @@
:- mode collect_aliases_of_datastruct(in, in, in, in, out) is det.
% rename abstract substitution according to a mapping
- % of prog_vars (map (FROM_VARS, TO_VARS) ).
-:- pred rename( map(prog_var, prog_var), alias_as, alias_as).
-:- mode rename( in, in, out ) is det.
+ % of prog_vars (map (FROM_VARS, TO_VARS)).
+:- pred rename(map(prog_var, prog_var), alias_as, alias_as).
+:- mode rename(in, in, out) is det.
- % rename_types( FromTypes, ToTypes, Alias0, Alias).
+ % rename_types(FromTypes, ToTypes, Alias0, Alias).
% Rename all the typevariables occurring in the aliases using the
% mapping from FromTypes to ToTypes.
-:- pred rename_types( list( (type) )::in, list( (type) )::in,
- alias_as::in, alias_as::out ) is det.
- % rename_types( Substitution, Alias0, Alias).
+:- pred rename_types(list((type))::in, list((type))::in,
+ alias_as::in, alias_as::out) is det.
+ % rename_types(Substitution, Alias0, Alias).
% Rename all the type-variables occurring in the aliases using the
% substitution mapping.
-:- pred rename_types( term__substitution( tvar_type )::in,
- alias_as::in, alias_as::out ) is det.
+:- pred rename_types(term__substitution(tvar_type)::in,
+ alias_as::in, alias_as::out) is det.
% returns true if both abstract substitutions are equal.
% needed for fixpoint
-:- pred equal( alias_as, alias_as).
-:- mode equal( in, in) is semidet.
+:- pred equal(alias_as, alias_as).
+:- mode equal(in, in) is semidet.
- % less_or_equal( ModuleInfo, ProcInfo, AliasAs1, AliasAs2 ).
+ % less_or_equal(ModuleInfo, ProcInfo, AliasAs1, AliasAs2).
% first abstract subst. is less than or equal to second
% abstract subst. (for fixpoint). i.e. The first abstract
% substitution expresses less than the second one: for each
@@ -88,36 +88,36 @@
% Alias2 from AliasAs2 such that Alias1 is tighter than
% Alias2. And there are no aliases from AliasAs2 which are not
% greater than any of the aliases from AliasAs1.
-:- pred less_or_equal( module_info, proc_info, alias_as, alias_as).
-:- mode less_or_equal( in, in, in, in) is semidet.
+:- pred less_or_equal(module_info, proc_info, alias_as, alias_as).
+:- mode less_or_equal(in, in, in, in) is semidet.
% compute least upper bound.
-:- pred least_upper_bound( proc_info, module_info,
+:- pred least_upper_bound(proc_info, module_info,
alias_as, alias_as, alias_as).
-:- mode least_upper_bound( in, in, in, in, out) is det.
+:- mode least_upper_bound(in, in, in, in, out) is det.
% compute least upper bound of a list of abstract substitutions.
-:- pred least_upper_bound_list( proc_info, module_info, hlds_goal_info,
+:- pred least_upper_bound_list(proc_info, module_info, hlds_goal_info,
list(alias_as), alias_as).
-:- mode least_upper_bound_list( in, in, in, in, out) is det.
+:- mode least_upper_bound_list(in, in, in, in, out) is det.
- % extend( ProcInfo, ModuleInfo, NEW, OLD, RESULT).
+ % extend(ProcInfo, ModuleInfo, NEW, OLD, RESULT).
% extend a given abstract substitution with new information.
% NB: the order is _very_ important! The first alias-set is
% the (new) one to be added to the second one (cumulating one).
-:- pred extend( proc_info, module_info, alias_as, alias_as, alias_as).
-:- mode extend( in, in, in, in, out) is det.
+:- pred extend(proc_info, module_info, alias_as, alias_as, alias_as).
+:- mode extend(in, in, in, in, out) is det.
% specialized extend for unifications
-:- pred extend_unification( proc_info, module_info,
+:- pred extend_unification(proc_info, module_info,
hlds_goal__unification,
hlds_goal__hlds_goal_info, alias_as, alias_as).
-:- mode extend_unification( in, in, in, in, in, out) is det.
+:- mode extend_unification(in, in, in, in, in, out) is det.
-:- pred extend_foreign_code( proc_info, module_info, hlds_goal_info,
+:- pred extend_foreign_code(proc_info, module_info, hlds_goal_info,
list(prog_var), list(maybe(pair(string, mode))),
list(type), alias_as, alias_as).
-:- mode extend_foreign_code( in, in, in, in, in, in, in, out) is det.
+:- mode extend_foreign_code(in, in, in, in, in, in, in, out) is det.
% Add two abstract substitutions to each other. These
% abstract substitutions come from different contexts, and have
@@ -127,33 +127,33 @@
% normalization of the representation based on the types of
% the variables (retreived from proc_info) and the instmaps.
-:- pred normalize( hlds_pred__proc_info, module_info, instmap, alias_as, alias_as).
-:- mode normalize( in, in, in, in, out ) is det.
+:- pred normalize(hlds_pred__proc_info, module_info, instmap, alias_as, alias_as).
+:- mode normalize(in, in, in, in, out) is det.
% print-procedures:
% print_maybe_possible_aliases: routine used within
% hlds_dumps.
-:- pred print_maybe_possible_aliases( maybe(alias_as), proc_info, pred_info,
+:- pred print_maybe_possible_aliases(maybe(alias_as), proc_info, pred_info,
io__state, io__state).
-:- mode print_maybe_possible_aliases( in, in, in, di, uo) is det.
+:- mode print_maybe_possible_aliases(in, in, in, di, uo) is det.
% print_maybe_interface_aliases: routine for printing
% alias information in interface files.
-:- pred print_maybe_interface_aliases( maybe(alias_as),
+:- pred print_maybe_interface_aliases(maybe(alias_as),
proc_info, pred_info, io__state, io__state).
-:- mode print_maybe_interface_aliases( in, in, in, di, uo) is det.
+:- mode print_maybe_interface_aliases(in, in, in, di, uo) is det.
-:- pred print_aliases( alias_as, proc_info, pred_info, io__state, io__state).
-:- mode print_aliases( in, in, in, di, uo) is det.
+:- pred print_aliases(alias_as, proc_info, pred_info, io__state, io__state).
+:- mode print_aliases(in, in, in, di, uo) is det.
% reverse routine of print_maybe_interface_aliases.
:- pred parse_read_aliases(list(term(T)), alias_as).
:- mode parse_read_aliases(in,out) is det.
-:- pred parse_read_aliases_from_single_term( term(T), alias_as).
-:- mode parse_read_aliases_from_single_term( in, out) is det.
+:- pred parse_read_aliases_from_single_term(term(T), alias_as).
+:- mode parse_read_aliases_from_single_term(in, out) is det.
% Live = live(IN_USE,LIVE_0,ALIASES).
% compute the live-set based upon an initial IN_USE set,
@@ -166,8 +166,8 @@
set(prog_var),live_set, alias_as) = sr_live__live_set.
:- mode live(in, in, in,in, in) = out is det.
-:- func size( alias_as ) = int.
-:- mode size( in ) = out is det.
+:- func size(alias_as) = int.
+:- mode size(in) = out is det.
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
@@ -184,7 +184,7 @@
%-- type definitions
:- type alias_as --->
- real_as( alias_set )
+ real_as(alias_set)
; bottom
; top(list(string)).
% where list(alias) contains no doubles!
@@ -205,14 +205,14 @@
% is_bottom
is_bottom(bottom).
-is_bottom(real_as(AliasSet) ):- pa_alias_set__is_empty(AliasSet).
+is_bottom(real_as(AliasSet)):- pa_alias_set__is_empty(AliasSet).
% top
-top( Msg, top([NewMsg]) ):-
+top(Msg, top([NewMsg])):-
% string__append_list(["- ",Msg," -"],NewMsg).
NewMsg = Msg.
-top( Alias, Msg, top(Msgs)):-
+top(Alias, Msg, top(Msgs)):-
(
Alias = top(FirstMsgs)
->
@@ -222,7 +222,7 @@
).
:- pred top_merge(alias_as::in, alias_as::in, alias_as::out) is det.
-top_merge( A0, A1, A ) :-
+top_merge(A0, A1, A) :-
(
A0 = top(Msgs0),
A1 = top(Msgs1)
@@ -236,36 +236,36 @@
).
% is_top
-is_top( top(_) ).
+is_top(top(_)).
-size( bottom ) = 0.
-size( top(_) ) = 999999.
-size( real_as( AliasSet ) ) = L :-
+size(bottom) = 0.
+size(top(_)) = 999999.
+size(real_as(AliasSet)) = L :-
pa_alias_set__get_size(AliasSet, L).
% project
-project( Listvar, ASin , ASout):-
+project(Listvar, ASin , ASout):-
(
ASin = real_as(AliasSet0)
->
- pa_alias_set__project( Listvar, AliasSet0, AliasSet),
- wrap( AliasSet, ASout)
+ pa_alias_set__project(Listvar, AliasSet0, AliasSet),
+ wrap(AliasSet, ASout)
;
% ASin is bottom or top(_)
ASout = ASin
).
-project_set( SetVar, ASin, ASout ):-
- set__to_sorted_list( SetVar, ListVar),
- project( ListVar, ASin, ASout).
+project_set(SetVar, ASin, ASout):-
+ set__to_sorted_list(SetVar, ListVar),
+ project(ListVar, ASin, ASout).
-collect_aliases_of_datastruct( ModuleInfo, ProcInfo, Datastruct, AS,
- AliasList ):-
+collect_aliases_of_datastruct(ModuleInfo, ProcInfo, Datastruct, AS,
+ AliasList):-
(
AS = real_as(AliasSet)
->
- pa_alias_set__collect_aliases_of_datastruct( ModuleInfo,
- ProcInfo, Datastruct, AliasSet, AliasList )
+ pa_alias_set__collect_aliases_of_datastruct(ModuleInfo,
+ ProcInfo, Datastruct, AliasSet, AliasList)
;
is_bottom(AS)
->
@@ -277,68 +277,68 @@
-rename( MapVar, ASin, ASout ):-
+rename(MapVar, ASin, ASout):-
(
ASin = real_as(Aliases)
->
- pa_alias_set__rename( MapVar, Aliases, RAliases),
+ pa_alias_set__rename(MapVar, Aliases, RAliases),
wrap(RAliases, ASout)
;
% ASin is bottom or top(_)
ASout = ASin
).
-rename_types( FromTypes, ToTypes, ASin, ASout ) :-
- assoc_list__from_corresponding_lists( FromTypes, ToTypes,
- FromToTypes ),
- list__foldl( rename_type_det, FromToTypes,
+rename_types(FromTypes, ToTypes, ASin, ASout) :-
+ assoc_list__from_corresponding_lists(FromTypes, ToTypes,
+ FromToTypes),
+ list__foldl(rename_type_det, FromToTypes,
map__init, Substitution),
- rename_types( Substitution, ASin, ASout ).
+ rename_types(Substitution, ASin, ASout).
-rename_types( Substitution, A0, A) :-
+rename_types(Substitution, A0, A) :-
(
- A0 = real_as( AliasSet0 )
+ A0 = real_as(AliasSet0)
->
- pa_alias_set__rename_types( Substitution, AliasSet0,
- AliasSet ),
- A = real_as( AliasSet)
+ pa_alias_set__rename_types(Substitution, AliasSet0,
+ AliasSet),
+ A = real_as(AliasSet)
;
A = A0
).
-equal( AS1, AS2 ):-
+equal(AS1, AS2):-
(
AS1 = real_as(AliasSet1),
AS2 = real_as(AliasSet2),
- pa_alias_set__equal( AliasSet1, AliasSet2 )
+ pa_alias_set__equal(AliasSet1, AliasSet2)
;
% AS1 is bottom or top(_)
- ( AS1 = bottom, AS2 = bottom)
+ (AS1 = bottom, AS2 = bottom)
;
- ( is_top(AS1), is_top(AS2) )
+ (is_top(AS1), is_top(AS2))
).
-less_or_equal( ModuleInfo, ProcInfo, AS1, AS2 ):-
+less_or_equal(ModuleInfo, ProcInfo, AS1, AS2):-
(
AS1 = real_as(AliasSet1),
AS2 = real_as(AliasSet2),
- pa_alias_set__less_or_equal( ModuleInfo, ProcInfo,
- AliasSet1, AliasSet2 )
+ pa_alias_set__less_or_equal(ModuleInfo, ProcInfo,
+ AliasSet1, AliasSet2)
;
- ( AS1 = bottom ; AS2 = top(_) )
+ (AS1 = bottom ; AS2 = top(_))
).
-least_upper_bound( ProcInfo, HLDS, AS1, AS2, RESULT) :-
- (
+least_upper_bound(ProcInfo, HLDS, AS1, AS2, RESULT) :-
+ (
AS1 = real_as(AliasSet1)
->
(
AS2 = real_as(AliasSet2)
->
- pa_alias_set__least_upper_bound( HLDS, ProcInfo,
- AliasSet1, AliasSet2, AliasSet ),
- wrap_and_control( HLDS, ProcInfo, AliasSet, RESULT)
+ pa_alias_set__least_upper_bound(HLDS, ProcInfo,
+ AliasSet1, AliasSet2, AliasSet),
+ wrap_and_control(HLDS, ProcInfo, AliasSet, RESULT)
;
AS2 = top(_)
->
@@ -353,7 +353,7 @@
(
AS2 = top(_)
->
- top_merge( AS1, AS2, RESULT)
+ top_merge(AS1, AS2, RESULT)
;
RESULT = AS1
)
@@ -362,11 +362,11 @@
RESULT = AS2
).
-least_upper_bound_list( ProcInfo, HLDS, _GoalInfo, Alias_list0, AS ) :-
+least_upper_bound_list(ProcInfo, HLDS, _GoalInfo, Alias_list0, AS) :-
list__foldl(least_upper_bound(ProcInfo, HLDS) , Alias_list0,
bottom, AS).
-extend(ProcInfo, HLDS, A1, A2, RESULT ):-
+extend(ProcInfo, HLDS, A1, A2, RESULT):-
(
A1 = real_as(NEW)
->
@@ -400,15 +400,15 @@
RESULT = A2
).
-add( AS1, AS2, AS ) :-
+add(AS1, AS2, AS) :-
(
- AS1 = real_as( AliasSet1)
+ AS1 = real_as(AliasSet1)
->
(
- AS2 = real_as( AliasSet2 )
+ AS2 = real_as(AliasSet2)
->
- pa_alias_set__add( AliasSet1, AliasSet2, AliasSet),
- AS = real_as( AliasSet )
+ pa_alias_set__add(AliasSet1, AliasSet2, AliasSet),
+ AS = real_as(AliasSet)
;
AS2 = bottom
->
@@ -427,38 +427,38 @@
%-----------------------------------------------------------------------------%
-extend_unification( ProcInfo, HLDS, Unif, GoalInfo, ASin, ASout ):-
- pa_alias__from_unification( ProcInfo, HLDS, Unif, GoalInfo, AUnif),
- pa_alias_set__from_pair_alias_list( AUnif, AliasSetUnif ),
+extend_unification(ProcInfo, HLDS, Unif, GoalInfo, ASin, ASout):-
+ pa_alias__from_unification(ProcInfo, HLDS, Unif, GoalInfo, AUnif),
+ pa_alias_set__from_pair_alias_list(AUnif, AliasSetUnif),
wrap(AliasSetUnif, ASUnif),
- extend( ProcInfo, HLDS, ASUnif, ASin, ASout0),
+ extend(ProcInfo, HLDS, ASUnif, ASin, ASout0),
(
Unif = construct(_, _, _, _, _, _, _)
->
- optimization_remove_deaths( ProcInfo, ASout0, GoalInfo, ASout)
+ optimization_remove_deaths(ProcInfo, ASout0, GoalInfo, ASout)
;
ASout = ASout0
).
-:- pred optimization_remove_deaths( proc_info, alias_as,
+:- pred optimization_remove_deaths(proc_info, alias_as,
hlds_goal_info, alias_as).
-:- mode optimization_remove_deaths( in, in, in, out) is det.
+:- mode optimization_remove_deaths(in, in, in, out) is det.
-optimization_remove_deaths( ProcInfo, ASin, GI, ASout ) :-
- proc_info_headvars( ProcInfo, HeadVars ),
- set__list_to_set( HeadVars, HeadVarsSet),
- hlds_goal__goal_info_get_post_deaths( GI, Deaths0),
- set__difference( Deaths0, HeadVarsSet, Deaths),
- set__to_sorted_list( Deaths, DeathsList),
+optimization_remove_deaths(ProcInfo, ASin, GI, ASout) :-
+ proc_info_headvars(ProcInfo, HeadVars),
+ set__list_to_set(HeadVars, HeadVarsSet),
+ hlds_goal__goal_info_get_post_deaths(GI, Deaths0),
+ set__difference(Deaths0, HeadVarsSet, Deaths),
+ set__to_sorted_list(Deaths, DeathsList),
(
- ASin = real_as( Aliases0)
+ ASin = real_as(Aliases0)
->
(
DeathsList = []
->
ASout = ASin
;
- pa_alias_set__remove_vars( DeathsList, Aliases0,
+ pa_alias_set__remove_vars(DeathsList, Aliases0,
Aliases),
wrap(Aliases, ASout)
)
@@ -468,14 +468,14 @@
%-----------------------------------------------------------------------------%
-extend_foreign_code( _ProcInfo, HLDS, GoalInfo,
+extend_foreign_code(_ProcInfo, HLDS, GoalInfo,
Vars, MaybeModes, Types, Alias0, Alias):-
to_trios(Vars, MaybeModes, Types, Trios),
% remove all unique objects
- remove_all_unique_vars( HLDS, Trios, NonUniqueVars),
+ remove_all_unique_vars(HLDS, Trios, NonUniqueVars),
% keep only the output vars
- collect_all_output_vars( HLDS, NonUniqueVars, OutputVars),
-% collect_all_input_vars( HLDS, NonUniqueVars, InputVars),
+ collect_all_output_vars(HLDS, NonUniqueVars, OutputVars),
+% collect_all_input_vars(HLDS, NonUniqueVars, InputVars),
(
% (
OutputVars = []
@@ -487,14 +487,14 @@
Alias = Alias0
;
list__map(
- pred( Trio::in, Type::out ) is det:-
+ pred(Trio::in, Type::out) is det:-
(
Trio = trio(_, _, Type)
),
OutputVars,
OutputTypes),
(
- types_are_primitive( HLDS, OutputTypes)
+ types_are_primitive(HLDS, OutputTypes)
->
Alias = Alias0
;
@@ -515,13 +515,13 @@
:- import_module std_util, inst_match.
-:- type trio ---> trio( prog_var, mode, type).
+:- type trio ---> trio(prog_var, mode, type).
-:- pred to_trios( list(prog_var), list(maybe(pair(string, mode))),
+:- pred to_trios(list(prog_var), list(maybe(pair(string, mode))),
list(type), list(trio)).
-:- mode to_trios( in, in, in, out) is det.
+:- mode to_trios(in, in, in, out) is det.
-to_trios( Vars, MaybeModes, Types, Trios ):-
+to_trios(Vars, MaybeModes, Types, Trios):-
(
Vars = [ V1 | VR ]
->
@@ -530,13 +530,13 @@
Types = [ T1 | TR ]
->
(
- M1 = yes( _String - Mode )
+ M1 = yes(_String - Mode)
->
- Trio1 = trio( V1, Mode, T1),
- to_trios( VR, MR, TR, TrioR),
+ Trio1 = trio(V1, Mode, T1),
+ to_trios(VR, MR, TR, TrioR),
Trios = [ Trio1 | TrioR ]
;
- to_trios( VR, MR, TR, Trios )
+ to_trios(VR, MR, TR, Trios)
)
;
require__error("(pa_run) to_trios: lists of different length.")
@@ -551,18 +551,18 @@
)
).
-:- pred collect_all_output_vars( module_info::in,
+:- pred collect_all_output_vars(module_info::in,
list(trio)::in, list(trio)::out) is det.
-:- pred remove_all_unique_vars( module_info::in,
+:- pred remove_all_unique_vars(module_info::in,
list(trio)::in, list(trio)::out) is det.
-:- pred collect_all_input_vars( module_info::in,
+:- pred collect_all_input_vars(module_info::in,
list(trio)::in, list(trio)::out) is det.
:- import_module mode_util.
-collect_all_output_vars( HLDS, VarsIN, VarsOUT):-
+collect_all_output_vars(HLDS, VarsIN, VarsOUT):-
list__filter(
- pred( P0::in ) is semidet :-
+ pred(P0::in) is semidet :-
(
P0 = trio(_, Mode, Type),
mode_to_arg_mode(HLDS, Mode, Type, ArgMode),
@@ -572,12 +572,12 @@
VarsOUT
).
-remove_all_unique_vars( HLDS, VarsIN, VarsOUT):-
+remove_all_unique_vars(HLDS, VarsIN, VarsOUT):-
list__filter(
- pred( P0::in ) is semidet :-
+ pred(P0::in) is semidet :-
(
P0 = trio(_, Mode, _),
- mode_util__mode_get_insts( HLDS, Mode, _LeftInst,
+ mode_util__mode_get_insts(HLDS, Mode, _LeftInst,
RightInst),
\+ inst_is_unique(HLDS, RightInst),
\+ inst_is_clobbered(HLDS, RightInst)
@@ -586,9 +586,9 @@
VarsOUT
).
-collect_all_input_vars( HLDS, VarsIN, VarsOUT):-
+collect_all_input_vars(HLDS, VarsIN, VarsOUT):-
list__filter(
- pred( P0::in ) is semidet :-
+ pred(P0::in) is semidet :-
(
P0 = trio(_, Mode, Type),
mode_to_arg_mode(HLDS, Mode, Type, ArgMode),
@@ -600,27 +600,27 @@
%-----------------------------------------------------------------------------%
-:- pred normalize_with_goal_info( proc_info::in, module_info::in,
+:- pred normalize_with_goal_info(proc_info::in, module_info::in,
hlds_goal_info::in, alias_as::in, alias_as::out) is det.
-normalize_with_goal_info( ProcInfo, HLDS, GoalInfo, Alias0, Alias):-
+normalize_with_goal_info(ProcInfo, HLDS, GoalInfo, Alias0, Alias):-
goal_info_get_instmap_delta(GoalInfo, InstMapDelta),
instmap__init_reachable(InitIM),
instmap__apply_instmap_delta(InitIM, InstMapDelta, InstMap),
- normalize( ProcInfo, HLDS, InstMap, Alias0, Alias).
+ normalize(ProcInfo, HLDS, InstMap, Alias0, Alias).
-normalize( ProcInfo, HLDS, _InstMap, Alias0, Alias):-
+normalize(ProcInfo, HLDS, _InstMap, Alias0, Alias):-
% normalize only using type-info's
- normalize_wti( ProcInfo, HLDS, Alias0, Alias).
+ normalize_wti(ProcInfo, HLDS, Alias0, Alias).
-:- pred normalize_wti( proc_info, module_info, alias_as, alias_as).
-:- mode normalize_wti( in, in, in, out) is det.
+:- pred normalize_wti(proc_info, module_info, alias_as, alias_as).
+:- mode normalize_wti(in, in, in, out) is det.
-normalize_wti( ProcInfo, HLDS, ASin, ASout ):-
+normalize_wti(ProcInfo, HLDS, ASin, ASout):-
(
ASin = real_as(Aliases0)
->
- pa_alias_set__normalize( HLDS, ProcInfo, Aliases0,
+ pa_alias_set__normalize(HLDS, ProcInfo, Aliases0,
Aliases),
wrap(Aliases, ASout)
;
@@ -632,46 +632,46 @@
% printing routines
%-------------------------------------------------------------------%
- % MaybeAs = yes( Alias_as) -> print out Alias_as
+ % MaybeAs = yes(Alias_as) -> print out Alias_as
% = no -> print "not available"
-print_maybe_possible_aliases( MaybeAS, ProcInfo, PredInfo ) -->
+print_maybe_possible_aliases(MaybeAS, ProcInfo, PredInfo) -->
(
{ MaybeAS = yes(AS) }
->
- print_possible_aliases( AS, ProcInfo, PredInfo)
+ print_possible_aliases(AS, ProcInfo, PredInfo)
;
io__write_string("% not available.")
).
- % print_possible_aliases( Abstract Substitution, Proc Info).
+ % print_possible_aliases(Abstract Substitution, Proc Info).
% print alias abstract substitution
-:- pred print_possible_aliases( alias_as, proc_info, pred_info,
+:- pred print_possible_aliases(alias_as, proc_info, pred_info,
io__state, io__state).
-:- mode print_possible_aliases( in, in, in, di, uo ) is det.
+:- mode print_possible_aliases(in, in, in, di, uo) is det.
-print_possible_aliases( AS, ProcInfo, PredInfo ) -->
+print_possible_aliases(AS, ProcInfo, PredInfo) -->
(
{ AS = real_as(Aliases) }
->
- pa_alias_set__print( PredInfo, ProcInfo, Aliases,
- "% ", "\n" )
+ pa_alias_set__print(PredInfo, ProcInfo, Aliases,
+ "% ", "\n")
;
{ AS = top(Msgs) }
->
- { list__map(
- pred( S0::in, S::out ) is det :-
+ { list__map(
+ pred(S0::in, S::out) is det :-
(string__append_list(["%\t",S0,"\n"], S)),
Msgs,
- MsgsF ) },
+ MsgsF) },
{ string__append_list(["% aliases are top:\n" |MsgsF],Msg) },
io__write_string(Msg)
;
io__write_string("% aliases = bottom")
).
- % MaybeAs = yes(Alias_as) -> print `yes( printed Alias_as)'
+ % MaybeAs = yes(Alias_as) -> print `yes(printed Alias_as)'
% = no -> print `not_available'
-print_maybe_interface_aliases( MaybeAS, ProcInfo, PredInfo ) -->
+print_maybe_interface_aliases(MaybeAS, ProcInfo, PredInfo) -->
(
{ MaybeAS = yes(AS) }
->
@@ -682,12 +682,12 @@
io__write_string("not_available")
).
-print_aliases( AS, ProcInfo, PredInfo ) -->
+print_aliases(AS, ProcInfo, PredInfo) -->
(
{ AS = real_as(Aliases) }
->
io__write_string("["),
- pa_alias_set__print( PredInfo, ProcInfo, Aliases,
+ pa_alias_set__print(PredInfo, ProcInfo, Aliases,
" ", ""),
io__write_string("]")
;
@@ -703,30 +703,30 @@
% parsing routines
%-------------------------------------------------------------------%
-parse_read_aliases( LISTTERM ,AS ):-
+parse_read_aliases(LISTTERM ,AS):-
(
% LISTTERM ought to have only one element
LISTTERM = [ OneITEM ]
->
- parse_read_aliases_from_single_term( OneITEM, AS)
+ parse_read_aliases_from_single_term(OneITEM, AS)
;
- list__length( LISTTERM, L ),
+ list__length(LISTTERM, L),
string__int_to_string(L, LS),
- string__append_list( ["(pa_alias_as) parse_read_aliases: wrong number of arguments. yes/", LS,
+ string__append_list(["(pa_alias_as) parse_read_aliases: wrong number of arguments. yes/", LS,
" should be yes/1"], Msg),
error(Msg)
).
-parse_read_aliases_from_single_term( OneITEM, AS ) :-
+parse_read_aliases_from_single_term(OneITEM, AS) :-
(
- OneITEM = term__functor( term__atom(CONS), _TERMS, Context )
+ OneITEM = term__functor(term__atom(CONS), _TERMS, Context)
->
(
CONS = "."
->
- parse_list_alias_term( OneITEM, Aliases),
- pa_alias_set__from_pair_alias_list( Aliases,
- AliasSet ),
+ parse_list_alias_term(OneITEM, Aliases),
+ pa_alias_set__from_pair_alias_list(Aliases,
+ AliasSet),
wrap(AliasSet, AS)
% AS = bottom
;
@@ -754,19 +754,19 @@
).
-:- pred parse_list_alias_term( term(T), list(pa_alias__alias)).
-:- mode parse_list_alias_term( in, out ) is det.
+:- pred parse_list_alias_term(term(T), list(pa_alias__alias)).
+:- mode parse_list_alias_term(in, out) is det.
-parse_list_alias_term( TERM, Aliases ) :-
+parse_list_alias_term(TERM, Aliases) :-
(
- TERM = term__functor( term__atom( CONS), Args, _)
+ TERM = term__functor(term__atom(CONS), Args, _)
->
(
CONS = ".",
Args = [ AliasTerm, Rest]
->
- pa_alias__parse_term( AliasTerm, Alias ),
- parse_list_alias_term( Rest, RestAliases),
+ pa_alias__parse_term(AliasTerm, Alias),
+ parse_list_alias_term(Rest, RestAliases),
Aliases = [ Alias | RestAliases ]
;
CONS = "[]"
@@ -778,15 +778,15 @@
)
;
error("(pa_alias_as) parse_list_alias_term: term is not a functor")
- ).
+ ).
-:- pred wrap( pa_alias_set__alias_set, alias_as).
-:- mode wrap( in, out) is det.
+:- pred wrap(pa_alias_set__alias_set, alias_as).
+:- mode wrap(in, out) is det.
-wrap( AliasSet, AS) :-
+wrap(AliasSet, AS) :-
(
- pa_alias_set__get_size( AliasSet, 0 )
+ pa_alias_set__get_size(AliasSet, 0)
->
AS = bottom
;
@@ -798,11 +798,11 @@
AS = real_as(AliasSet)
).
-:- pred wrap_and_control( module_info::in, proc_info::in,
+:- pred wrap_and_control(module_info::in, proc_info::in,
alias_set::in, alias_as::out) is det.
-wrap_and_control( _ModuleInfo, _ProcInfo, AliasSet, AS ):-
- wrap( AliasSet, AS ).
+wrap_and_control(_ModuleInfo, _ProcInfo, AliasSet, AS):-
+ wrap(AliasSet, AS).
/**
(
AliasList = []
@@ -812,11 +812,11 @@
list__length(AliasList,Length),
Length > top_limit
->
- pa_alias__apply_widening_list( ModuleInfo, ProcInfo,
- AliasList, AliasList1 ),
- AS = real_as( AliasList1 )
+ pa_alias__apply_widening_list(ModuleInfo, ProcInfo,
+ AliasList, AliasList1),
+ AS = real_as(AliasList1)
;
- AS = real_as( AliasList )
+ AS = real_as(AliasList)
).
**/
@@ -849,7 +849,7 @@
% most general case
AS = real_as(AliasSet)
->
- pa_alias_set__to_pair_alias_list( AliasSet, Aliases),
+ pa_alias_set__to_pair_alias_list(AliasSet, Aliases),
live_2(ModuleInfo, ProcInfo, IN_USE, LIVE_0, Aliases, LIVE)
;
error("(pa_alias_as) live: impossible situation.")
@@ -862,7 +862,7 @@
list(pa_alias__alias), sr_live__live_set).
:- mode live_2(in, in, in, in, in, out) is det.
-live_2( ModuleInfo, ProcInfo, IN_USE, LIVE_0, ALIASES, LIVE) :-
+live_2(ModuleInfo, ProcInfo, IN_USE, LIVE_0, ALIASES, LIVE) :-
% LIVE = LIVE0 + LIVE1 + LIVE2 + LIVE3
% where
% LIVE0 = LIVE_0
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list