@@ -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} ;
@@ -1038,8 +1038,8 @@ fn aarch64_get_operands<F: Fn(VReg) -> VReg>(inst: &Inst, collector: &mut Operan
10381038 // Neither LR nor SP is an allocatable register, so there is no need
10391039 // to do anything.
10401040 }
1041+ & Inst :: Bti { .. } => { }
10411042 & Inst :: VirtualSPOffsetAdj { .. } => { }
1042-
10431043 & Inst :: ElfTlsGetAddr { .. } => {
10441044 collector. reg_def ( Writable :: from_reg ( regs:: xreg ( 0 ) ) ) ;
10451045 let mut clobbers = AArch64MachineDeps :: get_regs_clobbered_by_call ( CallConv :: SystemV ) ;
@@ -1232,6 +1232,19 @@ impl MachInst for Inst {
12321232 fn ref_type_regclass ( _: & settings:: Flags ) -> RegClass {
12331233 RegClass :: Int
12341234 }
1235+
1236+ fn gen_block_start (
1237+ is_indirect_branch_target : bool ,
1238+ is_forward_edge_cfi_enabled : bool ,
1239+ ) -> Option < Self > {
1240+ if is_indirect_branch_target && is_forward_edge_cfi_enabled {
1241+ Some ( Inst :: Bti {
1242+ targets : BranchTargetType :: J ,
1243+ } )
1244+ } else {
1245+ None
1246+ }
1247+ }
12351248}
12361249
12371250//=============================================================================
@@ -2600,7 +2613,7 @@ impl Inst {
26002613 "csel {}, xzr, {}, hs ; " ,
26012614 "csdb ; " ,
26022615 "adr {}, pc+16 ; " ,
2603- "ldrsw {}, [{}, {}, LSL 2] ; " ,
2616+ "ldrsw {}, [{}, {}, uxtw # 2] ; " ,
26042617 "add {}, {}, {} ; " ,
26052618 "br {} ; " ,
26062619 "jt_entries {:?}"
@@ -2714,6 +2727,16 @@ impl Inst {
27142727 "paci" . to_string ( ) + key + "sp"
27152728 }
27162729 & Inst :: Xpaclri => "xpaclri" . to_string ( ) ,
2730+ & Inst :: Bti { targets } => {
2731+ let targets = match targets {
2732+ BranchTargetType :: None => "" ,
2733+ BranchTargetType :: C => " c" ,
2734+ BranchTargetType :: J => " j" ,
2735+ BranchTargetType :: JC => " jc" ,
2736+ } ;
2737+
2738+ "bti" . to_string ( ) + targets
2739+ }
27172740 & Inst :: VirtualSPOffsetAdj { offset } => {
27182741 state. virtual_sp_offset += offset;
27192742 format ! ( "virtual_sp_offset_adjust {}" , offset)
0 commit comments