@@ -36,8 +36,8 @@ mod emit_tests;
3636// Instructions (top level): definition
3737
3838pub use crate :: isa:: aarch64:: lower:: isle:: generated_code:: {
39- ALUOp , ALUOp3 , APIKey , AtomicRMWLoopOp , AtomicRMWOp , BitOp , FPUOp1 , FPUOp2 , FPUOp3 ,
40- FpuRoundMode , FpuToIntOp , IntToFpuOp , MInst as Inst , MoveWideOp , VecALUModOp , VecALUOp ,
39+ ALUOp , ALUOp3 , APIKey , AtomicRMWLoopOp , AtomicRMWOp , BitOp , BranchTargetType , FPUOp1 , FPUOp2 ,
40+ FPUOp3 , FpuRoundMode , FpuToIntOp , IntToFpuOp , MInst as Inst , MoveWideOp , VecALUModOp , VecALUOp ,
4141 VecExtendOp , VecLanesOp , VecMisc2 , VecPairOp , VecRRLongOp , VecRRNarrowOp , VecRRPairLongOp ,
4242 VecRRRLongOp , VecShiftImmOp ,
4343} ;
@@ -1040,6 +1040,7 @@ fn aarch64_get_operands<F: Fn(VReg) -> VReg>(inst: &Inst, collector: &mut Operan
10401040 memarg_operands ( mem, collector) ;
10411041 }
10421042 & Inst :: Pacisp { .. } => { }
1043+ & Inst :: Bti { .. } => { }
10431044 & Inst :: VirtualSPOffsetAdj { .. } => { }
10441045
10451046 & Inst :: ElfTlsGetAddr { .. } => {
@@ -1234,6 +1235,19 @@ impl MachInst for Inst {
12341235 fn ref_type_regclass ( _: & settings:: Flags ) -> RegClass {
12351236 RegClass :: Int
12361237 }
1238+
1239+ fn gen_block_start (
1240+ is_indirect_branch_target : bool ,
1241+ is_forward_edge_cfi_enabled : bool ,
1242+ ) -> Option < Self > {
1243+ if is_indirect_branch_target && is_forward_edge_cfi_enabled {
1244+ Some ( Inst :: Bti {
1245+ targets : BranchTargetType :: J ,
1246+ } )
1247+ } else {
1248+ None
1249+ }
1250+ }
12371251}
12381252
12391253//=============================================================================
@@ -2602,7 +2616,7 @@ impl Inst {
26022616 "csel {}, xzr, {}, hs ; " ,
26032617 "csdb ; " ,
26042618 "adr {}, pc+16 ; " ,
2605- "ldrsw {}, [{}, {}, LSL 2] ; " ,
2619+ "ldrsw {}, [{}, {}, uxtw # 2] ; " ,
26062620 "add {}, {}, {} ; " ,
26072621 "br {} ; " ,
26082622 "jt_entries {:?}"
@@ -2715,6 +2729,16 @@ impl Inst {
27152729
27162730 "paci" . to_string ( ) + key + "sp"
27172731 }
2732+ & Inst :: Bti { targets } => {
2733+ let targets = match targets {
2734+ BranchTargetType :: None => "" ,
2735+ BranchTargetType :: C => " c" ,
2736+ BranchTargetType :: J => " j" ,
2737+ BranchTargetType :: JC => " jc" ,
2738+ } ;
2739+
2740+ "bti" . to_string ( ) + targets
2741+ }
27182742 & Inst :: VirtualSPOffsetAdj { offset } => {
27192743 state. virtual_sp_offset += offset;
27202744 format ! ( "virtual_sp_offset_adjust {}" , offset)
0 commit comments