(* *********************************************************************)
(*                                                                     *)
(*              The Compcert verified compiler                         *)
(*                                                                     *)
(*          Xavier Leroy, INRIA Paris-Rocquencourt                     *)
(*                                                                     *)
(*  Copyright Institut National de Recherche en Informatique et en     *)
(*  Automatique.  All rights reserved.  This file is distributed       *)
(*  under the terms of the GNU General Public License as published by  *)
(*  the Free Software Foundation, either version 2 of the License, or  *)
(*  (at your option) any later version.  This file is also distributed *)
(*  under the terms of the INRIA Non-Commercial License Agreement.     *)
(*                                                                     *)
(* *********************************************************************)
(** This file defines a number of data types and operations used in the abstract syntax trees of many of the intermediate languages. *)
Require Archi.
Set Implicit Arguments.
(** * Syntactic elements *)
(** Identifiers (names of local variables, of global symbols and functions, etc) are represented by the type [positive] of positive integers. *)
Definition ident := positive.
Definition ident_eq := peq.
(** The intermediate languages are weakly typed, using the following types: *)
Inductive typ : Type :=
| Tint                (**r 32-bit integers or pointers *)
| Tfloat              (**r 64-bit double-precision floats *)
| Tlong               (**r 64-bit integers *)
| Tsingle             (**r 32-bit single-precision floats *)
| Tany32              (**r any 32-bit value *)
| Tany64.             (**r any 64-bit value, i.e. any value *)
(** The chunk that is appropriate to store and reload a value of the given type, without losing information. *)
Definition chunk_of_type (ty: typ) :=
match ty with
| Tint => Mint32
| Tfloat => Mfloat64
| Tlong => Mint64
| Tsingle => Mfloat32
| Tany32 => Many32
| Tany64 => Many64
end.

Lemma chunk_of_Tptr: chunk_of_type Tptr = Mptr.