static_activation_dependence(OpName1,OpName2,Res) :-
static_activation_dependence_cache(OpName1,OpName2,Cached),!,
Res=Cached.
static_activation_dependence(OpName1,OpName2,Res) :-
b_top_level_operation(OpName1),
b_get_read_write(OpName1,_,Writes1),
b_top_level_operation(OpName2),
b_get_operation_read_guard_vars(OpName2,true,GuardReads2,Precise),
(vars_ord_intersect(Writes1,GuardReads2)
-> Cached = dependent % OpName1 could enable or disable OpName2
; %print(indep(OpName1,Writes1,OpName2,GuardReads2)),nl,
b_get_read_write(OpName2,Reads2,_Writes2),
(vars_ord_intersect(Writes1,Reads2)
-> (Precise==precise
-> Cached = activation_independent % OpName1 cannot enable or disable OpName2, but can influence effect
; Cached = dependent % Computation of GuardReads2 was not precise (while loops, ... in operation)
)
; Cached = independent % but order could still matter; for this we would need to look at Writes2
)
),
debug_format(19,'Computed static dependence ~w -> ~w : ~w~n',[OpName1,OpName2,Cached]),
assertz(static_activation_dependence_cache(OpName1,OpName2,Cached)),
Res=Cached.