summaryrefslogtreecommitdiff
path: root/compiler/main/TidyPgm.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/main/TidyPgm.hs')
-rw-r--r--compiler/main/TidyPgm.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/main/TidyPgm.hs b/compiler/main/TidyPgm.hs
index 52137a4cd7..55e790b887 100644
--- a/compiler/main/TidyPgm.hs
+++ b/compiler/main/TidyPgm.hs
@@ -379,6 +379,13 @@ tidyProgram hsc_env (ModGuts { mg_module = mod
-- See SimplCore Note [Grand plan for static forms]
; spt_init_code = sptModuleInitCode mod all_tidy_binds
+ ; add_spt_init_code =
+ case hscTarget dflags of
+ -- If we are compiling for the interpreter we will insert
+ -- any necessary SPT entries dynamically
+ HscInterpreted -> id
+ -- otherwise add a C stub to do so
+ _ -> (`appendStubC` spt_init_code)
-- Get the TyCons to generate code for. Careful! We must use
-- the untidied TypeEnv here, because we need
@@ -413,8 +420,7 @@ tidyProgram hsc_env (ModGuts { mg_module = mod
; return (CgGuts { cg_module = mod,
cg_tycons = alg_tycons,
cg_binds = all_tidy_binds,
- cg_foreign = foreign_stubs `appendStubC`
- spt_init_code,
+ cg_foreign = add_spt_init_code foreign_stubs,
cg_dep_pkgs = map fst $ dep_pkgs deps,
cg_hpc_info = hpc_info,
cg_modBreaks = modBreaks },