[commit: ghc] master: For BC labels, emit empty data section instead of empty proc. (b1cf9aa)
Edward Z. Yang
ezyang at MIT.EDU
Thu Apr 14 01:32:49 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/b1cf9aae4a495b619375da716d6d14f7cb494f8e
>---------------------------------------------------------------
commit b1cf9aae4a495b619375da716d6d14f7cb494f8e
Author: Edward Z. Yang <ezyang at mit.edu>
Date: Wed Apr 13 15:29:48 2011 +0100
For BC labels, emit empty data section instead of empty proc.
This fixes two bugs:
- The new code generator doesn't like procedures with
empty graphs, and panicked in labelAGraph.
- LLVM optimizes away empty procedures but not empty
data sections, so now the backwards-compatibility
labels actually work with -fllvm.
Signed-off-by: Edward Z. Yang <ezyang at mit.edu>
>---------------------------------------------------------------
compiler/codeGen/CodeGen.lhs | 2 +-
compiler/codeGen/StgCmm.hs | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/compiler/codeGen/CodeGen.lhs b/compiler/codeGen/CodeGen.lhs
index 81a65f7..7a7bf48 100644
--- a/compiler/codeGen/CodeGen.lhs
+++ b/compiler/codeGen/CodeGen.lhs
@@ -105,7 +105,7 @@ mkModuleInit dflags cost_centre_info this_mod hpc_info
-- For backwards compatibility: user code may refer to this
-- label for calling hs_add_root().
- ; emitSimpleProc (mkPlainModuleInitLabel this_mod) $ return ()
+ ; emitData Data $ [ CmmDataLabel (mkPlainModuleInitLabel this_mod) ]
; whenC (this_mod == mainModIs dflags) $
emitSimpleProc (mkPlainModuleInitLabel rOOT_MAIN) $ return ()
diff --git a/compiler/codeGen/StgCmm.hs b/compiler/codeGen/StgCmm.hs
index fa3dcfe..2bfe187 100644
--- a/compiler/codeGen/StgCmm.hs
+++ b/compiler/codeGen/StgCmm.hs
@@ -25,6 +25,7 @@ import StgCmmTicky
import MkGraph
import CmmExpr
+import CmmDecl
import CLabel
import PprCmm
@@ -181,7 +182,7 @@ mkModuleInit cost_centre_info this_mod hpc_info
; initCostCentres cost_centre_info
-- For backwards compatibility: user code may refer to this
-- label for calling hs_add_root().
- ; emitSimpleProc (mkPlainModuleInitLabel this_mod) $ emptyAGraph
+ ; emitData Data $ [ CmmDataLabel (mkPlainModuleInitLabel this_mod) ]
}
---------------------------------------------------------------
More information about the Cvs-ghc
mailing list