Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sv2v
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
sv2v
Commits
c28bb71a
Commit
c28bb71a
authored
Jul 15, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more careful expr and type traversals
parent
efe8de39
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
19 additions
and
13 deletions
+19
-13
src/Convert/Enum.hs
+2
-1
src/Convert/IntTypes.hs
+1
-1
src/Convert/Package.hs
+1
-1
src/Convert/ParamType.hs
+4
-3
src/Convert/Simplify.hs
+1
-1
src/Convert/Struct.hs
+2
-1
src/Convert/Traverse.hs
+0
-0
src/Convert/TypeOf.hs
+6
-3
src/Convert/Typedef.hs
+1
-1
src/Convert/Unsigned.hs
+1
-1
No files found.
src/Convert/Enum.hs
View file @
c28bb71a
...
...
@@ -55,7 +55,8 @@ convertDescription' description =
where
-- replace and collect the enum types in this description
(
description'
,
enums
)
=
runWriter
$
traverseModuleItemsM
(
traverseTypesM
traverseType
)
description
traverseModuleItemsM
traverseModuleItemM
description
traverseModuleItemM
=
traverseTypesM
$
traverseNestedTypesM
traverseType
-- convert the collected enums into their corresponding localparams
enumItems
=
concatMap
makeEnumItems
$
Set
.
toList
enums
...
...
src/Convert/IntTypes.hs
View file @
c28bb71a
...
...
@@ -14,7 +14,7 @@ convert =
map
$
traverseDescriptions
$
traverseModuleItems
$
traverseTypes
convertType
traverseTypes
$
traverseNestedTypes
convertType
convertType
::
Type
->
Type
convertType
(
IntegerAtom
kw
sg
)
=
elaborateIntegerAtom
$
IntegerAtom
kw
sg
...
...
src/Convert/Package.hs
View file @
c28bb71a
...
...
@@ -124,7 +124,7 @@ prefixPackageItem packageName idents item =
convertLHSM
other
=
return
other
convertModuleItemM
=
traverseTypesM
convertTypeM
>=>
traverseTypesM
(
traverseNestedTypesM
convertTypeM
)
>=>
traverseExprsM
(
traverseNestedExprsM
convertExprM
)
>=>
traverseLHSsM
(
traverseNestedLHSsM
convertLHSM
)
convertStmtM
=
...
...
src/Convert/ParamType.hs
View file @
c28bb71a
...
...
@@ -243,7 +243,7 @@ isSimpleType typ =
Union
_
fields
_
->
all
(
isSimpleType
.
fst
)
fields
_
->
False
-- returns whether a type contains any dimension queries
-- returns whether a t
op-level t
ype contains any dimension queries
typeHasQueries
::
Type
->
Bool
typeHasQueries
=
not
.
null
.
execWriter
.
collectTypeExprsM
...
...
@@ -257,8 +257,9 @@ typeHasQueries =
collectUnresolvedExprM
_
=
return
()
prepareTypeIdents
::
Identifier
->
Type
->
(
Type
,
IdentSet
)
prepareTypeIdents
prefix
typ
=
runWriter
$
traverseTypeExprsM
(
traverseNestedExprsM
prepareExprIdents
)
typ
prepareTypeIdents
prefix
=
runWriter
.
traverseNestedTypesM
(
traverseTypeExprsM
$
traverseNestedExprsM
prepareExprIdents
)
where
prepareExprIdents
::
Expr
->
Writer
IdentSet
Expr
prepareExprIdents
(
Ident
x
)
=
do
...
...
src/Convert/Simplify.hs
View file @
c28bb71a
...
...
@@ -58,7 +58,7 @@ traverseModuleItemM (Instance m p x rs l) = do
traverseExprsM
traverseExprM
$
Instance
m
p'
x
rs
l
where
paramBindingMapper
(
param
,
Left
t
)
=
do
t'
<-
traverse
TypeExprsM
substituteExprM
t
t'
<-
traverse
NestedTypesM
(
traverseTypeExprsM
substituteExprM
)
t
return
(
param
,
Left
t'
)
paramBindingMapper
(
param
,
Right
e
)
=
return
(
param
,
Right
e
)
traverseModuleItemM
item
=
traverseExprsM
traverseExprM
item
...
...
src/Convert/Struct.hs
View file @
c28bb71a
...
...
@@ -24,7 +24,8 @@ convert = map $ traverseDescriptions convertDescription
convertDescription
::
Description
->
Description
convertDescription
(
description
@
(
Part
_
_
Module
_
_
_
_
))
=
traverseModuleItems
(
traverseTypes'
ExcludeParamTypes
convertType
)
$
traverseModuleItems
(
traverseTypes'
ExcludeParamTypes
$
traverseNestedTypes
convertType
)
$
partScoper
traverseDeclM
traverseModuleItemM
traverseGenItemM
traverseStmtM
description
convertDescription
other
=
other
...
...
src/Convert/Traverse.hs
View file @
c28bb71a
This diff is collapsed.
Click to expand it.
src/Convert/TypeOf.hs
View file @
c28bb71a
...
...
@@ -38,7 +38,7 @@ traverseDeclM decl = do
CommentDecl
{}
->
return
decl'
traverseModuleItemM
::
ModuleItem
->
Scoper
Type
ModuleItem
traverseModuleItemM
=
traverseTypesM
traverseTypeM
traverseModuleItemM
=
traverseTypesM
$
traverseNestedTypesM
traverseTypeM
traverseGenItemM
::
GenItem
->
Scoper
Type
GenItem
traverseGenItemM
=
traverseGenItemExprsM
traverseExprM
...
...
@@ -47,7 +47,8 @@ traverseStmtM :: Stmt -> Scoper Type Stmt
traverseStmtM
=
traverseStmtExprsM
traverseExprM
traverseExprM
::
Expr
->
Scoper
Type
Expr
traverseExprM
=
traverseNestedExprsM
$
traverseExprTypesM
traverseTypeM
traverseExprM
=
traverseNestedExprsM
$
traverseExprTypesM
$
traverseNestedTypesM
traverseTypeM
traverseTypeM
::
Type
->
Scoper
Type
Type
traverseTypeM
(
TypeOf
expr
)
=
typeof
expr
...
...
@@ -62,7 +63,9 @@ lookupTypeOf expr = do
Just
(
_
,
_
,
Implicit
Unspecified
[]
)
->
return
$
IntegerVector
TLogic
Unspecified
[]
Just
(
_
,
replacements
,
typ
)
->
return
$
rewriteType
typ
return
$
if
Map
.
null
replacements
then
typ
else
rewriteType
typ
where
rewriteType
=
traverseNestedTypes
$
traverseTypeExprs
$
traverseNestedExprs
replace
...
...
src/Convert/Typedef.hs
View file @
c28bb71a
...
...
@@ -57,7 +57,7 @@ traverseModuleItemM item = traverseModuleItemM' item
traverseModuleItemM'
::
ModuleItem
->
Scoper
Type
ModuleItem
traverseModuleItemM'
=
traverseTypesM
traverseTypeM
>=>
traverseTypesM
(
traverseNestedTypesM
traverseTypeM
)
>=>
traverseExprsM
(
traverseNestedExprsM
traverseExprM
)
traverseGenItemM
::
GenItem
->
Scoper
Type
GenItem
...
...
src/Convert/Unsigned.hs
View file @
c28bb71a
...
...
@@ -18,7 +18,7 @@ convert =
map
$
traverseDescriptions
$
traverseModuleItems
$
traverseTypes
convertType
traverseTypes
$
traverseNestedTypes
convertType
convertType
::
Type
->
Type
convertType
(
Implicit
Unsigned
rs
)
=
Implicit
Unspecified
rs
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment