-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-exhaustive patterns #73
Comments
Can you show us the IR? Is this a compile error or a runtime error? |
There are cases where you can construct llvm-hs ASTs that are invalid IR and they can't be printed. Thus the non-exhaustive patterns. Make sure that your IR passes the verifier first and then post it here. |
Here's my code. I'm following this guide generating them. module Main where
import Data.Text.Lazy (unpack)
import Data.String
import LLVM.AST
import LLVM.Pretty
import LLVM.AST.Global
printModule :: Module -> IO ()
printModule = putStr. unpack . ppllvm
double :: Type
double = FloatingPointType DoubleFP
makeName :: String -> Name
makeName = Name . fromString
local :: Name -> Operand
local = LocalReference double
ret :: Operand -> Named Terminator
ret val = Do $ Ret (Just val) []
func :: Definition
func = GlobalDefinition $ functionDefaults {
name = makeName "foo"
, parameters = ([Parameter double (makeName "a") []], False)
, returnType = double
, basicBlocks = [
BasicBlock (makeName "entry") [
UnName 1 := Alloca double Nothing 0 []
, UnName 2 := Store False (local $ UnName 1) (local $ makeName "a") Nothing 0 []
, UnName 3 := Load False (local $ UnName 1) Nothing 0 []
] (ret . local $ UnName 3)
]
}
main :: IO ()
main = printModule $ defaultModule {
moduleName = fromString "some name"
, moduleDefinitions = [func]
} |
Your |
Made a note about non-exhaustive pattern and tried to add some more informative error messages. I'm in the process of fixing the kaleidoscope tutorial so it's up to date as well. That's about all I can do so closing out this issue. |
src/LLVM/Pretty.hs:530:13-48: Non-exhaustive patterns in PointerType argTy _
I got this error when buiding some IR with llvm-hs-pretty
The text was updated successfully, but these errors were encountered: