Electronic and optical properties of the antifluorite semiconductors Be2C and Mg2X (X=C, Si, Ge) under hydrostatic pressure