Definition t := preg.Definition eq := preg_eq.Module Pregmap := EMap(PregEq).Definition regset := Pregmap.t val.Definition genv := Genv.t fundef unit.Notation "a # b <- c" := (Pregmap.set b c a) (at level 1, b at next level) : asm.(** Looking up instructions in a code sequence by position. *)

Fixpoint find_instr (pos: Z) (c: code) {struct c} : option instruction :=
  match c with
  | nil => None
  | i :: il => if zeq pos 0 then Some i else find_instr (pos - 1) il
  end.(** Position corresponding to a label *)

Definition is_label (lbl: label) (instr: instruction) : bool :=
  match instr with
  | Plabel lbl' => if peq lbl lbl' then true else false
  | _ => false
  end.

Lemma is_label_correct: forall lbl instr, if is_label lbl instr then instr = Plabel lbl else instr <> Plabel lbl.