Add missing opening braces in Cmm dumps
authorÖmer Sinan Ağacan <omeragacan@gmail.com>
Fri, 24 May 2019 18:28:45 +0000 (21:28 +0300)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Mon, 27 May 2019 14:06:37 +0000 (10:06 -0400)
Previously -ddump-cmm was generating code with unbalanced curly braces:

     stg_atomically_entry() //  [R1]
             { info_tbls: [(cfl,
                            label: stg_atomically_info
                            rep: tag:16 HeapRep 1 ptrs { Thunk }
                            srt: Nothing)]
               stack_info: arg_space: 8 updfr_space: Just 8
             }
         {offset
           cfl: // cfk
               unwind Sp = Just Sp + 0;
               _cfk::P64 = R1;
               //tick src<rts/PrimOps.cmm:(1243,1)-(1245,1)>
               R1 = I64[_cfk::P64 + 8 + 8 + 0 * 8];
               call stg_atomicallyzh(R1) args: 8, res: 0, upd: 8;
         }
     }, <---- OPENING BRACE MISSING

After this patch:

     stg_atomically_entry() { //  [R1] <---- MISSING OPENING BRACE HERE
             { info_tbls: [(cfl,
                            label: stg_atomically_info
                            rep: tag:16 HeapRep 1 ptrs { Thunk }
                            srt: Nothing)]
               stack_info: arg_space: 8 updfr_space: Just 8
             }
         {offset
           cfl: // cfk
               unwind Sp = Just Sp + 0;
               _cfk::P64 = R1;
               //tick src<rts/PrimOps.cmm:(1243,1)-(1245,1)>
               R1 = I64[_cfk::P64 + 8 + 8 + 0 * 8];
               call stg_atomicallyzh(R1) args: 8, res: 0, upd: 8;
         }
     },

compiler/cmm/PprCmmDecl.hs

index ea01c29..e54abdc 100644 (file)
@@ -94,7 +94,7 @@ pprTop :: (Outputable d, Outputable info, Outputable i)
 
 pprTop (CmmProc info lbl live graph)
 
-  = vcat [ ppr lbl <> lparen <> rparen <+> text "// " <+> ppr live
+  = vcat [ ppr lbl <> lparen <> rparen <+> lbrace <+> text "// " <+> ppr live
          , nest 8 $ lbrace <+> ppr info $$ rbrace
          , nest 4 $ ppr graph
          , rbrace ]