[PATCH] D53614: ARM: Use BKPT instead of TRAP to implement llvm.debugtrap.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 23 14:54:10 PDT 2018


pcc created this revision.
pcc added a reviewer: t.p.northover.
Herald added subscribers: chrib, hiraditya, kristof.beyls, javed.absar, dschuff, srhines.

The BKPT instruction is specified to cause a software breakpoint,
and at least on Linux results in a SIGTRAP. This makes it more
suitable for implementing debugtrap than TRAP (aka UDF #254), which
is specified to cause an undefined instruction exception and results
in a SIGILL on Linux.

Moreover, BKPT is not marked as a terminator, which is not only
consistent with the IR instruction but allows the analyzeBlock
function to correctly analyze a basic block containing the instruction,
which fixes an assertion failure in the machine block placement pass
previously triggered by the included test case.

Because BKPT is only supported starting with ARMv5T, we continue to
use UDF #254 when targeting v4T.


Repository:
  rL LLVM

https://reviews.llvm.org/D53614

Files:
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/ARMInstrInfo.td
  llvm/lib/Target/ARM/ARMInstrThumb.td
  llvm/test/CodeGen/ARM/analyze-branch-bkpt.ll
  llvm/test/CodeGen/ARM/debugtrap.ll
  llvm/test/CodeGen/ARM/trap.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53614.170758.patch
Type: text/x-patch
Size: 6456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181023/00ae771e/attachment.bin>


More information about the llvm-commits mailing list