@@ -441,8 +441,8 @@ type last =
441441
442442type block =
443443 { params : Var .t list
444- ; body : ( instr * loc ) list
445- ; branch : last * loc
444+ ; body : instr list
445+ ; branch : last
446446 }
447447
448448type program =
@@ -575,7 +575,7 @@ module Print = struct
575575 | Prim (p , l ) -> prim f p l
576576 | Special s -> special f s
577577
578- let instr f ( i , _loc ) =
578+ let instr f i =
579579 match i with
580580 | Let (x , e ) -> Format. fprintf f " %a = %a" Var. print x expr e
581581 | Assign (x , y ) -> Format. fprintf f " (assign) %a = %a" Var. print x Var. print y
@@ -588,7 +588,7 @@ module Print = struct
588588 Format. fprintf f " %a[%a] = %a" Var. print x Var. print y Var. print z
589589 | Event loc -> Format. fprintf f " event %s" (Parse_info. to_string loc)
590590
591- let last f ( l , _loc ) =
591+ let last f l =
592592 match l with
593593 | Return x -> Format. fprintf f " return %a" Var. print x
594594 | Raise (x , `Normal) -> Format. fprintf f " raise %a" Var. print x
@@ -607,8 +607,8 @@ module Print = struct
607607 | Poptrap c -> Format. fprintf f " poptrap %a" cont c
608608
609609 type xinstr =
610- | Instr of ( instr * loc )
611- | Last of ( last * loc )
610+ | Instr of instr
611+ | Last of last
612612
613613 let block annot pc block =
614614 Format. eprintf " ==== %d (%a) ====@." pc var_list block.params;
627627let fold_closures p f accu =
628628 Addr.Map. fold
629629 (fun _ block accu ->
630- List. fold_left block.body ~init: accu ~f: (fun accu ( i , _loc ) ->
630+ List. fold_left block.body ~init: accu ~f: (fun accu i ->
631631 match i with
632632 | Let (x , Closure (params , cont )) -> f (Some x) params cont accu
633633 | _ -> accu))
@@ -648,12 +648,12 @@ let prepend ({ start; blocks; free_pc } as p) body =
648648 | exception Not_found ->
649649 let new_start = free_pc in
650650 let blocks =
651- Addr.Map. add new_start { params = [] ; body; branch = Stop , noloc } blocks
651+ Addr.Map. add new_start { params = [] ; body; branch = Stop } blocks
652652 in
653653 let free_pc = free_pc + 1 in
654654 { start = new_start; blocks; free_pc })
655655
656- let empty_block = { params = [] ; body = [] ; branch = Stop , noloc }
656+ let empty_block = { params = [] ; body = [] ; branch = Stop }
657657
658658let empty =
659659 let start = 0 in
@@ -666,10 +666,9 @@ let is_empty p =
666666 | 1 -> (
667667 let _, v = Addr.Map. choose p.blocks in
668668 match v with
669- | { body; branch = Stop , _ ; params = _ } -> (
669+ | { body; branch = Stop ; params = _ } -> (
670670 match body with
671- | ([] | [ (Let (_, Prim (Extern " caml_get_global_data" , _)), _) ]) when true ->
672- true
671+ | ([] | [ Let (_, Prim (Extern " caml_get_global_data" , _)) ]) when true -> true
673672 | _ -> false )
674673 | _ -> false )
675674 | _ -> false
@@ -681,7 +680,7 @@ let poptraps blocks pc =
681680 else
682681 let visited = Addr.Set. add pc visited in
683682 let block = Addr.Map. find pc blocks in
684- match fst block.branch with
683+ match block.branch with
685684 | Return _ | Raise _ | Stop -> acc, visited
686685 | Branch (pc' , _ ) -> loop blocks pc' visited depth acc
687686 | Poptrap (pc' , _ ) ->
@@ -709,7 +708,7 @@ let poptraps blocks pc =
709708
710709let fold_children blocks pc f accu =
711710 let block = Addr.Map. find pc blocks in
712- match fst block.branch with
711+ match block.branch with
713712 | Return _ | Raise _ | Stop -> accu
714713 | Branch (pc' , _ ) | Poptrap (pc' , _ ) -> f pc' accu
715714 | Pushtrap ((pc' , _ ), _ , (pc_h , _ )) ->
@@ -726,7 +725,7 @@ let fold_children blocks pc f accu =
726725
727726let fold_children_skip_try_body blocks pc f accu =
728727 let block = Addr.Map. find pc blocks in
729- match fst block.branch with
728+ match block.branch with
730729 | Return _ | Raise _ | Stop -> accu
731730 | Branch (pc' , _ ) | Poptrap (pc' , _ ) -> f pc' accu
732731 | Pushtrap ((pc' , _ ), _ , (pc_h , _ )) ->
@@ -789,7 +788,7 @@ let fold_closures_innermost_first { start; blocks; _ } f accu =
789788 let block = Addr.Map. find pc blocks in
790789 List. fold_left block.body ~init: accu ~f: (fun accu i ->
791790 match i with
792- | Let (x , Closure (params , cont )), _ ->
791+ | Let (x , Closure (params , cont )) ->
793792 let accu = visit blocks (fst cont) f accu in
794793 f (Some x) params cont accu
795794 | _ -> accu))
@@ -808,7 +807,7 @@ let fold_closures_outermost_first { start; blocks; _ } f accu =
808807 let block = Addr.Map. find pc blocks in
809808 List. fold_left block.body ~init: accu ~f: (fun accu i ->
810809 match i with
811- | Let (x , Closure (params , cont )), _ ->
810+ | Let (x , Closure (params , cont )) ->
812811 let accu = f (Some x) params cont accu in
813812 visit blocks (fst cont) f accu
814813 | _ -> accu))
@@ -879,7 +878,7 @@ let invariant { blocks; start; _ } =
879878 | Prim (_ , args ) -> List. iter ~f: check_prim_arg args
880879 | Special _ -> ()
881880 in
882- let check_instr ( i , _loc ) =
881+ let check_instr i =
883882 match i with
884883 | Let (x , e ) ->
885884 define x;
@@ -892,11 +891,11 @@ let invariant { blocks; start; _ } =
892891 in
893892 let rec check_events l =
894893 match l with
895- | ( Event _ , _ ) :: ( Event _ , _ ) :: _ -> assert false
894+ | Event _ :: Event _ :: _ -> assert false
896895 | _ :: r -> check_events r
897896 | [] -> ()
898897 in
899- let check_last ( l , _loc ) =
898+ let check_last l =
900899 match l with
901900 | Return _ -> ()
902901 | Raise _ -> ()
0 commit comments