aboutsummaryrefslogtreecommitdiffstats
path: root/backend/Regalloc.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2017-06-15 15:11:26 +0200
committerBernhard Schommer <bschommer@users.noreply.github.com>2017-07-06 15:41:51 +0200
commitdff22ef6d855973e0e0f05c7203a6bfa9a4cf01a (patch)
tree82c09b8cff023557084d6257acdef84b1311dd35 /backend/Regalloc.ml
parent92fc8a425034abc1247203a4c0d471e8b6d0e941 (diff)
downloadcompcert-kvx-dff22ef6d855973e0e0f05c7203a6bfa9a4cf01a.tar.gz
compcert-kvx-dff22ef6d855973e0e0f05c7203a6bfa9a4cf01a.zip
Extend builtin arguments with a pointer addition operator
This extension enables more addressing modes to be encoded as builtin arguments and used in conjunction with volatile memory accesses. Current status: x86 port only, the only new addressing mode handled is reg + offset.
Diffstat (limited to 'backend/Regalloc.ml')
-rw-r--r--backend/Regalloc.ml15
1 files changed, 13 insertions, 2 deletions
diff --git a/backend/Regalloc.ml b/backend/Regalloc.ml
index c14852f4..d4d7362d 100644
--- a/backend/Regalloc.ml
+++ b/backend/Regalloc.ml
@@ -167,6 +167,8 @@ let rec convert_builtin_arg tyenv = function
| BA_addrglobal(id, ofs) -> BA_addrglobal(id, ofs)
| BA_splitlong(hi, lo) ->
BA_splitlong(convert_builtin_arg tyenv hi, convert_builtin_arg tyenv lo)
+ | BA_addptr(a1, a2) ->
+ BA_addptr(convert_builtin_arg tyenv a1, convert_builtin_arg tyenv a2)
let convert_builtin_res tyenv = function
| BR r ->
@@ -185,6 +187,10 @@ let rec constrain_builtin_arg a cl =
let (hi', cl1) = constrain_builtin_arg hi cl in
let (lo', cl2) = constrain_builtin_arg lo cl1 in
(BA_splitlong(hi', lo'), cl2)
+ | BA_addptr(a1, a2), _ ->
+ let (a1', cl1) = constrain_builtin_arg a1 cl in
+ let (a2', cl2) = constrain_builtin_arg a2 cl1 in
+ (BA_addptr(a1', a2'), cl2)
| _, _ -> (a, cl)
let rec constrain_builtin_args al cl =
@@ -335,6 +341,7 @@ let rec vset_addarg a after =
match a with
| BA v -> VSet.add v after
| BA_splitlong(hi, lo) -> vset_addarg hi (vset_addarg lo after)
+ | BA_addptr(a1, a2) -> vset_addarg a1 (vset_addarg a2 after)
| _ -> after
let vset_addargs al after = List.fold_right vset_addarg al after
@@ -432,8 +439,8 @@ let rec dce_parmove srcs dsts after =
let rec keep_builtin_arg after = function
| BA v -> VSet.mem v after
- | BA_splitlong(hi, lo) ->
- keep_builtin_arg after hi && keep_builtin_arg after lo
+ | BA_splitlong(a1, a2) | BA_addptr(a1, a2) ->
+ keep_builtin_arg after a1 && keep_builtin_arg after a2
| _ -> true
let dce_instr instr after k =
@@ -855,6 +862,10 @@ let rec reload_arg tospill eqs = function
let (hi', c1, eqs1) = reload_arg tospill eqs hi in
let (lo', c2, eqs2) = reload_arg tospill eqs1 lo in
(BA_splitlong(hi', lo'), c1 @ c2, eqs2)
+ | BA_addptr(a1, a2) ->
+ let (a1', c1, eqs1) = reload_arg tospill eqs a1 in
+ let (a2', c2, eqs2) = reload_arg tospill eqs1 a2 in
+ (BA_addptr(a1', a2'), c1 @ c2, eqs2)
| a -> (a, [], eqs)
let rec reload_args tospill eqs = function