Commit b5d92fc7 authored by John van Groningen's avatar John van Groningen
Browse files

during fusion, mark unused producer (PR_Unsed) expressions and variables with...

during fusion, mark unused producer (PR_Unsed) expressions and variables with VI_NotUsed and ExprToBeRemoved
parent 5c4d5079
......@@ -493,6 +493,8 @@ instance consumerRequirements Expression where
= init_variables dictionaries (inc ai_next_var) (inc ai_next_var_of_fun) ai_var_heap
init_variables [] ai_next_var ai_next_var_of_fun ai_var_heap
= (ai_next_var,ai_next_var_of_fun,ai_var_heap)
consumerRequirements ExprToBeRemoved _ ai
= (CPassive, False, ai)
consumerRequirements expr _ ai
= abort ("consumerRequirements [Expression]" ---> expr)
......@@ -1490,6 +1492,8 @@ count_locals (DictionariesFunction dictionaries expr expr_type) n
| fv_count > 0
= n+1
= n
count_locals ExprToBeRemoved n
= n
count_optional_locals (Yes e) n
= count_locals e n
......
......@@ -161,6 +161,12 @@ where
# (mark, fun_defs, pi) = partitionate_function fc_index max_fun_nr fun_defs pi
= visit_functions funs (min min_dep mark) max_fun_nr fun_defs pi
= visit_functions funs (min min_dep mark) max_fun_nr fun_defs pi
visit_functions [GeneratedFunCall fc_index _:funs] min_dep max_fun_nr fun_defs pi=:{pi_marks`}
#! mark = pi_marks`.[fc_index]
| mark == NotChecked
# (mark, fun_defs, pi) = partitionate_function fc_index max_fun_nr fun_defs pi
= visit_functions funs (min min_dep mark) max_fun_nr fun_defs pi
= visit_functions funs (min min_dep mark) max_fun_nr fun_defs pi
visit_functions [DclFunCall module_index fc_index:funs] min_dep max_fun_nr fun_defs pi
= visit_functions funs min_dep max_fun_nr fun_defs pi
visit_functions [] min_dep max_fun_nr fun_defs pi
......@@ -439,6 +445,8 @@ where
= fc_state
find_calls fc_info (DictionariesFunction dictionaries expr expr_type) fc_state
= find_calls fc_info expr fc_state
find_calls fc_info ExprToBeRemoved fc_state
= fc_state
instance find_calls App
where
......
......@@ -1413,6 +1413,7 @@ cIsNotStrict :== False
| EE
| NoBind ExprInfoPtr /* auxiliary, to store fields that are not specified in a record expression */
| FailExpr !Ident // only allowed on (case) root positions
| ExprToBeRemoved
:: CodeBinding variable :== Env String variable
......
......@@ -410,6 +410,7 @@ where
(<<<) file (TypeSignature array_kind expr) = file <<< "TypeSignature " <<< '(' <<< expr <<< ')'
(<<<) file (DictionariesFunction dictionaries expr expr_type)
= file <<< "DictionariesFunction " <<< dictionaries <<< expr <<< expr_type
(<<<) file ExprToBeRemoved = file <<< "** ExprToBeRemoved **"
(<<<) file expr = abort ("<<< (Expression)" )
instance <<< LetBind
......
......@@ -2101,9 +2101,10 @@ determine_arg PR_Empty _ form=:{fv_ident,fv_info_ptr} _ ((linear_bit,cons_arg),
, das_new_cons_args = [cons_arg : das.das_new_cons_args]
, das_var_heap = das_var_heap }
determine_arg PR_Unused _ form prod_index (_,ro) das
determine_arg PR_Unused _ {fv_info_ptr} prod_index (_,ro) das=:{das_var_heap}
# das_var_heap = writeVarInfo fv_info_ptr VI_NotUsed das_var_heap
# no_arg_type = {ats_types = [], ats_strictness = NotStrict}
= {das & das_arg_types.[prod_index] = no_arg_type}
= {das & das_arg_types.[prod_index] = no_arg_type, das_var_heap=das_var_heap}
determine_arg (PR_Class class_app free_vars_and_types class_type) _ {fv_info_ptr} prod_index (_,ro)
das=:{das_arg_types, das_subst, das_type_heaps, das_predef}
......@@ -4520,6 +4521,8 @@ where
-> writeVarInfo var_info_ptr VI_Empty var_heap
VI_Body _ _ _ _ _
-> writeVarInfo var_info_ptr VI_Empty var_heap
VI_NotUsed
-> var_heap
instance clearVariables Expression
where
......@@ -5078,6 +5081,8 @@ copyVariable var=:{var_info_ptr} ci cs
-> copy_dictionary_variable app_symb app_args class_type ci cs
VI_ExpressionOrBody expr _ _ _ _ _
-> (expr, cs)
VI_NotUsed
-> (ExprToBeRemoved, cs)
_
-> (Var var, cs)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment