From fc8afb9287ab7b1607e5a7d2a03b0078fd9867d0 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 24 Sep 2015 20:11:48 +0200 Subject: Added placing labels for live ranges etc. In order to avoid the usage of too many labels we replace the debug statements during the Asmexpand phase. --- debug/Debug.ml | 27 +++++++++++++++++++++++++++ debug/Debug.mli | 7 +++++++ debug/DebugInformation.ml | 17 +++++++++++++++-- debug/Dwarfgen.ml | 1 - 4 files changed, 49 insertions(+), 3 deletions(-) (limited to 'debug') diff --git a/debug/Debug.ml b/debug/Debug.ml index c2b48618..fba921e1 100644 --- a/debug/Debug.ml +++ b/debug/Debug.ml @@ -10,6 +10,8 @@ (* *) (* *********************************************************************) +open AST +open BinNums open C open Camlcoq open Dwarfgen @@ -35,6 +37,11 @@ type implem = mutable enter_scope: int -> int -> int -> unit; mutable enter_function_scope: int -> int -> unit; mutable add_lvar_scope: int -> ident -> int -> unit; + mutable open_scope: atom -> int -> positive -> unit; + mutable close_scope: atom -> int -> positive -> unit; + mutable start_live_range: atom -> positive -> string builtin_arg -> unit; + mutable end_live_range: atom -> positive -> unit; + mutable stack_variable: atom -> string builtin_arg -> unit } let implem = @@ -54,6 +61,11 @@ let implem = enter_scope = (fun _ _ _ -> ()); enter_function_scope = (fun _ _ -> ()); add_lvar_scope = (fun _ _ _ -> ()); + open_scope = (fun _ _ _ -> ()); + close_scope = (fun _ _ _ -> ()); + start_live_range = (fun _ _ _ -> ()); + end_live_range = (fun _ _ -> ()); + stack_variable = (fun _ _ -> ()); } let init () = @@ -73,6 +85,11 @@ let init () = implem.enter_scope <- DebugInformation.enter_scope; implem.enter_function_scope <- DebugInformation.enter_function_scope; implem.add_lvar_scope <- DebugInformation.add_lvar_scope; + implem.open_scope <- DebugInformation.open_scope; + implem.close_scope <- DebugInformation.close_scope; + implem.start_live_range <- DebugInformation.start_live_range; + implem.end_live_range <- DebugInformation.end_live_range; + implem.stack_variable <- DebugInformation.stack_variable; end else begin implem.init <- (fun _ -> ()); implem.atom_function <- (fun _ _ -> ()); @@ -89,6 +106,11 @@ let init () = implem.enter_scope <- (fun _ _ _ -> ()); implem.enter_function_scope <- (fun _ _ -> ()); implem.add_lvar_scope <- (fun _ _ _ -> ()); + implem.open_scope <- (fun _ _ _ -> ()); + implem.close_scope <- (fun _ _ _ -> ()); + implem.start_live_range <- (fun _ _ _ -> ()); + implem.end_live_range <- (fun _ _ -> ()); + implem.stack_variable <- (fun _ _ -> ()); end let init_compile_unit name = implem.init name @@ -106,3 +128,8 @@ let atom_local_variable id atom = implem.atom_local_variable id atom let enter_scope p_id id = implem.enter_scope p_id id let enter_function_scope fun_id sc_id = implem.enter_function_scope fun_id sc_id let add_lvar_scope fun_id var_id s_id = implem.add_lvar_scope fun_id var_id s_id +let open_scope atom id lbl = implem.open_scope atom id lbl +let close_scope atom id lbl = implem.close_scope atom id lbl +let start_live_range atom lbl loc = implem.start_live_range atom lbl loc +let end_live_range atom lbl = implem.end_live_range atom lbl +let stack_variable atom loc = implem.stack_variable atom loc diff --git a/debug/Debug.mli b/debug/Debug.mli index 1fabb943..42a0cee7 100644 --- a/debug/Debug.mli +++ b/debug/Debug.mli @@ -10,9 +10,11 @@ (* *) (* *********************************************************************) +open AST open C open Camlcoq open DwarfTypes +open BinNums val init: unit -> unit @@ -31,3 +33,8 @@ val atom_local_variable: ident -> atom -> unit val enter_scope: int -> int -> int -> unit val enter_function_scope: int -> int -> unit val add_lvar_scope: int -> ident -> int -> unit +val open_scope: atom -> int -> positive -> unit +val close_scope: atom -> int -> positive -> unit +val start_live_range: atom -> positive -> string builtin_arg -> unit +val end_live_range: atom -> positive -> unit +val stack_variable: atom -> string builtin_arg -> unit diff --git a/debug/DebugInformation.ml b/debug/DebugInformation.ml index 80d71dfd..f12853c9 100644 --- a/debug/DebugInformation.ml +++ b/debug/DebugInformation.ml @@ -478,7 +478,6 @@ let insert_global_declaration env dec= in match dec.gdesc with | Gdecl (sto,id,ty,init) -> - Printf.printf "Entering information for %s\n" id.name; if not (is_function_type env ty) then begin if not (Hashtbl.mem stamp_to_definition id.stamp) then begin let at_decl,ext = (match sto with @@ -660,6 +659,21 @@ let enter_scope f_id p_id id = replace_scope p_id' ({scope_variables = id'::scope.scope_variables;}) with Not_found -> () +let open_scope atom s_id lbl = + () + +let close_scope atom s_id lbl = + () + +let start_live_range atom lbl loc = + () + +let end_live_range atom lbl = + () + +let stack_variable atom loc = + () + let init name = id := 0; file_name := name; @@ -672,4 +686,3 @@ let init name = Hashtbl.reset stamp_to_local; Hashtbl.reset atom_to_local; Hashtbl.reset scope_to_local; - diff --git a/debug/Dwarfgen.ml b/debug/Dwarfgen.ml index 15c63b66..6c10b362 100644 --- a/debug/Dwarfgen.ml +++ b/debug/Dwarfgen.ml @@ -315,7 +315,6 @@ let fun_scope_to_entries acc id = | _ -> assert false) let function_to_entry acc id f = - Printf.printf "Generating information for %s with id %d\n" f.fun_name id; let f_tag = { subprogram_file_loc = f.fun_file_loc; subprogram_external = Some f.fun_external; -- cgit