  [abridged] We quantify the evolution of the stellar mass functions of
star-forming and quiescent galaxies as a function of morphology from $z\sim 3$
to the present. Our sample consists of ~50,000 galaxies in the CANDELS fields
($\sim880$ $arcmin^2$), which we divide into four main morphological types,
i.e. pure bulge dominated systems, pure spiral disk dominated, intermediate
2-component bulge+disk systems and irregular disturbed galaxies. Our main
results are:
  Star-formation: At $z\sim 2$, 80\% of the stellar mass density of
star-forming galaxies is in irregular systems. However, by $z\sim 0.5$,
irregular objects only dominate at stellar masses below $10^9M\odot$. A
majority of the star-forming irregulars present at $z\sim 2$ undergo a gradual
transformation from disturbed to normal spiral disk morphologies by $z\sim 1$
without significant interruption to their star-formation. Rejuvenation after a
quenching event does not seem to be common except perhaps for the most massive
objects.
  Quenching: We confirm that galaxies reaching a stellar mass of
$M_*\sim10^{10.8}M_\odot$ ($M^*$) tend to quench. Also, quenching implies the
presence of a bulge: the abundance of massive red disks is negligible at all
redshifts over 2~dex in stellar mass. However the dominant quenching mechanism
evolves. At $z>2$, the SMF of quiescent galaxies above $M^*$ is dominated by
compact spheroids. Quenching at this early epoch destroys the disk and produces
a compact remnant unless the star-forming progenitors at even higher redshifts
are significantly more dense. At $1<z<2$, the majority of newly quenched
galaxies are disks with a significant central bulge. This suggests that
mass-quenching at this epoch starts from the inner parts and preserves the
disk. At $z<1$, the high mass end of the passive SMF is globally in place and
the evolution mostly happens at stellar masses below $10^{10}M_\odot$.
