summaryrefslogtreecommitdiff
path: root/arm/ConstpropOp.vp
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-05-21 16:26:30 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-05-21 16:26:30 +0000
commit0053b1aa1d26da5d1f995a603b127daf799c2da9 (patch)
treefec49ad37e5edffa5be742bafcadff3c8b8ede7f /arm/ConstpropOp.vp
parent219a2d178dcd5cc625f6b6261759f392cfca367b (diff)
Merge of the newmem branch:
- Revised memory model with Max and Cur permissions, but without bounds - Constant propagation of 'const' globals - Function inlining at RTL level - (Unprovable) elimination of unreferenced static definitions git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1899 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'arm/ConstpropOp.vp')
-rw-r--r--arm/ConstpropOp.vp26
1 files changed, 23 insertions, 3 deletions
diff --git a/arm/ConstpropOp.vp b/arm/ConstpropOp.vp
index 0c77305..c0a04f0 100644
--- a/arm/ConstpropOp.vp
+++ b/arm/ConstpropOp.vp
@@ -84,11 +84,13 @@ Definition eval_static_intoffloat (f: float) :=
Definition eval_static_intuoffloat (f: float) :=
match Float.intuoffloat f with Some x => I x | None => Unknown end.
+Parameter propagate_float_constants: unit -> bool.
+
Nondetfunction eval_static_operation (op: operation) (vl: list approx) :=
match op, vl with
| Omove, v1::nil => v1
| Ointconst n, nil => I n
- | Ofloatconst n, nil => F n
+ | Ofloatconst n, nil => if propagate_float_constants tt then F n else Unknown
| Oaddrsymbol s n, nil => G s n
| Oaddrstack n, nil => S n
| Oadd, I n1 :: I n2 :: nil => I(Int.add n1 n2)
@@ -138,12 +140,30 @@ Nondetfunction eval_static_operation (op: operation) (vl: list approx) :=
| Osingleoffloat, F n1 :: nil => F(Float.singleoffloat n1)
| Ointoffloat, F n1 :: nil => eval_static_intoffloat n1
| Ointuoffloat, F n1 :: nil => eval_static_intuoffloat n1
- | Ofloatofint, I n1 :: nil => F(Float.floatofint n1)
- | Ofloatofintu, I n1 :: nil => F(Float.floatofintu n1)
+ | Ofloatofint, I n1 :: nil => if propagate_float_constants tt then F(Float.floatofint n1) else Unknown
+ | Ofloatofintu, I n1 :: nil => if propagate_float_constants tt then F(Float.floatofintu n1) else Unknown
| Ocmp c, vl => eval_static_condition_val c vl
| _, _ => Unknown
end.
+Nondetfunction eval_static_addressing (addr: addressing) (vl: list approx) :=
+ match addr, vl with
+ | Aindexed n, I n1::nil => I (Int.add n1 n)
+ | Aindexed n, G id ofs::nil => G id (Int.add ofs n)
+ | Aindexed n, S ofs::nil => S (Int.add ofs n)
+ | Aindexed2, I n1::I n2::nil => I (Int.add n1 n2)
+ | Aindexed2, G id ofs::I n2::nil => G id (Int.add ofs n2)
+ | Aindexed2, I n1::G id ofs::nil => G id (Int.add ofs n1)
+ | Aindexed2, S ofs::I n2::nil => S (Int.add ofs n2)
+ | Aindexed2, I n1::S ofs::nil => S (Int.add ofs n1)
+ | Aindexed2shift s, I n1::I n2::nil => I (Int.add n1 (eval_static_shift s n2))
+ | Aindexed2shift s, G id ofs::I n2::nil => G id (Int.add ofs (eval_static_shift s n2))
+ | Aindexed2shift s, S ofs::I n2::nil => S (Int.add ofs (eval_static_shift s n2))
+ | Ainstack ofs, nil => S ofs
+ | _, _ => Unknown
+ end.
+
+
(** * Operator strength reduction *)
(** We now define auxiliary functions for strength reduction of