  We investigate Yang--Mills instanton theory over four dimensional
asymptotically locally flat (ALF) geometries, including gravitational
instantons of this type, by exploiting the existence of a natural smooth
compactification of these spaces introduced by Hausel--Hunsicker--Mazzeo.
  First referring to the codimension 2 singularity removal theorem of
Sibner--Sibner and Rade we prove that given a smooth, finite energy, self-dual
SU(2) connection over a complete ALF space, its energy is congruent to a
Chern--Simons invariant of the boundary three-manifold if the connection
satisfies a certain holonomy condition at infinity and its curvature decays
rapidly.
  Then we introduce framed moduli spaces of self-dual connections over Ricci
flat ALF spaces. We prove that the moduli space of smooth, irreducible, rapidly
decaying self-dual connections obeying the holonomy condition with fixed finite
energy and prescribed asymptotic behaviour on a fixed bundle is a finite
dimensional manifold. We calculate its dimension by a variant of the
Gromov--Lawson relative index theorem.
  As an application, we study Yang--Mills instantons over the flat R^3 x S^1,
the multi-Taub--NUT family, and the Riemannian Schwarzschild space.
