Move optimization flag selection out of cc wrapper

The mapping of architectures to optimization flags is now retrieved from
Hardware::CPU and the selected flags are passed as an environmen
variable, rather than duplicated in the cc wrapper and re-calculated on
every invocation of the compiler.

Closes #24540.
Simplify passing archflags to cc wrapper