[llvm-commits] [llvm] r60479 - in /llvm/trunk: lib/Target/XCore/XCoreISelLowering.cpp lib/Target/XCore/XCoreInstrInfo.td test/CodeGen/XCore/trap.ll

Richard Osborne richard at xmos.com
Wed Dec 3 02:59:19 PST 2008


Author: friedgold
Date: Wed Dec  3 04:59:16 2008
New Revision: 60479

URL: http://llvm.org/viewvc/llvm-project?rev=60479&view=rev
Log:
Add support for ISD::TRAP to the XCore backend

Added:
    llvm/trunk/test/CodeGen/XCore/trap.ll
Modified:
    llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp
    llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td

Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=60479&r1=60478&r2=60479&view=diff

==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Wed Dec  3 04:59:16 2008
@@ -106,6 +106,8 @@
   setOperationAction(ISD::ROTL , MVT::i32, Expand);
   setOperationAction(ISD::ROTR , MVT::i32, Expand);
   
+  setOperationAction(ISD::TRAP, MVT::Other, Legal);
+  
   // Expand jump tables for now
   setOperationAction(ISD::BR_JT, MVT::Other, Expand);
   setOperationAction(ISD::JumpTable, MVT::i32, Custom);

Modified: llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td?rev=60479&r1=60478&r2=60479&view=diff

==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td (original)
+++ llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Wed Dec  3 04:59:16 2008
@@ -762,7 +762,7 @@
 
 // One operand short
 // TODO edu, eeu, waitet, waitef, freer, tstart, msync, mjoin, syncr, clrtp
-// bru, setdp, setcp, setv, setev, kcall, ecallt, ecallf
+// bru, setdp, setcp, setv, setev, kcall
 // dgetreg
 let isBranch=1, isIndirectBranch=1, isTerminator=1 in
 def BAU_1r : _F1R<(outs), (ins GRRegs:$addr),
@@ -774,6 +774,16 @@
                  "set sp, $src",
                  []>;
 
+let isBarrier = 1, hasCtrlDep = 1 in 
+def ECALLT_1r : _F1R<(outs), (ins GRRegs:$src),
+                 "ecallt $src",
+                 []>;
+
+let isBarrier = 1, hasCtrlDep = 1 in 
+def ECALLF_1r : _F1R<(outs), (ins GRRegs:$src),
+                 "ecallf $src",
+                 []>;
+
 let isCall=1, 
 // All calls clobber the the link register and the non-callee-saved registers:
 Defs = [R0, R1, R2, R3, R11, LR] in {
@@ -852,6 +862,9 @@
 /// cttz
 def : Pat<(cttz GRRegs:$src), (CLZ_l2r (BITREV_l2r GRRegs:$src))>;
 
+/// trap
+def : Pat<(trap), (ECALLF_1r (LDC_ru6 0))>;
+
 ///
 /// branch patterns
 ///

Added: llvm/trunk/test/CodeGen/XCore/trap.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/trap.ll?rev=60479&view=auto

==============================================================================
--- llvm/trunk/test/CodeGen/XCore/trap.ll (added)
+++ llvm/trunk/test/CodeGen/XCore/trap.ll Wed Dec  3 04:59:16 2008
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; RUN: grep "ecallf" %t1.s | count 1
+; RUN: grep "ldc" %t1.s | count 1
+define i32 @test() noreturn nounwind  {
+entry:
+	tail call void @llvm.trap( )
+	unreachable
+}
+
+declare void @llvm.trap() nounwind 
+





More information about the llvm-commits mailing list