aboutsummaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2015-08-21 15:21:36 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2015-08-21 15:21:36 +0200
commit8d2e4a51d56b7f4d3673a5132edd1adb37a14295 (patch)
treeae812b2aea814c14c2c64a32c46ae14791e9dc25 /backend
parent5f798720574bf9d694da271e3e8bf699a4726497 (diff)
downloadcompcert-8d2e4a51d56b7f4d3673a5132edd1adb37a14295.tar.gz
compcert-8d2e4a51d56b7f4d3673a5132edd1adb37a14295.zip
Added symbol functions for printing of the location for global variables.
Diffstat (limited to 'backend')
-rw-r--r--backend/PrintAsm.ml8
-rw-r--r--backend/PrintAsmaux.ml3
2 files changed, 9 insertions, 2 deletions
diff --git a/backend/PrintAsm.ml b/backend/PrintAsm.ml
index f3c80f3e..29409b32 100644
--- a/backend/PrintAsm.ml
+++ b/backend/PrintAsm.ml
@@ -78,6 +78,7 @@ module Printer(Target:TARGET) =
List.iter (Target.print_init oc) id
let print_var oc name v =
+ if !Clflags.option_g && Configuration.advanced_debug then Target.add_var_location name;
match v.gvar_init with
| [] -> ()
| _ ->
@@ -102,8 +103,7 @@ module Printer(Target:TARGET) =
let sz =
match v.gvar_init with [Init_space sz] -> sz | _ -> assert false in
Target.print_comm_symb oc sz name align
-
-
+
let print_globdef oc (name,gdef) =
match gdef with
| Gfun (Internal code) -> print_function oc name code
@@ -120,6 +120,10 @@ module Printer(Target:TARGET) =
let get_stmt_list_addr = Target.get_stmt_list_addr
let name_of_section = Target.name_of_section
let get_fun_addr s = try Some (Hashtbl.find addr_mapping s) with Not_found -> None
+ let get_location a = try (Target.get_location (stamp_atom a)) with Not_found -> None
+ let get_segment_location a = try (Target.get_segment_location (stamp_atom a)) with Not_found -> None
+ let get_frame_base a = None
+ let symbol = Target.symbol
end
module DebugPrinter = DwarfPrinter (DwarfTarget) (Target.DwarfAbbrevs)
diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml
index b54188ca..efc8030f 100644
--- a/backend/PrintAsmaux.ml
+++ b/backend/PrintAsmaux.ml
@@ -51,6 +51,9 @@ module type TARGET =
val new_label: unit -> int
val label: out_channel -> int -> unit
val print_file_loc: out_channel -> file_loc -> unit
+ val get_location: P.t -> location_value option
+ val get_segment_location: P.t -> location_value option
+ val add_var_location: P.t -> unit
module DwarfAbbrevs: DWARF_ABBREVS
end