Don't store LlvmConfig into DynFlags

Closed Sylvain Henry requested to merge hsyl20/ghc:hsyl20/dynflags-llvm-config into master
Don't store LlvmConfig into DynFlags

LlvmConfig contains information read from llvm-passes and llvm-targets
files in GHC's top directory. Reading these files is done only when
needed (i.e. when the LLVM backend is used) and cached for the whole
compiler session. This patch changes the way this is done:

- Split LlvmConfig into LlvmConfig and LlvmConfigCache

- Store LlvmConfigCache in HscEnv instead of DynFlags: there is no
  good reason to store it in DynFlags. As it is fixed per session, we
  store it in the session state instead (HscEnv).

- Initializing LlvmConfigCache required some changes to driver functions
  such as newHscEnv. I've used the opportunity to move initHscEnv from
  the top-level GHC module to GHC.Driver.Main. I've also made
  `cmmPipeline` independent of HscEnv in order to remove the call to
  newHscEnv in regalloc_unit_tests.

Progress towards #17957

Edited by Sylvain Henry

Merge request reports