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 =
baseOuter'
=
orientIdx
dimOuter
baseOuter
start
=
BinOp
Mul
idxInner'
(
rangeSize
dimOuter
)
baseDec
=
BinOp
Add
start
baseOuter'
baseInc
=
case
modeOuter
of
IndexedPlus
->
BinOp
Add
(
BinOp
Sub
baseDec
len
)
one
IndexedMinus
->
BinOp
Sub
(
BinOp
Add
baseDec
len
)
one
NonIndexed
->
error
"invariant violated"
baseInc
=
if
modeOuter
==
IndexedPlus
then
BinOp
Add
(
BinOp
Sub
baseDec
len
)
one
else
BinOp
Sub
(
BinOp
Add
baseDec
len
)
one
base
=
endianCondExpr
dimOuter
baseDec
baseInc
len
=
lenOuter
range'
=
(
base
,
len
)
...
...
@@ -309,16 +308,15 @@ convertExpr scopes =
lenOrigMinusOne
=
BinOp
Sub
lenOrig
(
RawNum
1
)
baseSwapped
=
orientIdx
dimInner
$
case
mode
of
IndexedPlus
->
if
mode
==
IndexedPlus
then
endianCondExpr
dimInner
baseOrig
(
BinOp
Add
baseOrig
lenOrigMinusOne
)
IndexedMinus
->
else
endianCondExpr
dimInner
(
BinOp
Sub
baseOrig
lenOrigMinusOne
)
baseOrig
NonIndexed
->
error
"invariant violated"
base
=
BinOp
Add
offsetOuter
(
BinOp
Mul
sizeOuter
baseSwapped
)
mode'
=
IndexedPlus
len
=
BinOp
Mul
sizeOuter
lenOrig
...
...
src/Convert/ParamType.hs
View file @
bdc7b5ad
...
...
@@ -52,8 +52,7 @@ convert files =
isNonDefault
=
(
name
/=
)
.
moduleName
alreadyExists
=
(
flip
Map
.
member
info
)
.
moduleName
moduleName
::
Description
->
Identifier
moduleName
(
Part
_
_
_
_
x
_
_
)
=
x
moduleName
_
=
error
"not possible"
moduleName
=
\
(
Part
_
_
_
_
x
_
_
)
->
x
explodeDescription
other
=
[
other
]
-- remove or rewrite source modules that are no longer needed
...
...
@@ -109,7 +108,7 @@ convert files =
replaceDefault
_
other
=
[
other
]
removeDefaultTypeParams
::
Description
->
Description
removeDefaultTypeParams
(
part
@
Part
{})
=
removeDefaultTypeParams
part
=
Part
attrs
extern
kw
ml
(
moduleDefaultName
name
)
p
items
where
Part
attrs
extern
kw
ml
name
p
items
=
...
...
@@ -118,7 +117,6 @@ convert files =
rewriteDecl
(
ParamType
Parameter
x
_
)
=
ParamType
Parameter
x
UnknownType
rewriteDecl
other
=
other
removeDefaultTypeParams
_
=
error
"not possible"
isUsed
::
Identifier
->
Bool
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