let compute_postdom kf =
let return =
try Kernel_function.find_return kf
with Kernel_function.No_Statement ->
Postdominators_parameters.abort
"No return statement for a function with body %a"
Kernel_function.pretty kf
in
try
let _ = PostDom.find return in
Postdominators_parameters.feedback ~level:2 "computed for function %a"
Kernel_function.pretty kf
with Not_found ->
Postdominators_parameters.feedback ~level:2 "computing for function %a"
Kernel_function.pretty kf;
let f = kf.fundec in
let stmts = match f with
| Definition (f,_) -> f.sallstmts
| Declaration _ ->
Postdominators_parameters.fatal
"cannot compute postdominators for leaf function %a"
Kernel_function.pretty kf
in
List.iter (fun s -> PostDom.add s DomSet.Top) stmts;
PostCompute.compute [return];
Postdominators_parameters.feedback ~level:2 "done for function %a"
Kernel_function.pretty kf