[PATCH] D21155: [SystemZ] Support Compare and Traps

Zhan Jun Liau via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 11:28:49 PDT 2016


zhanjunl updated this revision to Diff 60208.
zhanjunl added a comment.

Thanks Marcin and Ulrich for the quick reviews. I've addressed most of them, and fixed the line width to 80 characters.

Ordered the InstRIEa instruction class properly now.
Set the alias size correctly.
Removed isBarrier from CondTrap and the Compare and Trap instruction sets.
Fixed the comment to "use that label instead".
Removed the TODO from the README file.
Added MC assembler and disassembler tests, and added tests for unconditional traps and invalid Compare and Trap, to test CondTrap.

In http://reviews.llvm.org/D21155#453347, @uweigand wrote:

> One additional question: why is the splitBlockAfter in emitTrap needed?   I notice that other platforms don't seem to require similar code when emitting a trap.  Shouldn't marking the trap as isTerminator in the .td file cause common code to terminate the basic block already?


This part of the patch I was unsure of, because I'm not sure if I'm using the custom inserter properly. When compiling this LLVM IR:

  define signext i32 @f0() {
  entry:
    call void @llvm.trap()
    ret i32 0
  }

Other platforms like PowerPC can compile that code fine, essentially generating "TRAP, LOAD 0, RETURN". SystemZ will throw an assertion, because there is a non-terminator between terminators (LOAD 0). I think the assertion makes sense, but I couldn't find any common code that terminated a basic block after seeing a terminator, which is why I had to use the custom inserter.


http://reviews.llvm.org/D21155

Files:
  lib/Target/SystemZ/README.txt
  lib/Target/SystemZ/SystemZAsmPrinter.cpp
  lib/Target/SystemZ/SystemZElimCompare.cpp
  lib/Target/SystemZ/SystemZISelLowering.cpp
  lib/Target/SystemZ/SystemZISelLowering.h
  lib/Target/SystemZ/SystemZInstrFormats.td
  lib/Target/SystemZ/SystemZInstrInfo.cpp
  lib/Target/SystemZ/SystemZInstrInfo.h
  lib/Target/SystemZ/SystemZInstrInfo.td
  test/CodeGen/SystemZ/trap-01.ll
  test/MC/Disassembler/SystemZ/insns.txt
  test/MC/SystemZ/insn-bad.s
  test/MC/SystemZ/insn-good.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21155.60208.patch
Type: text/x-patch
Size: 44151 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160609/b7154bdf/attachment.bin>


More information about the llvm-commits mailing list