Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Tobias Decking
GHC
Commits
8d5e92db
Commit
8d5e92db
authored
Jul 26, 2007
by
rl@cse.unsw.edu.au
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix generation of lengthPA
parent
ddcf1140
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
compiler/vectorise/VectMonad.hs
compiler/vectorise/VectMonad.hs
+4
-1
compiler/vectorise/VectType.hs
compiler/vectorise/VectType.hs
+9
-6
No files found.
compiler/vectorise/VectMonad.hs
View file @
8d5e92db
...
...
@@ -3,7 +3,7 @@ module VectMonad (
VM
,
noV
,
tryV
,
maybeV
,
orElseV
,
fixV
,
localV
,
closedV
,
initV
,
cloneName
,
newExportedVar
,
newLocalVar
,
newTyVar
,
cloneName
,
newExportedVar
,
newLocalVar
,
newDummyVar
,
newTyVar
,
Builtins
(
..
),
paDictTyCon
,
paDictDataCon
,
builtin
,
...
...
@@ -297,6 +297,9 @@ newLocalVar fs ty
u
<-
liftDs
newUnique
return
$
mkSysLocal
fs
u
ty
newDummyVar
::
Type
->
VM
Var
newDummyVar
=
newLocalVar
FSLIT
(
"ds"
)
newTyVar
::
FastString
->
Kind
->
VM
Var
newTyVar
fs
k
=
do
...
...
compiler/vectorise/VectType.hs
View file @
8d5e92db
...
...
@@ -315,20 +315,23 @@ paMethods = [(FSLIT("lengthPA"), buildLengthPA),
(
FSLIT
(
"replicatePA"
),
buildReplicatePA
)]
buildLengthPA
::
TyCon
->
TyCon
->
VM
CoreExpr
buildLengthPA
_
arr_tc
buildLengthPA
vect_tc
arr_tc
=
do
arg
<-
newLocalVar
FSLIT
(
"xs"
)
arg_ty
parr_ty
<-
mkPArrayType
(
mkTyConApp
vect_tc
arg_tys
)
arg
<-
newLocalVar
FSLIT
(
"xs"
)
parr_ty
let
scrut
=
unwrapFamInstScrut
arr_tc
arg_tys
(
Var
arg
)
scrut_ty
=
exprType
scrut
shape
<-
newLocalVar
FSLIT
(
"sel"
)
shape_ty
body
<-
lengthPA
(
Var
shape
)
wilds
<-
mapM
newDummyVar
repr_tys
return
.
Lam
arg
$
Case
(
Var
arg
)
(
mkWildId
arg
_ty
)
intPrimTy
[(
DataAlt
repr_dc
,
shape
:
map
mkWildId
repr_ty
s
,
body
)]
$
Case
scrut
(
mkWildId
scrut
_ty
)
intPrimTy
[(
DataAlt
repr_dc
,
shape
:
wild
s
,
body
)]
where
arg_ty
=
mkTyConApp
arr_tc
.
mkTyVarTys
$
tyConTyVars
arr_tc
arg_ty
s
=
mkTyVarTys
$
tyConTyVars
arr_tc
[
repr_dc
]
=
tyConDataCons
arr_tc
shape_ty
:
repr_tys
=
dataConRepArgTys
repr_dc
-- data T = C0 t1 ... tm
-- ...
-- Ck u1 ... un
...
...
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