(** The following lemmas show that the translation from Mach to Asm preserves labels, in the sense that the following diagram commutes: << translation Mach code ------------------------ Asm instr sequence |                                          | | Mach.find_label lbl       find_label lbl | |                                          | v                                          v Mach code tail ------------------- Asm instr seq tail translation >> The proof demands many boring lemmas showing that Asm constructor functions do not introduce new labels.  In passing, we also prove a "is tail" property of the generated Asm code. *)
Section TRANSL_LABEL.
Remark mk_mov_label:
forall rd rs k c, mk_mov rd rs k = OK c -> tail_nolabel k c.
Hint Resolve mk_mov_label: labels.
Remark mk_shrximm_label:
forall n k c, mk_shrximm n k = OK c -> tail_nolabel k c.
Hint Resolve mk_shrximm_label: labels.
Remark mk_shrxlimm_label:
forall n k c, mk_shrxlimm n k = OK c -> tail_nolabel k c.
Hint Resolve mk_shrxlimm_label: labels.
Remark mk_intconv_label:
forall f r1 r2 k c, mk_intconv f r1 r2 k = OK c ->
(forall r r', nolabel (f r r')) ->
tail_nolabel k c.
Hint Resolve mk_intconv_label: labels.
Remark mk_storebyte_label:
forall addr r k c, mk_storebyte addr r k = OK c -> tail_nolabel k c.
Hint Resolve mk_storebyte_label: labels.
Remark loadind_label:
forall base ofs ty dst k c,
loadind base ofs ty dst k = OK c ->
tail_nolabel k c.
Remark storeind_label:
forall base ofs ty src k c,
storeind src base ofs ty k = OK c ->
tail_nolabel k c.
Remark mk_setcc_base_label:
forall xc rd k,
tail_nolabel k (mk_setcc_base xc rd k).
Remark mk_setcc_label:
forall xc rd k,
tail_nolabel k (mk_setcc xc rd k).
Remark mk_jcc_label:
forall xc lbl' k,
tail_nolabel k (mk_jcc xc lbl' k).
Remark transl_cond_label:
forall cond args k c,
transl_cond cond args k = OK c ->
tail_nolabel k c.
Remark transl_op_label:
forall op args r k c,
transl_op op args r k = OK c ->
tail_nolabel k c.
Remark transl_load_label:
forall chunk addr args dest k c,
transl_load chunk addr args dest k = OK c ->
tail_nolabel k c.
Remark transl_store_label:
forall chunk addr args src k c,
transl_store chunk addr args src k = OK c ->
tail_nolabel k c.

Lemma transl_instr_label:
forall f i ep k c,
transl_instr f i ep k = OK c ->
match i with Mlabel lbl => c = Plabel lbl :: k | _ => tail_nolabel k c end.