let get_address_of f =
let size = Array.length f in
let max_temp_id = ref 0 in
let address_of_variable = Hashtbl.create 32 in
let rec visit_statement i =
match i.il1_t with
IL1stmtDefTemp( n, _, e ) ->
visit_expression e;
if n > !max_temp_id then
max_temp_id := n
| IL1stmtReadToTemp( n, _, _, _ ) ->
if n > !max_temp_id then
max_temp_id := n
| IL1stmtWrite( ILlvTemp n, _, _ ) ->
if n > !max_temp_id then
max_temp_id := n
| IL1stmtSequence l -> List.iter visit_statement l
| IL1stmtParallel l -> List.iter visit_statement l
| _ -> ()
and visit_expression = function
ILexpAddress( ILlvVar( s, _ ), _ ) -> Hashtbl.add address_of_variable s ()
| _ -> ()
in
for i = 0 to size - 1 do
List.iter visit_statement f.(i).code
done;
address_of_variable, !max_temp_id