@@ -461,8 +461,8 @@ let destroyed_at_pushtrap =
461
461
let has_pushtrap traps =
462
462
List. exists (function Cmm. Push _ -> true | Pop _ -> false ) traps
463
463
464
- let destroyed_by_simd_op op =
465
- match Simd_proc. register_behavior op with
464
+ let destroyed_by_simd_op ( register_behavior : Simd_proc.register_behavior ) =
465
+ match register_behavior with
466
466
| R_RM_rax_rdx_to_xmm0
467
467
| R_RM_to_xmm0 -> destroy_xmm 0
468
468
| R_RM_rax_rdx_to_rcx
@@ -496,7 +496,10 @@ let destroyed_at_oper = function
496
496
| Ireturn traps when has_pushtrap traps -> assert false
497
497
| Iop (Ispecific (Irdtsc | Irdpmc )) -> [| rax; rdx |]
498
498
| Iop (Ispecific (Ilfence | Isfence | Imfence )) -> [||]
499
- | Iop (Ispecific(Isimd op )) -> destroyed_by_simd_op op
499
+ | Iop (Ispecific(Isimd op )) ->
500
+ destroyed_by_simd_op (Simd_proc. register_behavior op)
501
+ | Iop (Ispecific(Isimd_mem (op ,_ ))) ->
502
+ destroyed_by_simd_op (Simd_proc.Mem. register_behavior op)
500
503
| Iop (Ispecific (Isextend32 | Izextend32 | Ilea _
501
504
| Istore_int (_, _, _) | Ioffset_loc (_, _)
502
505
| Ipause | Icldemote _ | Iprefetch _
@@ -549,7 +552,10 @@ let destroyed_at_basic (basic : Cfg_intf.S.basic) =
549
552
| Op Poll -> destroyed_at_alloc_or_poll
550
553
| Op (Alloc _ ) ->
551
554
destroyed_at_alloc_or_poll
552
- | Op (Specific (Isimd op )) -> destroyed_by_simd_op op
555
+ | Op (Specific (Isimd op )) ->
556
+ destroyed_by_simd_op (Simd_proc. register_behavior op)
557
+ | Op (Specific (Isimd_mem (op ,_ ))) ->
558
+ destroyed_by_simd_op (Simd_proc.Mem. register_behavior op)
553
559
| Op (Move | Spill | Reload
554
560
| Const_int _ | Const_float _ | Const_float32 _ | Const_symbol _
555
561
| Const_vec128 _
@@ -601,7 +607,7 @@ let destroyed_at_terminator (terminator : Cfg_intf.S.terminator) =
601
607
| Call {op = Indirect | Direct _ ; _} -> all_phys_regs
602
608
| Specific_can_raise { op = (Ilea _ | Ibswap _ | Isextend32 | Izextend32
603
609
| Ifloatarithmem _ | Irdtsc | Irdpmc | Ipause
604
- | Isimd _ | Ilfence | Isfence | Imfence
610
+ | Isimd _ | Isimd_mem _ | Ilfence | Isfence | Imfence
605
611
| Istore_int (_, _, _) | Ioffset_loc (_, _)
606
612
| Icldemote _ | Iprefetch _ ); _ } ->
607
613
Misc. fatal_error " no instructions specific for this architecture can raise"
@@ -631,7 +637,7 @@ let is_destruction_point ~(more_destruction_points : bool) (terminator : Cfg_int
631
637
true
632
638
| Specific_can_raise { op = (Ilea _ | Ibswap _ | Isextend32 | Izextend32
633
639
| Ifloatarithmem _ | Irdtsc | Irdpmc | Ipause
634
- | Isimd _ | Ilfence | Isfence | Imfence
640
+ | Isimd _ | Isimd_mem _ | Ilfence | Isfence | Imfence
635
641
| Istore_int (_, _, _) | Ioffset_loc (_, _)
636
642
| Icldemote _ | Iprefetch _ ); _ } ->
637
643
Misc. fatal_error " no instructions specific for this architecture can raise"
@@ -655,13 +661,29 @@ let safe_register_pressure = function
655
661
| Ibeginregion | Iendregion | Idls_get
656
662
-> if fp then 10 else 11
657
663
658
- let max_register_pressure =
664
+ let max_register_pressure op =
659
665
let consumes ~int ~float =
660
666
if fp
661
667
then [| 12 - int ; 16 - float |]
662
668
else [| 13 - int ; 16 - float |]
663
- in function
664
- Iextcall _ ->
669
+ in
670
+ let simd_max_register_pressure (register_behavior : Simd_proc.register_behavior ) =
671
+ (match register_behavior with
672
+ | R_RM_rax_rdx_to_xmm0
673
+ | R_RM_to_xmm0 -> consumes ~int: 0 ~float: 1
674
+ | R_RM_rax_rdx_to_rcx
675
+ | R_RM_to_rcx -> consumes ~int: 1 ~float: 0
676
+ | R_to_fst
677
+ | R_to_R
678
+ | R_to_RM
679
+ | RM_to_R
680
+ | R_R_to_fst
681
+ | R_RM_to_fst
682
+ | R_RM_to_R
683
+ | R_RM_xmm0_to_fst -> consumes ~int: 0 ~float: 0 )
684
+ in
685
+ match op with
686
+ | Iextcall _ ->
665
687
if win64
666
688
then consumes ~int: 5 ~float: 6
667
689
else consumes ~int: 9 ~float: 16
@@ -675,19 +697,9 @@ let max_register_pressure =
675
697
| Ifloatop ((Float64 | Float32 ), Icompf _ ) ->
676
698
consumes ~int: 0 ~float: 1
677
699
| Ispecific (Isimd op ) ->
678
- (match Simd_proc. register_behavior op with
679
- | R_RM_rax_rdx_to_xmm0
680
- | R_RM_to_xmm0 -> consumes ~int: 0 ~float: 1
681
- | R_RM_rax_rdx_to_rcx
682
- | R_RM_to_rcx -> consumes ~int: 1 ~float: 0
683
- | R_to_fst
684
- | R_to_R
685
- | R_to_RM
686
- | RM_to_R
687
- | R_R_to_fst
688
- | R_RM_to_fst
689
- | R_RM_to_R
690
- | R_RM_xmm0_to_fst -> consumes ~int: 0 ~float: 0 )
700
+ simd_max_register_pressure (Simd_proc. register_behavior op)
701
+ | Ispecific (Isimd_mem (op ,_ )) ->
702
+ simd_max_register_pressure (Simd_proc.Mem. register_behavior op)
691
703
| Iintop (Iadd | Isub | Imul | Imulh _ | Iand | Ior | Ixor | Ilsl | Ilsr | Iasr
692
704
| Ipopcnt | Iclz _| Ictz _)
693
705
| Iintop_imm ((Iadd | Isub | Imul | Imulh _ | Iand | Ior | Ixor | Ilsl | Ilsr
0 commit comments