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
bdc7b5ad
Commit
bdc7b5ad
authored
Apr 21, 2021
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace some invariant errors with pattern matching
parent
cfff359b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
12 deletions
+8
-12
src/Convert/MultiplePacked.hs
+6
-8
src/Convert/ParamType.hs
+2
-4
No files found.
src/Convert/MultiplePacked.hs
View file @
bdc7b5ad
...
@@ -261,10 +261,9 @@ convertExpr scopes =
...
@@ -261,10 +261,9 @@ convertExpr scopes =
baseOuter'
=
orientIdx
dimOuter
baseOuter
baseOuter'
=
orientIdx
dimOuter
baseOuter
start
=
BinOp
Mul
idxInner'
(
rangeSize
dimOuter
)
start
=
BinOp
Mul
idxInner'
(
rangeSize
dimOuter
)
baseDec
=
BinOp
Add
start
baseOuter'
baseDec
=
BinOp
Add
start
baseOuter'
baseInc
=
case
modeOuter
of
baseInc
=
if
modeOuter
==
IndexedPlus
IndexedPlus
->
BinOp
Add
(
BinOp
Sub
baseDec
len
)
one
then
BinOp
Add
(
BinOp
Sub
baseDec
len
)
one
IndexedMinus
->
BinOp
Sub
(
BinOp
Add
baseDec
len
)
one
else
BinOp
Sub
(
BinOp
Add
baseDec
len
)
one
NonIndexed
->
error
"invariant violated"
base
=
endianCondExpr
dimOuter
baseDec
baseInc
base
=
endianCondExpr
dimOuter
baseDec
baseInc
len
=
lenOuter
len
=
lenOuter
range'
=
(
base
,
len
)
range'
=
(
base
,
len
)
...
@@ -309,16 +308,15 @@ convertExpr scopes =
...
@@ -309,16 +308,15 @@ convertExpr scopes =
lenOrigMinusOne
=
BinOp
Sub
lenOrig
(
RawNum
1
)
lenOrigMinusOne
=
BinOp
Sub
lenOrig
(
RawNum
1
)
baseSwapped
=
baseSwapped
=
orientIdx
dimInner
$
orientIdx
dimInner
$
case
mode
of
if
mode
==
IndexedPlus
IndexedPlus
->
then
endianCondExpr
dimInner
endianCondExpr
dimInner
baseOrig
baseOrig
(
BinOp
Add
baseOrig
lenOrigMinusOne
)
(
BinOp
Add
baseOrig
lenOrigMinusOne
)
IndexedMinus
->
else
endianCondExpr
dimInner
endianCondExpr
dimInner
(
BinOp
Sub
baseOrig
lenOrigMinusOne
)
(
BinOp
Sub
baseOrig
lenOrigMinusOne
)
baseOrig
baseOrig
NonIndexed
->
error
"invariant violated"
base
=
BinOp
Add
offsetOuter
(
BinOp
Mul
sizeOuter
baseSwapped
)
base
=
BinOp
Add
offsetOuter
(
BinOp
Mul
sizeOuter
baseSwapped
)
mode'
=
IndexedPlus
mode'
=
IndexedPlus
len
=
BinOp
Mul
sizeOuter
lenOrig
len
=
BinOp
Mul
sizeOuter
lenOrig
...
...
src/Convert/ParamType.hs
View file @
bdc7b5ad
...
@@ -52,8 +52,7 @@ convert files =
...
@@ -52,8 +52,7 @@ convert files =
isNonDefault
=
(
name
/=
)
.
moduleName
isNonDefault
=
(
name
/=
)
.
moduleName
alreadyExists
=
(
flip
Map
.
member
info
)
.
moduleName
alreadyExists
=
(
flip
Map
.
member
info
)
.
moduleName
moduleName
::
Description
->
Identifier
moduleName
::
Description
->
Identifier
moduleName
(
Part
_
_
_
_
x
_
_
)
=
x
moduleName
=
\
(
Part
_
_
_
_
x
_
_
)
->
x
moduleName
_
=
error
"not possible"
explodeDescription
other
=
[
other
]
explodeDescription
other
=
[
other
]
-- remove or rewrite source modules that are no longer needed
-- remove or rewrite source modules that are no longer needed
...
@@ -109,7 +108,7 @@ convert files =
...
@@ -109,7 +108,7 @@ convert files =
replaceDefault
_
other
=
[
other
]
replaceDefault
_
other
=
[
other
]
removeDefaultTypeParams
::
Description
->
Description
removeDefaultTypeParams
::
Description
->
Description
removeDefaultTypeParams
(
part
@
Part
{})
=
removeDefaultTypeParams
part
=
Part
attrs
extern
kw
ml
(
moduleDefaultName
name
)
p
items
Part
attrs
extern
kw
ml
(
moduleDefaultName
name
)
p
items
where
where
Part
attrs
extern
kw
ml
name
p
items
=
Part
attrs
extern
kw
ml
name
p
items
=
...
@@ -118,7 +117,6 @@ convert files =
...
@@ -118,7 +117,6 @@ convert files =
rewriteDecl
(
ParamType
Parameter
x
_
)
=
rewriteDecl
(
ParamType
Parameter
x
_
)
=
ParamType
Parameter
x
UnknownType
ParamType
Parameter
x
UnknownType
rewriteDecl
other
=
other
rewriteDecl
other
=
other
removeDefaultTypeParams
_
=
error
"not possible"
isUsed
::
Identifier
->
Bool
isUsed
::
Identifier
->
Bool
isUsed
name
=
isUsed
name
=
...
...
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