[Haskell-cafe] Implementing a new primtype

Paul Monday paul.monday at parsci.com
Tue Oct 11 00:57:39 CEST 2011

There seems to be plenty of documentation around on implementing a new primop, much of it needs some tweaking as files have moved and such.  I can't seem to find any documentation about how to implement primtypes though.

For example, I want to experiment with a new primtype "DV#", my assumption that the type was first declared in the primops.txt.pp seems incorrect.  So I'm trying to backtrack a bit and see where primtypes first appear, I'm hoping someone can at least give me a pointer :-)

For example:

Add the following:
primtype DoubleVec# a

Compiles fine

Add a primop on the type:
primop ExtractDoubleVecOp "extractDoubleVec#" GenPrimOp
   DoubleVec# -> Int# -> Double#

And suddenly it's not as friendly.  I expected a compile issue since I hadn't added it to CgPrimOps.hs yet, but this is not that compile problem:
make -r --no-print-directory -f ghc.mk phase=1 phase_1_builds
/usr/bin/gcc -E  -undef -traditional -P -Iincludes  -x c compiler/prelude/primops.txt.pp | grep -v '^#pragma GCC' > compiler/prelude/primops.txt
"inplace/bin/genprimopcode" --data-decl          < compiler/prelude/primops.txt > compiler/primop-data-decl.hs-incl
"inplace/bin/genprimopcode" --primop-tag         < compiler/prelude/primops.txt > compiler/primop-tag.hs-incl
"inplace/bin/genprimopcode" --primop-list        < compiler/prelude/primops.txt > compiler/primop-list.hs-incl
"inplace/bin/genprimopcode" --has-side-effects   < compiler/prelude/primops.txt > compiler/primop-has-side-effects.hs-incl
"inplace/bin/genprimopcode" --out-of-line        < compiler/prelude/primops.txt > compiler/primop-out-of-line.hs-incl
"inplace/bin/genprimopcode" --commutable         < compiler/prelude/primops.txt > compiler/primop-commutable.hs-incl
"inplace/bin/genprimopcode" --code-size          < compiler/prelude/primops.txt > compiler/primop-code-size.hs-incl
"inplace/bin/genprimopcode" --can-fail           < compiler/prelude/primops.txt > compiler/primop-can-fail.hs-incl
"inplace/bin/genprimopcode" --strictness         < compiler/prelude/primops.txt > compiler/primop-strictness.hs-incl
"inplace/bin/genprimopcode" --primop-primop-info < compiler/prelude/primops.txt > compiler/primop-primop-info.hs-incl
genprimopcode: ppType: can't handle: TyApp "DoubleVec#" []

make[1]: *** [compiler/primop-primop-info.hs-incl] Error 1
make[1]: *** Deleting file `compiler/primop-primop-info.hs-incl'
make: *** [all] Error 2

So, I'm thinking the type needs to be better defined but I haven't tracked it down yet (I'm working on it though ;-)

Any clues?

Paul Monday
Parallel Scientific, LLC.
paul.monday at parsci.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111010/c4e1c137/attachment-0001.htm>

More information about the Haskell-Cafe mailing list