[PATCH] D48637: [Sparc] Generate ta 1 for the @llvm.debugtrap intrinsic
Daniel Cederman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 27 05:27:07 PDT 2018
dcederman created this revision.
dcederman added reviewers: jyknight, venkatra.
Herald added subscribers: llvm-commits, jrtc27, fedor.sergeev.
Software trap number one is the trap used for breakpoints in the Sparc ABI.
Repository:
rL LLVM
https://reviews.llvm.org/D48637
Files:
lib/Target/Sparc/SparcISelLowering.cpp
lib/Target/Sparc/SparcInstrInfo.td
test/CodeGen/SPARC/trap.ll
Index: test/CodeGen/SPARC/trap.ll
===================================================================
--- test/CodeGen/SPARC/trap.ll
+++ test/CodeGen/SPARC/trap.ll
@@ -9,3 +9,13 @@
}
declare void @llvm.trap()
+
+; CHECK-LABEL: testdebugtrap:
+; CHECK: ta 1 ! encoding: [0x91,0xd0,0x20,0x01]
+define void @testdebugtrap() {
+entry:
+ call void @llvm.debugtrap()
+ ret void
+}
+
+declare void @llvm.debugtrap()
Index: lib/Target/Sparc/SparcInstrInfo.td
===================================================================
--- lib/Target/Sparc/SparcInstrInfo.td
+++ lib/Target/Sparc/SparcInstrInfo.td
@@ -1009,6 +1009,9 @@
let isBarrier = 1, isTerminator = 1, rd = 0b01000, rs1 = 0, simm13 = 5 in
def TA5 : F3_2<0b10, 0b111010, (outs), (ins), "ta 5", [(trap)]>;
+def : Pat<(debugtrap),
+ (TRAPri (i32 G0), (i32 1), (i32 8))>;
+
// Section B.28 - Read State Register Instructions
let rs2 = 0 in
def RDASR : F3_1<2, 0b101000,
Index: lib/Target/Sparc/SparcISelLowering.cpp
===================================================================
--- lib/Target/Sparc/SparcISelLowering.cpp
+++ lib/Target/Sparc/SparcISelLowering.cpp
@@ -1727,6 +1727,7 @@
setOperationAction(ISD::VAARG , MVT::Other, Custom);
setOperationAction(ISD::TRAP , MVT::Other, Legal);
+ setOperationAction(ISD::DEBUGTRAP , MVT::Other, Legal);
// Use the default implementation.
setOperationAction(ISD::VACOPY , MVT::Other, Expand);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48637.153052.patch
Type: text/x-patch
Size: 1472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180627/548124e6/attachment.bin>
More information about the llvm-commits
mailing list