Skip to content

Refactor backend related code

Sylvain Henry requested to merge hsyl20/ghc:hsyl20/hadrian/ncg into master

Some refactoring of our backend handling code, especially NCG. It makes the build system a little bit simpler (see commit 5 below).

Commit 1: Remove unused "ncg" flag

This flag has been removed in 066b369de2c6f7da03c88206288dca29ab061b31
in 2011.

Commit 2: Don't panic if the NCG isn't built (it is always built)

Commit 3: Remove unused sGhcWithNativeCodeGen

Commit 4: Correctly test active backend

Previously we used a platform settings to detect if the native code
generator was used. This was wrong. We need to use the
`DynFlags.hscTarget` field instead.

Commit 5: Replace ghcWithNativeCodeGen with a proper Backend datatype

* Represent backends with a `Backend` datatype in GHC.Driver.Backend

* Don't detect the default backend to use for the target platform at
  compile time in Hadrian/make but at runtime. It makes "Settings"
  simpler and it is a step toward making GHC multi-target.

Commit 6: Replace HscTarget with Backend

Edited by Sylvain Henry

Merge request reports