aboutsummaryrefslogtreecommitdiffstats
path: root/riscV/CSE2deps.v
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2020-03-03 12:27:58 +0100
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2020-03-03 12:27:58 +0100
commit74efac13484e4767f793cf9ccc94835825ca30ba (patch)
treea85e79bdd8949ccd1a7bb4f88a46c77ed3add713 /riscV/CSE2deps.v
parent577d3dbeb54aaf23db19dddf149c48764e20c58d (diff)
downloadcompcert-kvx-74efac13484e4767f793cf9ccc94835825ca30ba.tar.gz
compcert-kvx-74efac13484e4767f793cf9ccc94835825ca30ba.zip
CSE2 alias analysis for Risc-V
Diffstat (limited to 'riscV/CSE2deps.v')
-rw-r--r--riscV/CSE2deps.v20
1 files changed, 20 insertions, 0 deletions
diff --git a/riscV/CSE2deps.v b/riscV/CSE2deps.v
new file mode 100644
index 00000000..8ab9242a
--- /dev/null
+++ b/riscV/CSE2deps.v
@@ -0,0 +1,20 @@
+Require Import BoolEqual Coqlib.
+Require Import AST Integers Floats.
+Require Import Values Memory Globalenvs Events.
+Require Import Op.
+
+
+Definition can_swap_accesses_ofs ofsr chunkr ofsw chunkw :=
+ (0 <=? ofsw) && (ofsw <=? (Ptrofs.modulus - largest_size_chunk))
+ && (0 <=? ofsr) && (ofsr <=? (Ptrofs.modulus - largest_size_chunk))
+ && ((ofsw + size_chunk chunkw <=? ofsr) ||
+ (ofsr + size_chunk chunkr <=? ofsw)).
+
+Definition may_overlap chunk addr args chunk' addr' args' :=
+ match addr, addr', args, args' with
+ | (Aindexed ofs), (Aindexed ofs'),
+ (base :: nil), (base' :: nil) =>
+ if peq base base'
+ then negb (can_swap_accesses_ofs (Ptrofs.unsigned ofs') chunk' (Ptrofs.unsigned ofs) chunk)
+ else true | _, _, _, _ => true
+ end.