let rd_tmp_to_exp iosh sid vi fd nofrm =
if nofrm || (check_forms vi.vname forms)
then let ido = iosh_get_useful_def iosh vi in
match ido with None ->
if !debug then (Cilmsg.debug "tmp_to_exp: non-single def: %s"
vi.vname);
None
| Some(id) -> let defrhs = time "getDefRhs" getDefRhs id in
match defrhs with None ->
if !debug then
(Cilmsg.debug "tmp_to_exp: no def of %s" vi.vname);
None
| Some(RD.RDExp(e) as r, dsid , defiosh) ->
if time "ok_to_replace" (ok_to_replace vi iosh sid defiosh dsid fd) r
then
(if !debug then Cilmsg.debug "tmp_to_exp: changing %s to %a"
vi.vname d_plainexp e;
match e.enode with
| Const(CStr _)
| Const(CWStr _) -> None
| _ -> begin
rd_tmp_to_exp_change := true;
Some e
end)
else
(if !debug then (Cilmsg.debug "tmp_to_exp: not ok to replace %s" vi.vname);
None)
| _ ->
if !debug then (Cilmsg.debug "tmp_to_exp: rhs is call %s" vi.vname);
None
else
(if !debug then (Cilmsg.debug "tmp_to_exp: %s didn't match form or nofrm" vi.vname);
None)