aboutsummaryrefslogtreecommitdiffstats
path: root/backend/PrintAsmaux.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@gmail.com>2015-09-20 15:23:38 +0200
committerXavier Leroy <xavier.leroy@gmail.com>2015-09-20 15:23:38 +0200
commit9147350fdb47f3471ce6d9202b7c996f79ffab2d (patch)
treef47977b33fa0975d614cc9bc2e4a22c996a96401 /backend/PrintAsmaux.ml
parentdb0a62a01bbf90617701b68917319767159bf039 (diff)
downloadcompcert-kvx-9147350fdb47f3471ce6d9202b7c996f79ffab2d.tar.gz
compcert-kvx-9147350fdb47f3471ce6d9202b7c996f79ffab2d.zip
Experiment: track the scopes of local variables via __builtin_debug.
C2C: the code that insert debug builtins with the line numbers is now in Unblock. Handle calls to __builtin_debug. Unblock: generate __builtin_debug(1) for line numbers, carrying the list of active scopes as extra arguments. Generate __builtin_debug(6) for local variable declarations, carrying the corresponding scope number as extra argument. Constprop: avoid duplicating debug arguments that are constants already. PrintAsmaux: show this extra debug info as comments.
Diffstat (limited to 'backend/PrintAsmaux.ml')
-rw-r--r--backend/PrintAsmaux.ml5
1 files changed, 5 insertions, 0 deletions
diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml
index 67e53aea..13daa644 100644
--- a/backend/PrintAsmaux.ml
+++ b/backend/PrintAsmaux.ml
@@ -269,6 +269,8 @@ let print_debug_info comment print_line print_preg sp_name oc kind txt args =
args in
match kind with
| 1 -> (* line number *)
+ fprintf oc "%s debug: current scopes%a\n"
+ comment print_debug_args args;
if Str.string_match re_file_line txt 0 then
print_line oc (Str.matched_group 1 txt)
(int_of_string (Str.matched_group 2 txt))
@@ -283,6 +285,9 @@ let print_debug_info comment print_line print_preg sp_name oc kind txt args =
| 5 -> (* local variable preallocated in stack *)
fprintf oc "%s debug: %s resides at%a\n"
comment txt print_debug_args args
+ | 6 -> (* declaration of a local variable *)
+ fprintf oc "%s debug: %s declared in scope%a\n"
+ comment txt print_debug_args args
| _ ->
()