================ @@ -274,40 +398,31 @@ void SLSHardeningInserter::convertBLRToBL( MachineInstr &BLR = *MBBI; assert(isBLR(BLR)); - unsigned BLOpcode; - Register Reg; - bool RegIsKilled; - switch (BLR.getOpcode()) { - case AArch64::BLR: - case AArch64::BLRNoIP: - BLOpcode = AArch64::BL; - Reg = BLR.getOperand(0).getReg(); - assert(Reg != AArch64::X16 && Reg != AArch64::X17 && Reg != AArch64::LR); - RegIsKilled = BLR.getOperand(0).isKill(); - break; - case AArch64::BLRAA: - case AArch64::BLRAB: - case AArch64::BLRAAZ: - case AArch64::BLRABZ: - llvm_unreachable("BLRA instructions cannot yet be produced by LLVM, " - "therefore there is no need to support them for now."); - default: - llvm_unreachable("unhandled BLR"); - } + const ThunkKind &Kind = *getThunkKind(BLR.getOpcode()); ---------------- kbeyls wrote:
In the 20-line-ish long comment above (which I cannot comment on directly in github), I think it would also be useful to indicate which branch instructions might be the authenticating ones. I think that might help the reader a bit better with more quickly understanding what the intended transform is. E.g. something like: ``` // Before: // |-----------------------------| // | ... | // | instI | // | BLR{A|B|}{Z} xN{, xM} | // | instJ | // | ... | // |-----------------------------| // // After: // |-----------------------------| // | ... | // | instI | // | BL __llvm_slsblr_thunk_xN | // | instJ | // | ... | // |-----------------------------| // // __llvm_slsblr_thunk_xN: // |-----------------------------| // | BR{A|B|}{Z} xN{, xM} | // | barrierInsts | // |-----------------------------| // ``` https://github.com/llvm/llvm-project/pull/97605 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits