diff options
Diffstat (limited to 'backend')
-rw-r--r-- | backend/CSE.v | 2 | ||||
-rw-r--r-- | backend/Regalloc.ml | 18 |
2 files changed, 18 insertions, 2 deletions
diff --git a/backend/CSE.v b/backend/CSE.v index 9f295402..e9006d4f 100644 --- a/backend/CSE.v +++ b/backend/CSE.v @@ -476,7 +476,7 @@ Definition transfer (f: function) (approx: PMap.t VA.t) (pc: node) (before: numb empty_numbering | Ibuiltin ef args res s => match ef with - | EF_external _ _ | EF_malloc | EF_free | EF_inline_asm _ _ => + | EF_external _ _ | EF_malloc | EF_free | EF_inline_asm _ _ _ => empty_numbering | EF_builtin _ _ | EF_vstore _ | EF_vstore_global _ _ _ => set_unknown (kill_all_loads before) res diff --git a/backend/Regalloc.ml b/backend/Regalloc.ml index 3a7f5d99..c286e946 100644 --- a/backend/Regalloc.ml +++ b/backend/Regalloc.ml @@ -510,6 +510,9 @@ let add_interfs_live g live v = let add_interfs_list g v vl = List.iter (IRC.add_interf g v) vl +let add_interfs_list_mreg g vl mr = + List.iter (fun v -> IRC.add_interf g v (L (R mr))) vl + let rec add_interfs_pairwise g = function | [] -> () | v1 :: vl -> add_interfs_list g v1 vl; add_interfs_pairwise g vl @@ -578,7 +581,20 @@ let add_interfs_instr g instr live = add_interfs_pairwise g res; add_interfs_destroyed g across (destroyed_by_builtin ef); begin match ef, args, res with - | EF_annot_val _, [arg], [res] -> IRC.add_pref g arg res (* like a move *) + | EF_annot_val _, [arg], [res] -> + (* like a move *) + IRC.add_pref g arg res + | EF_inline_asm(txt, sg, clob), _, _ -> + (* clobbered regs interfere with live set + and also with res and args for GCC compatibility *) + List.iter (fun c -> + match Machregsaux.register_by_name (extern_atom c) with + | None -> () + | Some mr -> + add_interfs_destroyed g across [mr]; + add_interfs_list_mreg g args mr; + if sg.sig_res <> None then add_interfs_list_mreg g res mr) + clob | _ -> () end | Xannot(ef, args) -> |