From: simonmar Date: Fri, 22 Apr 2005 10:21:10 +0000 (+0000) Subject: [project @ 2005-04-22 10:21:10 by simonmar] X-Git-Tag: Initial_conversion_from_CVS_complete~705 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=b0cfcc189e7280a1f18cdead8b875e4c42db5df0;p=ghc-hetmet.git [project @ 2005-04-22 10:21:10 by simonmar] pprLit: when printing a CLabel, prefix it with '&'. This ensures we get the address rather than the value, in the case when the C label refers to a variable (as might be the case if it is from a foreign import, for example). --- diff --git a/ghc/compiler/cmm/PprC.hs b/ghc/compiler/cmm/PprC.hs index 10d4da2..7804fb6 100644 --- a/ghc/compiler/cmm/PprC.hs +++ b/ghc/compiler/cmm/PprC.hs @@ -366,8 +366,8 @@ pprLit :: CmmLit -> SDoc pprLit lit = case lit of CmmInt i rep -> pprHexVal i rep CmmFloat f rep -> parens (machRepCType rep) <> (rational f) - CmmLabel clbl -> mkW_ <> pprCLabel clbl - CmmLabelOff clbl i -> mkW_ <> pprCLabel clbl <> char '+' <> int i + CmmLabel clbl -> mkW_ <> pprCLabelAddr clbl + CmmLabelOff clbl i -> mkW_ <> pprCLabelAddr clbl <> char '+' <> int i CmmLabelDiffOff clbl1 clbl2 i -- WARNING: -- * the lit must occur in the info table clbl2 @@ -375,7 +375,9 @@ pprLit lit = case lit of -- The Mangler is expected to convert any reference to an SRT, -- a slow entry point or a large bitmap -- from an info table to an offset. - -> mkW_ <> pprCLabel clbl1 <> char '+' <> int i + -> mkW_ <> pprCLabelAddr clbl1 <> char '+' <> int i + +pprCLabelAddr lbl = char '&' <> pprCLabel lbl pprLit1 :: CmmLit -> SDoc pprLit1 lit@(CmmLabelOff _ _) = parens (pprLit lit)