Skip to content
  • Sylvain Henry's avatar
    ef3c8d9e
    Don't store LlvmConfig into DynFlags · ef3c8d9e
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    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 untangle initHscEnv
      from initGhcMonad (in top-level GHC module) and to move it to
      GHC.Driver.Main, close to newHscEnv.
    
    - I've also made `cmmPipeline` independent of HscEnv in order to remove
      the call to newHscEnv in regalloc_unit_tests.
    ef3c8d9e
    Don't store LlvmConfig into DynFlags
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    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 untangle initHscEnv
      from initGhcMonad (in top-level GHC module) and to move it to
      GHC.Driver.Main, close to newHscEnv.
    
    - I've also made `cmmPipeline` independent of HscEnv in order to remove
      the call to newHscEnv in regalloc_unit_tests.
Loading