@@ -46,6 +46,7 @@ module SAWScript.Crucible.LLVM.Builtins
46
46
, crucible_alloc
47
47
, crucible_alloc_aligned
48
48
, crucible_alloc_readonly
49
+ , crucible_alloc_readonly_aligned
49
50
, crucible_alloc_with_size
50
51
, crucible_alloc_global
51
52
, crucible_fresh_expanded_val
@@ -1485,10 +1486,10 @@ crucible_alloc_with_mutability_and_size mut sz alignment bic opts lty =
1485
1486
alignment' <-
1486
1487
case alignment of
1487
1488
Just a -> do
1488
- when (a < memTyAlign) $ fail $ unlines
1489
- [ " User error : manually-specified alignment was less than needed "
1489
+ when (a < memTyAlign) $ liftIO $ printOutLn opts Info $ unlines
1490
+ [ " Warning : manually-specified alignment was less than default for type "
1490
1491
, " Allocation type: " ++ show memTy
1491
- , " Minimum alignment for type: " ++ show (Crucible. fromAlignment memTyAlign) ++ " -byte"
1492
+ , " Default alignment for type: " ++ show (Crucible. fromAlignment memTyAlign) ++ " -byte"
1492
1493
, " Specified alignment: " ++ show (Crucible. fromAlignment a) ++ " -byte"
1493
1494
]
1494
1495
pure a
@@ -1517,28 +1518,50 @@ crucible_alloc_aligned ::
1517
1518
Int ->
1518
1519
L. Type ->
1519
1520
LLVMCrucibleSetupM (AllLLVM SetupValue )
1520
- crucible_alloc_aligned bic opts n lty =
1521
+ crucible_alloc_aligned =
1522
+ crucible_alloc_aligned_with_mutability Crucible. Mutable
1523
+
1524
+ crucible_alloc_readonly ::
1525
+ BuiltinContext ->
1526
+ Options ->
1527
+ L. Type ->
1528
+ LLVMCrucibleSetupM (AllLLVM SetupValue )
1529
+ crucible_alloc_readonly =
1530
+ crucible_alloc_with_mutability_and_size Crucible. Immutable Nothing Nothing
1531
+
1532
+ crucible_alloc_readonly_aligned ::
1533
+ BuiltinContext ->
1534
+ Options ->
1535
+ Int ->
1536
+ L. Type ->
1537
+ LLVMCrucibleSetupM (AllLLVM SetupValue )
1538
+ crucible_alloc_readonly_aligned =
1539
+ crucible_alloc_aligned_with_mutability Crucible. Immutable
1540
+
1541
+ crucible_alloc_aligned_with_mutability ::
1542
+ Crucible. Mutability ->
1543
+ BuiltinContext ->
1544
+ Options ->
1545
+ Int ->
1546
+ L. Type ->
1547
+ LLVMCrucibleSetupM (AllLLVM SetupValue )
1548
+ crucible_alloc_aligned_with_mutability mut bic opts n lty =
1521
1549
case Crucible. toAlignment (Crucible. toBytes n) of
1522
1550
Nothing ->
1523
- LLVMCrucibleSetupM $ fail $
1524
- " crucible_alloc_aligned: invalid non-power-of-2 alignment: " ++ show n
1551
+ LLVMCrucibleSetupM $ fail $ unwords
1552
+ [ " crucible_alloc_aligned/crucible_alloc_readonly_aligned:"
1553
+ , " invalid non-power-of-2 alignment:"
1554
+ , show n
1555
+ ]
1525
1556
Just alignment ->
1526
1557
crucible_alloc_with_mutability_and_size
1527
- Crucible. Mutable
1558
+ mut
1528
1559
Nothing
1529
1560
(Just alignment)
1530
1561
bic
1531
1562
opts
1532
1563
lty
1533
1564
1534
- crucible_alloc_readonly ::
1535
- BuiltinContext ->
1536
- Options ->
1537
- L. Type ->
1538
- LLVMCrucibleSetupM (AllLLVM SetupValue )
1539
- crucible_alloc_readonly =
1540
- crucible_alloc_with_mutability_and_size Crucible. Immutable Nothing Nothing
1541
-
1542
1565
crucible_alloc_with_size ::
1543
1566
BuiltinContext ->
1544
1567
Options ->
0 commit comments