================
@@ -1751,6 +1750,25 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
     Inst.addOperand(MCOperand::createImm(0));
   }
 
+  bool isTrap(const MCInst &Inst) const override {
+    if (Inst.getOpcode() != AArch64::BRK)
+      return false;
+    // Only match the immediate values that are likely to indicate this BRK
+    // instruction is emitted to terminate the program immediately and not to
+    // be handled by a SIGTRAP handler, for example.
+    switch (Inst.getOperand(0).getImm()) {
+    case 0xc470:
+    case 0xc471:
+    case 0xc472:
+    case 0xc473:
+      // Explicit Pointer Authentication check failed, see
+      // AArch64AsmPrinter::emitPtrauthCheckAuthenticatedValue().
----------------
kbeyls wrote:

I'm not sure if it's a good idea to only consider pauthabi-specific BRK values 
in a "generic" AArch64-interface to test whether something is a trap. This 
"isTrap" function might get used by other analyses too...
I wonder if there would be a way to change the interface of `isTrap` to make it 
appropriately generic so that it could be used without confusion by other 
analyses too?

An example is this commit that makes the pac-ret analysis more accurate, which 
I guess hasn't been upstreamed yet: 
https://github.com/llvm/llvm-project/commit/5b3ed529abd6f6025c9012e5930375c5b577e555

https://github.com/llvm/llvm-project/pull/137975
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to