diff options
author | Bernhard Schommer <bernhardschommer@gmail.com> | 2015-09-30 12:43:49 +0200 |
---|---|---|
committer | Bernhard Schommer <bernhardschommer@gmail.com> | 2015-09-30 12:43:49 +0200 |
commit | ee76d81e0e7d8a76cd31bf0d01a532d248dca45a (patch) | |
tree | fdce17a2651794b76c7958ccdf2029bc3e6dcfff | |
parent | c0757aa180c54ff61093e8079ef58b77775ba28e (diff) | |
download | compcert-kvx-ee76d81e0e7d8a76cd31bf0d01a532d248dca45a.tar.gz compcert-kvx-ee76d81e0e7d8a76cd31bf0d01a532d248dca45a.zip |
Fixed minor issue with parameters that get put on the stack, made
the code more robust and added indentation for convertCompositeDef
-rw-r--r-- | cfrontend/C2C.ml | 10 | ||||
-rw-r--r-- | debug/DebugInformation.ml | 19 | ||||
-rw-r--r-- | powerpc/Asmexpand.ml | 6 |
3 files changed, 18 insertions, 17 deletions
diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml index 332665f4..bd281374 100644 --- a/cfrontend/C2C.ml +++ b/cfrontend/C2C.ml @@ -524,10 +524,12 @@ let convertField env f = (intern_string f.fld_name, convertTyp env f.fld_typ) let convertCompositedef env su id attr members = - let t = match su with C.Struct -> - let layout = Cutil.struct_layout env members in - List.iter (fun (a,b) -> Debug.set_member_offset id a b) layout; - TStruct (id,attr) | C.Union -> TUnion (id,attr) in + let t = match su with + | C.Struct -> + let layout = Cutil.struct_layout env members in + List.iter (fun (a,b) -> Debug.set_member_offset id a b) layout; + TStruct (id,attr) + | C.Union -> TUnion (id,attr) in Debug.set_composite_size id su (Cutil.sizeof env t); Composite(intern_string id.name, begin match su with C.Struct -> Struct | C.Union -> Union end, diff --git a/debug/DebugInformation.ml b/debug/DebugInformation.ml index 3bf26e53..382845a4 100644 --- a/debug/DebugInformation.ml +++ b/debug/DebugInformation.ml @@ -752,16 +752,13 @@ let close_scope atom s_id lbl = with Not_found -> () let start_live_range atom lbl loc = - let old_r = try - begin - match Hashtbl.find var_locations atom with - | RangeLoc old_r -> old_r - | _ -> assert false - end - with Not_found -> [] in - let n_r = { range_start = Some lbl; range_end = None; var_loc = loc } in - open_vars := atom::!open_vars; - Hashtbl.replace var_locations atom (RangeLoc (n_r::old_r)) + let old_r = begin try Hashtbl.find var_locations atom with Not_found -> (RangeLoc []) end in + match old_r with + | RangeLoc old_r -> + let n_r = { range_start = Some lbl; range_end = None; var_loc = loc } in + open_vars := atom::!open_vars; + Hashtbl.replace var_locations atom (RangeLoc (n_r::old_r)) + | _ -> () (* Parameter that is passed as variable *) let end_live_range atom lbl = try @@ -771,7 +768,7 @@ let end_live_range atom lbl = if n_r.range_end = None then (* We can skip non open locations *) let n_r = {n_r with range_end = Some lbl} in Hashtbl.replace var_locations atom (RangeLoc (n_r::old_r)) - | _ -> assert false + | _ -> () with Not_found -> () let stack_variable atom (sp,loc) = diff --git a/powerpc/Asmexpand.ml b/powerpc/Asmexpand.ml index 80aa333e..050380ae 100644 --- a/powerpc/Asmexpand.ml +++ b/powerpc/Asmexpand.ml @@ -615,7 +615,7 @@ let preg_to_dwarf_int = function | _ -> assert false -let translate_annot a = +let translate_annot annot = let rec aux = function | BA x -> Some (BA (preg_to_dwarf_int x)) | BA_int _ @@ -632,7 +632,9 @@ let translate_annot a = | Some hi ,Some lo -> Some (BA_splitlong (hi,lo)) | _,_ -> None end in - aux (List.hd a) + (match annot with + | [] -> None + | a::_ -> aux a) let expand_scope id lbl oldscopes newscopes = let opening = List.filter (fun a -> not (List.mem a oldscopes)) newscopes |