X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FcodeGen%2FCgTailCall.lhs;h=6f8fd040cbf8bc5cee1edfea9db464511813e5ab;hp=16369ab573ef89f1e33308f47be37227c35913c5;hb=0d4d93a38a2aff950bcd12ebb46a2582d68f5de4;hpb=7fc749a43b4b6b85d234fa95d4928648259584f4 diff --git a/compiler/codeGen/CgTailCall.lhs b/compiler/codeGen/CgTailCall.lhs index 16369ab..6f8fd04 100644 --- a/compiler/codeGen/CgTailCall.lhs +++ b/compiler/codeGen/CgTailCall.lhs @@ -5,13 +5,6 @@ % Code generation for tail calls. \begin{code} -{-# OPTIONS -w #-} --- The above warning supression flag is a temporary kludge. --- While working on this module you are encouraged to remove it and fix --- any warnings in the module. See --- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings --- for details - module CgTailCall ( cgTailCall, performTailCall, performReturn, performPrimReturn, @@ -34,7 +27,6 @@ import CgUtils import CgTicky import ClosureInfo import SMRep -import MachOp import Cmm import CmmUtils import CLabel @@ -115,9 +107,8 @@ performTailCall fun_info arg_amodes pending_assts opt_node_asst | nodeMustPointToIt lf_info = node_asst | otherwise = noStmts ; EndOfBlockInfo sp _ <- getEndOfBlockInfo - ; this_pkg <- getThisPackage - ; case (getCallMethod fun_name lf_info (length arg_amodes)) of + ; case (getCallMethod fun_name fun_has_cafs lf_info (length arg_amodes)) of -- Node must always point to things we enter EnterIt -> do @@ -142,7 +133,7 @@ performTailCall fun_info arg_amodes pending_assts -- A real constructor. Don't bother entering it, -- just do the right sort of return instead. -- As with any return, Node must point to it. - ReturnCon con -> do + ReturnCon _ -> do { emitSimultaneously (node_asst `plusStmts` pending_assts) ; doFinalJump sp False emitReturnInstr } @@ -184,8 +175,10 @@ performTailCall fun_info arg_amodes pending_assts } } where - fun_name = idName (cgIdInfoId fun_info) + fun_id = cgIdInfoId fun_info + fun_name = idName fun_id lf_info = cgIdInfoLF fun_info + fun_has_cafs = idCafInfo fun_id untag_node = CmmAssign nodeReg (cmmUntag (CmmReg nodeReg)) -- Test if closure is a constructor maybeSwitchOnCons enterClosure eob @@ -227,6 +220,7 @@ performTailCall fun_info arg_amodes pending_assts where --cond1 tag = cmmULtWord tag lowCons -- More efficient than the above? +{- tag_expr = cmmGetClosureType (CmmReg nodeReg) cond1 tag = cmmEqWord tag (CmmLit (mkIntCLit 0)) cond2 tag = cmmUGtWord tag highCons @@ -234,11 +228,11 @@ performTailCall fun_info arg_amodes pending_assts -- CONSTR highCons = CmmLit (mkIntCLit 8) -- CONSTR_NOCAF_STATIC (from ClosureType.h) +-} - -untagCmmAssign (CmmAssign r cmmExpr) = CmmAssign r (cmmUntag cmmExpr) -untagCmmAssign stmt = stmt - +directCall :: VirtualSpOffset -> CLabel -> [(CgRep, CmmExpr)] + -> [(CgRep, CmmExpr)] -> CmmStmts + -> Code directCall sp lbl args extra_args assts = do let -- First chunk of args go in registers @@ -289,7 +283,7 @@ performReturn :: Code -- The code to execute to actually do the return -> Code performReturn finish_code - = do { EndOfBlockInfo args_sp sequel <- getEndOfBlockInfo + = do { EndOfBlockInfo args_sp _sequel <- getEndOfBlockInfo ; doFinalJump args_sp False{-not a LNE-} finish_code } -- ---------------------------------------------------------------------------- @@ -321,7 +315,7 @@ performPrimReturn rep amode returnUnboxedTuple :: [(CgRep, CmmExpr)] -> Code returnUnboxedTuple amodes - = do { eob@(EndOfBlockInfo args_sp sequel) <- getEndOfBlockInfo + = do { (EndOfBlockInfo args_sp _sequel) <- getEndOfBlockInfo ; tickyUnboxedTupleReturn (length amodes) ; (final_sp, assts) <- pushUnboxedTuple args_sp amodes ; emitSimultaneously assts @@ -415,7 +409,7 @@ tailCallPrimOp op args pushReturnAddress :: EndOfBlockInfo -> Code -pushReturnAddress (EndOfBlockInfo args_sp sequel@(CaseAlts lbl _ _)) +pushReturnAddress (EndOfBlockInfo args_sp (CaseAlts lbl _ _)) = do { sp_rel <- getSpRelOffset args_sp ; stmtC (CmmStore sp_rel (mkLblExpr lbl)) } @@ -475,3 +469,4 @@ adjustSpAndHp newRealSp ; setRealHp vHp } \end{code} +