on master help sign in
Expand value flag to 32 bits to prevent confusion with defunctionalization constructors >= 65791
e61506fBenjamin Saunders
src/IRTS/CodegenLLVM.hs+4−4
@@ -182,7 +182,7 @@ nullValue :: C.Constant
182nullValue = C.Null (PointerType valueType (AddrSpace 0))
182nullValue = C.Null (PointerType valueType (AddrSpace 0))
183
183
184primTy :: Type -> Type
184primTy :: Type -> Type
185−primTy inner = StructureType False [IntegerType 8, inner]
185+primTy inner = StructureType False [IntegerType 32, inner]
186
186
187mpzTy :: Type
187mpzTy :: Type
188mpzTy = NamedTypeReference (Name "mpz")
188mpzTy = NamedTypeReference (Name "mpz")
@@ -385,9 +385,9 @@ cgExpr (SChkCase inspect alts) = do
385 isNull <- inst $ ICmp IPred.EQ val (ConstantOperand nullValue) []
385 isNull <- inst $ ICmp IPred.EQ val (ConstantOperand nullValue) []
386 terminate $ CondBr isNull endBBN notNullBBN []
386 terminate $ CondBr isNull endBBN notNullBBN []
387 newBlock notNullBBN
387 newBlock notNullBBN
388− ptr <- inst $ BitCast val (PointerType (IntegerType 8) (AddrSpace 0)) []
388+ ptr <- inst $ BitCast val (PointerType (IntegerType 32) (AddrSpace 0)) []
389 flag <- inst $ Load False ptr Nothing 0 []
389 flag <- inst $ Load False ptr Nothing 0 []
390− isVal <- inst $ ICmp IPred.EQ flag (ConstantOperand (C.Int 8 (-1))) []
390+ isVal <- inst $ ICmp IPred.EQ flag (ConstantOperand (C.Int 32 (-1))) []
391 conBBN <- getName "constructor"
391 conBBN <- getName "constructor"
392 terminate $ CondBr isVal endBBN conBBN []
392 terminate $ CondBr isVal endBBN conBBN []
393 newBlock conBBN
393 newBlock conBBN
@@ -630,7 +630,7 @@ box fty fval = do
630 val <- alloc (primTy (ftyToTy fty))
630 val <- alloc (primTy (ftyToTy fty))
631 tagptr <- inst $ GetElementPtr True val [ConstantOperand (C.Int 32 0), ConstantOperand (C.Int 32 0)] []
631 tagptr <- inst $ GetElementPtr True val [ConstantOperand (C.Int 32 0), ConstantOperand (C.Int 32 0)] []
632 valptr <- inst $ GetElementPtr True val [ConstantOperand (C.Int 32 0), ConstantOperand (C.Int 32 1)] []
632 valptr <- inst $ GetElementPtr True val [ConstantOperand (C.Int 32 0), ConstantOperand (C.Int 32 1)] []
633− inst' $ Store False tagptr (ConstantOperand (C.Int 8 (-1))) Nothing 0 []
633+ inst' $ Store False tagptr (ConstantOperand (C.Int 32 (-1))) Nothing 0 []
634 inst' $ Store False valptr fval Nothing 0 []
634 inst' $ Store False valptr fval Nothing 0 []
635 inst $ BitCast val (PointerType valueType (AddrSpace 0)) []
635 inst $ BitCast val (PointerType valueType (AddrSpace 0)) []
636
636