1 Pull in r201994 from upstream llvm trunk (by Benjamin Kramer):
3 SPARC: Implement TRAP lowering. Matches what GCC emits.
5 Introduced here: http://svn.freebsd.org/changeset/base/262415
7 Index: lib/Target/Sparc/SparcInstrInfo.td
8 ===================================================================
9 --- lib/Target/Sparc/SparcInstrInfo.td
10 +++ lib/Target/Sparc/SparcInstrInfo.td
11 @@ -312,6 +312,9 @@ let hasSideEffects = 1, mayStore = 1 in {
15 +let isBarrier = 1, isTerminator = 1, rd = 0b1000, rs1 = 0, simm13 = 5 in
16 + def TA5 : F3_2<0b10, 0b111010, (outs), (ins), "ta 5", [(trap)]>;
19 def UNIMP : F2_1<0b000, (outs), (ins i32imm:$val),
21 Index: lib/Target/Sparc/SparcISelLowering.cpp
22 ===================================================================
23 --- lib/Target/Sparc/SparcISelLowering.cpp
24 +++ lib/Target/Sparc/SparcISelLowering.cpp
25 @@ -1565,6 +1565,8 @@ SparcTargetLowering::SparcTargetLowering(TargetMac
26 // VAARG needs to be lowered to not do unaligned accesses for doubles.
27 setOperationAction(ISD::VAARG , MVT::Other, Custom);
29 + setOperationAction(ISD::TRAP , MVT::Other, Legal);
31 // Use the default implementation.
32 setOperationAction(ISD::VACOPY , MVT::Other, Expand);
33 setOperationAction(ISD::VAEND , MVT::Other, Expand);
34 Index: test/CodeGen/SPARC/trap.ll
35 ===================================================================
36 --- test/CodeGen/SPARC/trap.ll
37 +++ test/CodeGen/SPARC/trap.ll
39 +; RUN: llc -mtriple=sparc-linux-gnu < %s -show-mc-encoding | FileCheck %s
41 +define void @test1() {
42 + tail call void @llvm.trap()
45 +; CHECK-LABEL: test1:
46 +; CHECK: ta 5 ! encoding: [0x91,0xd0,0x20,0x05]
49 +declare void @llvm.trap()