X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fcmm%2FCmmParse.y;h=ae23e19494a5daa31a22126664d913eea0289b80;hb=aca87ec3f68c90a5c2c46440ef43b8eb6e5e539f;hp=8679ff221ba6d88a3ca6952b4d6fb8f24ef4bc46;hpb=6e2021202c3eec0c95a9d0b7c355559f2630d380;p=ghc-hetmet.git diff --git a/compiler/cmm/CmmParse.y b/compiler/cmm/CmmParse.y index 8679ff2..ae23e19 100644 --- a/compiler/cmm/CmmParse.y +++ b/compiler/cmm/CmmParse.y @@ -224,18 +224,14 @@ info :: { ExtFCode (CLabel, [CmmLit],[CmmLit]) } | 'INFO_TABLE_CONSTR' '(' NAME ',' INT ',' INT ',' INT ',' INT ',' STRING ',' STRING ')' -- ptrs, nptrs, tag, closure type, description, type - { stdInfo $3 $5 $7 $9 $11 $13 $15 } + { conInfo $3 $5 $7 $9 $11 $13 $15 } | 'INFO_TABLE_SELECTOR' '(' NAME ',' INT ',' INT ',' STRING ',' STRING ')' -- selector, closure type, description, type { basicInfo $3 (mkIntCLit (fromIntegral $5)) 0 $7 $9 $11 } - | 'INFO_TABLE_RET' '(' NAME ',' INT ',' INT ',' INT maybe_vec ')' - { retInfo $3 $5 $7 $9 $10 } - -maybe_vec :: { [CmmLit] } - : {- empty -} { [] } - | ',' NAME maybe_vec { CmmLabel (mkRtsCodeLabelFS $2) : $3 } + | 'INFO_TABLE_RET' '(' NAME ',' INT ',' INT ',' INT ')' + { retInfo $3 $5 $7 $9 } body :: { ExtCode } : {- empty -} { return () } @@ -473,8 +469,7 @@ exprMacros = listToUFM [ ( FSLIT("GET_FUN_INFO"), \ [x] -> funInfoTable (closureInfoPtr x) ), ( FSLIT("INFO_TYPE"), \ [x] -> infoTableClosureType x ), ( FSLIT("INFO_PTRS"), \ [x] -> infoTablePtrs x ), - ( FSLIT("INFO_NPTRS"), \ [x] -> infoTableNonPtrs x ), - ( FSLIT("RET_VEC"), \ [info, conZ] -> retVec info conZ ) + ( FSLIT("INFO_NPTRS"), \ [x] -> infoTableNonPtrs x ) ] -- we understand a subset of C-- primitives: @@ -530,9 +525,9 @@ machOps = listToUFM $ ( "f2f32", flip MO_S_Conv F32 ), -- TODO; rounding mode ( "f2f64", flip MO_S_Conv F64 ), -- TODO; rounding mode ( "f2i8", flip MO_S_Conv I8 ), - ( "f2i16", flip MO_S_Conv I8 ), - ( "f2i32", flip MO_S_Conv I8 ), - ( "f2i64", flip MO_S_Conv I8 ), + ( "f2i16", flip MO_S_Conv I16 ), + ( "f2i32", flip MO_S_Conv I32 ), + ( "f2i64", flip MO_S_Conv I64 ), ( "i2f32", flip MO_S_Conv F32 ), ( "i2f64", flip MO_S_Conv F64 ) ] @@ -612,6 +607,7 @@ stmtMacros = listToUFM [ ( FSLIT("RET_NN"), \[a,b] -> emitRetUT [(NonPtrArg,a),(NonPtrArg,b)]), ( FSLIT("RET_NP"), \[a,b] -> emitRetUT [(NonPtrArg,a),(PtrArg,b)]), ( FSLIT("RET_PPP"), \[a,b,c] -> emitRetUT [(PtrArg,a),(PtrArg,b),(PtrArg,c)]), + ( FSLIT("RET_NPP"), \[a,b,c] -> emitRetUT [(NonPtrArg,a),(PtrArg,b),(PtrArg,c)]), ( FSLIT("RET_NNP"), \[a,b,c] -> emitRetUT [(NonPtrArg,a),(NonPtrArg,b),(PtrArg,c)]), ( FSLIT("RET_NNNP"), \[a,b,c,d] -> emitRetUT [(NonPtrArg,a),(NonPtrArg,b),(NonPtrArg,c),(PtrArg,d)]), ( FSLIT("RET_NPNP"), \[a,b,c,d] -> emitRetUT [(NonPtrArg,a),(PtrArg,b),(NonPtrArg,c),(PtrArg,d)]) @@ -709,17 +705,24 @@ forkLabelledCodeEC ec = do stmts <- getCgStmtsEC ec code (forkCgStmts stmts) -retInfo name size live_bits cl_type vector = do +retInfo name size live_bits cl_type = do let liveness = smallLiveness (fromIntegral size) (fromIntegral live_bits) info_lbl = mkRtsRetInfoLabelFS name (info1,info2) = mkRetInfoTable info_lbl liveness NoC_SRT - (fromIntegral cl_type) vector + (fromIntegral cl_type) return (info_lbl, info1, info2) stdInfo name ptrs nptrs srt_bitmap cl_type desc_str ty_str = basicInfo name (packHalfWordsCLit ptrs nptrs) srt_bitmap cl_type desc_str ty_str +conInfo name ptrs nptrs srt_bitmap cl_type desc_str ty_str = do + (lbl, info1, _) <- basicInfo name (packHalfWordsCLit ptrs nptrs) + srt_bitmap cl_type desc_str ty_str + desc_lit <- code $ mkStringCLit desc_str + let desc_field = makeRelativeRefTo lbl desc_lit + return (lbl, info1, [desc_field]) + basicInfo name layout srt_bitmap cl_type desc_str ty_str = do lit1 <- if opt_SccProfilingOn then code $ mkStringCLit desc_str