(* *********************************************************************)
(*                                                                     *)
(*              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 INRIA Non-Commercial License Agreement.     *)
(*                                                                     *)
(* *********************************************************************)
(** Locations are a refinement of RTL pseudo-registers, used to reflect the results of register allocation (file [Allocation]). *)
Require Export Machregs.
(** * Representation of locations *)
(** A location is either a processor register or (an abstract designation of) a slot in the activation record of the current function. *)
(** ** Processor registers *)
(** Processor registers usable for register allocation are defined in module [Machregs]. *)
(** ** Slots in activation records *)
(** A slot in an activation record is designated abstractly by a kind, a type and an integer offset.  Three kinds are considered: - [Local]: these are the slots used by register allocation for pseudo-registers that cannot be assigned a hardware register. - [Incoming]: used to store the parameters of the current function that cannot reside in hardware registers, as determined by the calling conventions. - [Outgoing]: used to store arguments to called functions that cannot reside in hardware registers, as determined by the calling conventions. *)
Inductive slot: Type :=
| Local
| Incoming
| Outgoing.
(** Morally, the [Incoming] slots of a function are the [Outgoing] slots of its caller function.  The type of a slot indicates how it will be accessed later once mapped to actual memory locations inside a memory-allocated activation record: as 32-bit integers/pointers (type [Tint]) or as 64-bit floats (type [Tfloat]).  The offset of a slot, combined with its type and its kind, identifies uniquely the slot and will determine later where it resides within the memory-allocated activation record.  Offsets are always positive. *)

Lemma typealign_pos:
forall (ty: typ), typealign ty > 0.