aboutsummaryrefslogtreecommitdiffstats
path: root/debug/DebugInformation.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2015-09-25 21:12:48 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2015-09-25 21:12:48 +0200
commit3e070cae6a316b7e3363c8159096c3bbc4bf21b2 (patch)
tree18de89977f0b89d18922d54f3c600d09092d580b /debug/DebugInformation.ml
parentaff813685455559f6d6a88158dd3d605893ba3a3 (diff)
downloadcompcert-kvx-3e070cae6a316b7e3363c8159096c3bbc4bf21b2.tar.gz
compcert-kvx-3e070cae6a316b7e3363c8159096c3bbc4bf21b2.zip
Added translation of the range lists to location entries.
Diffstat (limited to 'debug/DebugInformation.ml')
-rw-r--r--debug/DebugInformation.ml32
1 files changed, 23 insertions, 9 deletions
diff --git a/debug/DebugInformation.ml b/debug/DebugInformation.ml
index 459c4e9d..ec16f64e 100644
--- a/debug/DebugInformation.ml
+++ b/debug/DebugInformation.ml
@@ -695,6 +695,7 @@ module IntSet = Set.Make(struct
end)
let open_scopes: IntSet.t ref = ref IntSet.empty
+let open_vars: atom list ref = ref []
let open_scope atom s_id lbl =
try
@@ -721,33 +722,46 @@ 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 end_live_range atom lbl =
try
let old_r = Hashtbl.find var_locations atom in
match old_r with
- | RangeLoc old_r ->
- let n_r = { range_start = Some lbl; range_end = None; var_loc = loc } in
+ | RangeLoc (n_r::old_r) ->
+ 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 end_live_range atom lbl =
+
+let close_range lbl atom =
try
let old_r = Hashtbl.find var_locations atom in
match old_r with
| RangeLoc (n_r::old_r) ->
- let n_r = {n_r with range_end = Some lbl} in
- Hashtbl.replace var_locations atom (RangeLoc (n_r::old_r))
+ if n_r.range_end = None then
+ 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) =
Hashtbl.add var_locations atom (FunctionLoc (sp,loc))
let function_end atom loc =
IntSet.iter (fun id -> close_scope atom id loc) !open_scopes;
- open_scopes := IntSet.empty
+ open_scopes := IntSet.empty;
+ List.iter (close_range loc) !open_vars;
+ open_vars:= []
let init name =