import Digraph ( stronglyConnComp, SCC(..) )
import HeapOffs ( possiblyEqualHeapOffset )
import Id ( fIRST_TAG, ConTag )
-import Literal ( literalPrimRep, Literal(..) )
+import Literal ( literalPrimRep, Literal(..), mkMachWord )
import PrimRep ( getPrimRepSize, PrimRep(..) )
import Unique ( Unique{-instance Eq-} )
import UniqSupply ( getUnique, getUniques, splitUniqSupply, UniqSupply )
import Util ( assocDefaultUsing, panic )
+import CmdLineOpts ( opt_ProduceC )
+import Maybes ( maybeToBool )
+import PrimOp ( PrimOp(..) )
infixr 9 `thenFlt`
\end{code}
-- We also need to convert to Literals to keep the CSwitch happy
adjust tagged_alts
- = [ (MachInt (toInteger (tag - fIRST_TAG)) False{-unsigned-}, abs_c)
- | (tag, abs_c) <- tagged_alts ]
+ = [ (mkMachWord (fromInt (tag - fIRST_TAG)), abs_c) | (tag, abs_c) <- tagged_alts ]
\end{code}
%************************************************************************
\begin{code}
magicIdPrimRep BaseReg = PtrRep
magicIdPrimRep StkOReg = PtrRep
-magicIdPrimRep (VanillaReg kind _) = kind
+magicIdPrimRep (VanillaReg kind _) = kind
magicIdPrimRep (FloatReg _) = FloatRep
magicIdPrimRep (DoubleReg _) = DoubleRep
+magicIdPrimRep (LongReg kind _) = kind
magicIdPrimRep TagReg = IntRep
magicIdPrimRep RetReg = RetRep
magicIdPrimRep SpA = PtrRep
do_alt deflt_amode Nothing = returnFlt (deflt_amode, AbsCNop)
do_alt deflt_amode (Just alt) = flatAmode alt
- bogus_default_label = panic "flatAbsC: CRetVector: default needed and not available"
+ bogus_default_label = panic ("flatAbsC: CRetVector: default needed and not available")
flatAbsC (CRetUnVector label amode)
= flatAmode cc `thenFlt` \ (new_cc, tops) ->
returnFlt (CInitHdr a b new_cc u, tops)
+flatAbsC stmt@(COpStmt results td@(CCallOp (Right _) _ _ _ _ _) args liveness_mask vol_regs)
+ | maybeToBool opt_ProduceC
+ = flatAmodes results `thenFlt` \ (results_here, tops1) ->
+ flatAmodes args `thenFlt` \ (args_here, tops2) ->
+ let tdef = CCallTypedef td results args in
+ returnFlt (COpStmt results_here td args_here liveness_mask vol_regs,
+ mkAbsCStmts tdef (mkAbsCStmts tops1 tops2))
+
flatAbsC stmt@(COpStmt results op args liveness_mask vol_regs)
= flatAmodes results `thenFlt` \ (results_here, tops1) ->
flatAmodes args `thenFlt` \ (args_here, tops2) ->