(** The following lemmas show that the translation from Mach to PPC preserves labels, in the sense that the following diagram commutes: << translation Mach code ------------------------ PPC instr sequence |                                          | | Mach.find_label lbl       find_label lbl | |                                          | v                                          v Mach code tail ------------------- PPC instr seq tail translation >> The proof demands many boring lemmas showing that PPC constructor functions do not introduce new labels. *)
Section TRANSL_LABEL.
Remark loadimm_label:
forall r n k, tail_nolabel k (loadimm r n k).
Hint Resolve loadimm_label: labels.
Remark addimm_label:
forall r1 r2 n k, tail_nolabel k (addimm r1 r2 n k).
Hint Resolve addimm_label: labels.
Remark andimm_base_label:
forall r1 r2 n k, tail_nolabel k (andimm_base r1 r2 n k).
Hint Resolve andimm_base_label: labels.
Remark andimm_label:
forall r1 r2 n k, tail_nolabel k (andimm r1 r2 n k).
Hint Resolve andimm_label: labels.
Remark orimm_label:
forall r1 r2 n k, tail_nolabel k (orimm r1 r2 n k).
Hint Resolve orimm_label: labels.
Remark xorimm_label:
forall r1 r2 n k, tail_nolabel k (xorimm r1 r2 n k).
Hint Resolve xorimm_label: labels.
Remark rolm_label:
forall r1 r2 amount mask k, tail_nolabel k (rolm r1 r2 amount mask k).
Hint Resolve rolm_label: labels.
Remark loadimm64_label:
forall r n k, tail_nolabel k (loadimm64 r n k).
Hint Resolve loadimm64_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 floatcomp_label:
forall cmp r1 r2 k, tail_nolabel k (floatcomp cmp r1 r2 k).
Hint Resolve floatcomp_label: labels.
Remark transl_cond_label:
forall cond args k c,
transl_cond cond args k = OK c -> tail_nolabel k c.
Remark transl_cond_op_label:
forall cond args r k c,
transl_cond_op cond args r 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_memory_access_label:
forall (mk1: constant -> ireg -> instruction) (mk2: ireg -> ireg -> instruction)
addr args temp k c,
transl_memory_access mk1 mk2 addr args temp k = OK c ->
(forall c r, nolabel (mk1 c r)) ->
(forall r1 r2, nolabel (mk2 r1 r2)) ->
tail_nolabel k c.
Remark transl_epilogue_label:
forall f k, tail_nolabel k (transl_epilogue f k).

Lemma transl_instr_label':
forall lbl f i ep k c,
transl_instr f i ep k = OK c ->
find_label lbl c = if Mach.is_label lbl i then Some k else find_label lbl k.