aboutsummaryrefslogtreecommitdiffstats
path: root/ia32
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2015-04-23 14:49:30 +0200
committerXavier Leroy <xavier.leroy@inria.fr>2015-04-23 14:49:30 +0200
commit5ad466befa609df178f04886484ee38b1a9c44ed (patch)
treec2752db1bd09224cda15df4f3c3cf9dbc3c0dc8a /ia32
parent3ca2af08f068eb1edf638b8ef602b816823873e0 (diff)
downloadcompcert-5ad466befa609df178f04886484ee38b1a9c44ed.tar.gz
compcert-5ad466befa609df178f04886484ee38b1a9c44ed.zip
Take asm clobbers into account for determining callee-save registers used.
Diffstat (limited to 'ia32')
-rw-r--r--ia32/Machregsaux.ml7
-rw-r--r--ia32/Machregsaux.mli1
2 files changed, 8 insertions, 0 deletions
diff --git a/ia32/Machregsaux.ml b/ia32/Machregsaux.ml
index 3083cf3e..75fd588a 100644
--- a/ia32/Machregsaux.ml
+++ b/ia32/Machregsaux.ml
@@ -38,3 +38,10 @@ let can_reserve_register r =
List.mem r Conventions1.int_callee_save_regs
|| List.mem r Conventions1.float_callee_save_regs
+let mregs_of_clobber idl =
+ List.fold_left
+ (fun l c ->
+ match register_by_name (Camlcoq.extern_atom c) with
+ | Some r -> r :: l
+ | None -> l)
+ [] idl
diff --git a/ia32/Machregsaux.mli b/ia32/Machregsaux.mli
index 4cd79024..f09ebddb 100644
--- a/ia32/Machregsaux.mli
+++ b/ia32/Machregsaux.mli
@@ -15,3 +15,4 @@
val name_of_register: Machregs.mreg -> string option
val register_by_name: string -> Machregs.mreg option
val can_reserve_register: Machregs.mreg -> bool
+val mregs_of_clobber: Camlcoq.atom list -> Machregs.mreg list