X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=utils%2Fgenprimopcode%2FMain.hs;h=b96e9b4f41c84a90f9b663d904bd007449882669;hb=d7fcc5eb8e926038240078ebfccea05f4f3eb1da;hp=fa4973a7af2919aa05f4bed07a57a223d46ef9f0;hpb=03ffa2bfa6c31dc6bcdcacecc2bdb3bbabd800a9;p=ghc-hetmet.git diff --git a/utils/genprimopcode/Main.hs b/utils/genprimopcode/Main.hs index fa4973a..b96e9b4 100644 --- a/utils/genprimopcode/Main.hs +++ b/utils/genprimopcode/Main.hs @@ -62,11 +62,6 @@ main = getArgs >>= \args -> "strictness" "primOpStrictness" p_o_specs) - "--usage" - -> putStr (gen_switch_from_attribs - "usage" - "primOpUsg" p_o_specs) - "--primop-primop-info" -> putStr (gen_primop_info p_o_specs) @@ -97,7 +92,6 @@ known_args "--needs-wrapper", "--can-fail", "--strictness", - "--usage", "--primop-primop-info", "--primop-tag", "--primop-list", @@ -259,7 +253,6 @@ gen_latex_doc (Info defaults entries) ++ mk_needs_wrapper o ++ "}{" ++ mk_can_fail o ++ "}{" ++ latex_encode (mk_strictness o) ++ "}{" - ++ latex_encode (mk_usage o) ++ "}" mk_has_side_effects o = mk_bool_opt o "has_side_effects" "Has side effects." "Has no side effects." @@ -281,12 +274,6 @@ gen_latex_doc (Info defaults entries) Just _ -> error "Boolean value for strictness" Nothing -> "" - mk_usage o = - case lookup_attrib "usage" o of - Just (OptionString _ s) -> s -- for now - Just _ -> error "Boolean value for usage" - Nothing -> "" - zencode xs = case maybe_tuple xs of Just n -> n -- Tuples go to Z2T etc @@ -389,12 +376,14 @@ gen_primop_list (Info _ entries) gen_primop_tag :: Info -> String gen_primop_tag (Info _ entries) - = unlines (max_def : zipWith f primop_entries [1 :: Int ..]) + = unlines (max_def_type : max_def : + tagOf_type : zipWith f primop_entries [1 :: Int ..]) where - primop_entries = filter is_primop entries - f i n = "tagOf_PrimOp " ++ cons i - ++ " = _ILIT(" ++ show n ++ ") :: FastInt" - max_def = "maxPrimOpTag = " ++ show (length primop_entries) ++ " :: Int" + primop_entries = filter is_primop entries + tagOf_type = "tagOf_PrimOp :: PrimOp -> FastInt" + f i n = "tagOf_PrimOp " ++ cons i ++ " = _ILIT(" ++ show n ++ ")" + max_def_type = "maxPrimOpTag :: Int" + max_def = "maxPrimOpTag = " ++ show (length primop_entries) gen_data_decl :: Info -> String gen_data_decl (Info _ entries) @@ -421,7 +410,7 @@ gen_switch_from_attribs attrib_name fn_name (Info defaults entries) Nothing -> error ("gen_switch_from: " ++ attrib_name) Just xx -> unlines alternatives - ++ fn_name ++ " other = " ++ getAltRhs xx ++ "\n" + ++ fn_name ++ " _ = " ++ getAltRhs xx ++ "\n" ------------------------------------------------------------------ -- Create PrimOpInfo text from PrimOpSpecs -----------------------