Phase diagram of quasi-one-dimensional metals and superconductivity in the (TMTSF)2X compounds