From b0cfcc189e7280a1f18cdead8b875e4c42db5df0 Mon Sep 17 00:00:00 2001 From: simonmar Date: Fri, 22 Apr 2005 10:21:10 +0000 Subject: [PATCH] [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). --- ghc/compiler/cmm/PprC.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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) -- 1.7.10.4