on master help sign in
Utility function for llvm codegen bugchecking
commit06e51b8545ee3e722faf68b1fe5bc7076698b075 authorBenjamin Saunders <besaunde@sfu.ca> dateWed 26 Jun 2013, 22:49 (13 years ago) parentfc17a3f
1 file changed+11−1
src/IRTS/CodegenLLVM.hs+11−1
src/IRTS/CodegenLLVM.hs+11−1
@@ -935,4 +935,14 @@ idrCall name args =
935935 , arguments = map (\x -> (x, [])) args
936936 , functionAttributes = []
937937 , metadata = []
938− }
938+ }
939+
940+assert :: Operand -> String -> Codegen ()
941+assert condition message = do
942+ passed <- getName "assertPassed"
943+ failed <- getName "assertFailed"
944+ terminate $ CondBr condition passed failed []
945+ newBlock failed
946+ cgExpr (SError message)
947+ terminate $ Unreachable []
948+ newBlock passed