For BC labels, emit empty data section instead of empty proc.
authorEdward Z. Yang <ezyang@mit.edu>
Wed, 13 Apr 2011 14:29:48 +0000 (15:29 +0100)
committerEdward Z. Yang <ezyang@mit.edu>
Wed, 13 Apr 2011 23:32:25 +0000 (00:32 +0100)
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@mit.edu>

compiler/codeGen/CodeGen.lhs
compiler/codeGen/StgCmm.hs

index 81a65f7..7a7bf48 100644 (file)
@@ -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 ()
index fa3dcfe..2bfe187 100644 (file)
@@ -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) ]
         }
 
 ---------------------------------------------------------------