remove some dead code

This commit is contained in:
Zachary Snow 2021-07-16 12:30:35 -04:00
parent d6d3938d20
commit dd951740e7
6 changed files with 7 additions and 29 deletions

View File

@ -21,6 +21,5 @@ convertFunction (MIPackageItem (Function ml t f decls stmts)) =
where
t' = case t of
IntegerVector TReg sg rs -> Implicit sg rs
IntegerVector TLogic sg rs -> Implicit sg rs
_ -> t
convertFunction other = other

View File

@ -8,7 +8,7 @@
module Convert.TFBlock (convert) where
import Data.List (intersect, isPrefixOf)
import Data.List (intersect)
import Convert.Traverse
import Language.SystemVerilog.AST
@ -53,7 +53,7 @@ flattenOuterBlocks (Block Seq "" declsA (Block Seq name declsB stmtsA : stmtsB))
Block Seq name (declsA ++ declsB) (stmtsA ++ stmtsB)
else (declsA, Block Seq name declsB stmtsA : stmtsB)
flattenOuterBlocks (Block Seq name decls stmts)
| notscope name = (decls, stmts)
| null name = (decls, stmts)
| otherwise = ([], [Block Seq name decls stmts])
flattenOuterBlocks stmt = ([], [stmt])
@ -72,7 +72,3 @@ declName (Net _ _ _ _ x _ _) = x
declName (Param _ _ x _) = x
declName (ParamType _ x _) = x
declName CommentDecl{} = ""
notscope :: Identifier -> Bool
notscope "" = True
notscope name = "sv2v_autoblock_" `isPrefixOf` name

View File

@ -37,10 +37,7 @@ instance Show Decl where
where tStr = if t == UnknownType then "" else " = " ++ show t
show (Variable d t x a e) = printf "%s%s%s%s%s;" (showPad d) (showPad t) x (showRanges a) (showAssignment e)
show (Net d n s t x a e) = printf "%s%s%s %s%s%s%s;" (showPad d) (show n) (showPadBefore s) (showPad t) x (showRanges a) (showAssignment e)
show (CommentDecl c) =
if elem '\n' c
then "// " ++ show c
else "// " ++ c
show (CommentDecl c) = "// " ++ c
data Direction
= Input

View File

@ -199,6 +199,5 @@ showParams :: [ParamBinding] -> String
showParams params = indentedParenList $ map showParam params
showParam :: ParamBinding -> String
showParam ("*", Right Nil) = ".*"
showParam ("", arg) = showEither arg
showParam (i, arg) = printf ".%s(%s)" i (showEither arg)

View File

@ -42,7 +42,7 @@ instance Show GenItem where
x1 (show e1)
(show c)
x2 (show o2) (show e2)
(if s == GenNull then "begin end" else showBareBlock s)
(showBareBlock s)
show (GenNull) = ";"
show (GenModuleItem item) = show item
@ -54,18 +54,8 @@ showBareBlock (GenBlock x i) =
showBareBlock item = show item
showBlockedBranch :: GenItem -> String
showBlockedBranch genItem =
showBareBlock $
if isControl genItem
then GenBlock "" [genItem]
else genItem
where
isControl :: GenItem -> Bool
isControl GenIf{} = True
isControl GenFor{} = True
isControl GenCase{} = True
isControl GenModuleItem{} = True
isControl _ = False
showBlockedBranch genItem@GenBlock{} = showBareBlock genItem
showBlockedBranch genItem = showBareBlock $ GenBlock "" [genItem]
type GenCase = ([Expr], GenItem)

View File

@ -98,10 +98,7 @@ instance Show Stmt where
show (Continue ) = "continue;"
show (Break ) = "break;"
show (Null ) = ";"
show (CommentStmt c) =
if elem '\n' c
then "// " ++ show c
else "// " ++ c
show (CommentStmt c) = "// " ++ c
showAssign :: (LHS, AsgnOp, Expr) -> String
showAssign (l, op, e) = (showPad l) ++ (showPad op) ++ (show e)