Fixpoint alloc_globals_rev {F V} (ge: Genv.t F V) (m: mem) (vl: list (ident * globdef F V))
{struct vl} : option mem :=
match vl with
| nil => Some m
| v :: vl' =>
match alloc_globals_rev ge m vl' with
| Some m' => Genv.alloc_global ge m' v
| None => None
end
end.

Lemma alloc_globals_rev_eq:
forall F V (ge: Genv.t F V) m vl,
Genv.alloc_globals ge m (rev vl) = alloc_globals_rev ge m vl.