@@ -506,7 +506,7 @@ pub struct ABICalleeImpl<M: ABIMachineSpec> {
506506 /// Signature: arg and retval regs.
507507 sig : ABISig ,
508508 /// Offsets to each stackslot.
509- stackslots : Vec < u32 > ,
509+ stackslots : PrimaryMap < StackSlot , u32 > ,
510510 /// Total stack size of all stackslots.
511511 stackslots_size : u32 ,
512512 /// Stack size to be reserved for outgoing arguments.
@@ -584,7 +584,7 @@ impl<M: ABIMachineSpec> ABICalleeImpl<M> {
584584
585585 // Compute stackslot locations and total stackslot size.
586586 let mut stack_offset: u32 = 0 ;
587- let mut stackslots = vec ! [ ] ;
587+ let mut stackslots = PrimaryMap :: new ( ) ;
588588 for ( stackslot, data) in f. stack_slots . iter ( ) {
589589 let off = stack_offset;
590590 stack_offset += data. size ;
@@ -926,6 +926,10 @@ impl<M: ABIMachineSpec> ABICallee for ABICalleeImpl<M> {
926926 self . stackslots . len ( )
927927 }
928928
929+ fn stackslot_offsets ( & self ) -> & PrimaryMap < StackSlot , u32 > {
930+ & self . stackslots
931+ }
932+
929933 fn gen_copy_arg_to_regs (
930934 & self ,
931935 idx : usize ,
@@ -1101,7 +1105,7 @@ impl<M: ABIMachineSpec> ABICallee for ABICalleeImpl<M> {
11011105 ) -> SmallInstVec < Self :: I > {
11021106 // Offset from beginning of stackslot area, which is at nominal SP (see
11031107 // [MemArg::NominalSPOffset] for more details on nominal SP tracking).
1104- let stack_off = self . stackslots [ slot. as_u32 ( ) as usize ] as i64 ;
1108+ let stack_off = self . stackslots [ slot] as i64 ;
11051109 let sp_off: i64 = stack_off + ( offset as i64 ) ;
11061110 trace ! ( "load_stackslot: slot {} -> sp_off {}" , slot, sp_off) ;
11071111 gen_load_stack_multi :: < M > ( StackAMode :: NominalSPOffset ( sp_off, ty) , into_regs, ty)
@@ -1117,7 +1121,7 @@ impl<M: ABIMachineSpec> ABICallee for ABICalleeImpl<M> {
11171121 ) -> SmallInstVec < Self :: I > {
11181122 // Offset from beginning of stackslot area, which is at nominal SP (see
11191123 // [MemArg::NominalSPOffset] for more details on nominal SP tracking).
1120- let stack_off = self . stackslots [ slot. as_u32 ( ) as usize ] as i64 ;
1124+ let stack_off = self . stackslots [ slot] as i64 ;
11211125 let sp_off: i64 = stack_off + ( offset as i64 ) ;
11221126 trace ! ( "store_stackslot: slot {} -> sp_off {}" , slot, sp_off) ;
11231127 gen_store_stack_multi :: < M > ( StackAMode :: NominalSPOffset ( sp_off, ty) , from_regs, ty)
@@ -1127,7 +1131,7 @@ impl<M: ABIMachineSpec> ABICallee for ABICalleeImpl<M> {
11271131 fn stackslot_addr ( & self , slot : StackSlot , offset : u32 , into_reg : Writable < Reg > ) -> Self :: I {
11281132 // Offset from beginning of stackslot area, which is at nominal SP (see
11291133 // [MemArg::NominalSPOffset] for more details on nominal SP tracking).
1130- let stack_off = self . stackslots [ slot. as_u32 ( ) as usize ] as i64 ;
1134+ let stack_off = self . stackslots [ slot] as i64 ;
11311135 let sp_off: i64 = stack_off + ( offset as i64 ) ;
11321136 M :: gen_get_stack_addr ( StackAMode :: NominalSPOffset ( sp_off, I8 ) , into_reg, I8 )
11331137 }
0 commit comments