First-principles study of pressure-induced phase transformations in thermoelectric Mg2Si