atrosinenko wrote: _I wonder if this PR could be streamlined - here are my thoughts that are in no way a change request, but merely an idea that could hopefully simplify the patch._
This patch has a couple of tricky parts: * it exposes an `X16X17NotSafer` predicate to TableGen code and uses it to conditionalize the tablegenerated instruction selection code in some clever way * the `AArch64Subtarget::isX16X17Safer` function computes its decision according to both the target (which is by design) and to the extra features requested (which are simply not implemented for non-default register choices, if I understand the reason correctly) What if keep `defm AUT : SignAuth<0b001, 0b011, "aut", null_frag>` and teach `AUT` pseudo to handle non-standard scratch registers instead? More precisely, replace `AUT` with `AUTx16x17` and, say, `AUTxNxM`: * `AUTxNxM` specifies most of the register operands explicitly: - implicit outputs: NZCV - explicit outputs: reg:Result (tied to InputPointer), reg:Scratch - implicit inputs: none - explicit inputs: imm:Key, imm:Disc, reg:AddrDisc, reg:InputPointer * `AUTx16x17` is merely the renamed `AUT` pseudo, as it is already done in this PR: - implicit outputs: X16, X17, NZCV - explicit outputs: none - implicit inputs: X16 - explicit inputs: imm:Key, imm:Disc, reg:AddrDisc - register allocator is likely to expect very restricted usage of physical registers (something like only by copy to/from physreg glued to the corresponding instruction with implicit operands), so selecting AUTxNxM with physical registers X16 and X17 would likely not work This way, the changes to both DAGISel and GlobalISel custom instruction selection hooks would not be restricted to changing a single identifier. Though, these hooks are both rather short and the changes are still rather simple: wrap a few lines of linear code with `if (isX16X17Safer) { ... }` and emit `AUTxNxM` in the false branch. It looks like changes to the AsmPrinter would be very straightforward: add two `Register` operands to `emitPtrauthAuthResign` to be used instead of hardcoded X16 and X17 - in the caller either use Result in place of X16 and Scratch in place of X17 or just pass literal X16 and X17. https://github.com/llvm/llvm-project/pull/132857 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits