aboutsummaryrefslogtreecommitdiffstats
path: root/mppa_k1c/Op.v
diff options
context:
space:
mode:
Diffstat (limited to 'mppa_k1c/Op.v')
-rw-r--r--mppa_k1c/Op.v13
1 files changed, 10 insertions, 3 deletions
diff --git a/mppa_k1c/Op.v b/mppa_k1c/Op.v
index baf17cc0..5e80589b 100644
--- a/mppa_k1c/Op.v
+++ b/mppa_k1c/Op.v
@@ -207,7 +207,8 @@ Inductive operation : Type :=
addressing. *)
Inductive addressing: Type :=
- | Aindexed2: addressing (**r Address is [r1 + r2] *)
+ | Aindexed2XS (scale : Z) : addressing (**r Address is [r1 + r2 << scale] *)
+ | Aindexed2 : addressing (**r Address is [r1 + r2] *)
| Aindexed: ptrofs -> addressing (**r Address is [r1 + offset] *)
| Aglobal: ident -> ptrofs -> addressing (**r Address is global plus offset *)
| Ainstack: ptrofs -> addressing. (**r Address is [stack_pointer + offset] *)
@@ -230,7 +231,7 @@ Defined.
Definition eq_addressing (x y: addressing) : {x=y} + {x<>y}.
Proof.
- generalize ident_eq Ptrofs.eq_dec; intros.
+ generalize ident_eq Ptrofs.eq_dec Z.eq_dec; intros.
decide equality.
Defined.
@@ -513,6 +514,7 @@ Definition eval_addressing
(F V: Type) (genv: Genv.t F V) (sp: val)
(addr: addressing) (vl: list val) : option val :=
match addr, vl with
+ | Aindexed2XS scale, v1 :: v2 :: nil => Some (Val.addl v1 (Val.shll v2 (Vint (Int.repr scale))))
| Aindexed2, v1 :: v2 :: nil => Some (Val.addl v1 v2)
| Aindexed n, v1 :: nil => Some (Val.offset_ptr v1 n)
| Aglobal s ofs, nil => Some (Genv.symbol_address genv s ofs)
@@ -703,8 +705,10 @@ Definition type_of_operation (op: operation) : list typ * typ :=
| Oinsfl _ _ => (Tlong :: Tlong :: nil, Tlong)
end.
+(* FIXME: two Tptr ?! *)
Definition type_of_addressing (addr: addressing) : list typ :=
match addr with
+ | Aindexed2XS _ => Tptr :: Tptr :: nil
| Aindexed2 => Tptr :: Tptr :: nil
| Aindexed _ => Tptr :: nil
| Aglobal _ _ => nil
@@ -1117,7 +1121,7 @@ Qed.
Definition offset_addressing (addr: addressing) (delta: Z) : option addressing :=
match addr with
- | Aindexed2 => None
+ | Aindexed2 | Aindexed2XS _ => None
| Aindexed n => Some(Aindexed (Ptrofs.add n (Ptrofs.repr delta)))
| Aglobal id n => Some(Aglobal id (Ptrofs.add n (Ptrofs.repr delta)))
| Ainstack n => Some(Ainstack (Ptrofs.add n (Ptrofs.repr delta)))
@@ -1661,6 +1665,9 @@ Lemma eval_addressing_inj:
exists v2, eval_addressing ge2 sp2 addr vl2 = Some v2 /\ Val.inject f v1 v2.
Proof.
intros. destruct addr; simpl in H2; simpl; FuncInv; InvInject; TrivialExists.
+ - apply Val.addl_inject; trivial.
+ destruct v0; destruct v'0; simpl; trivial; destruct (Int.ltu _ _); simpl; trivial; inv H3.
+ apply Val.inject_long.
- apply Val.addl_inject; auto.
- apply Val.offset_ptr_inject; auto.
- apply H; simpl; auto.