[mips] Implement llvm.trap intrinsic.

Patch by Sasa Stankovic.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187244 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Akira Hatanaka 2013-07-26 20:58:55 +00:00
parent 407883b69b
commit 9758562aa7
3 changed files with 18 additions and 0 deletions

View File

@ -385,6 +385,8 @@ MipsTargetLowering(MipsTargetMachine &TM)
setTruncStoreAction(MVT::i64, MVT::i32, Custom);
}
setOperationAction(ISD::TRAP, MVT::Other, Legal);
setTargetDAGCombine(ISD::SDIVREM);
setTargetDAGCombine(ISD::UDIVREM);
setTargetDAGCombine(ISD::SELECT);

View File

@ -826,6 +826,11 @@ class SCBase<string opstr, RegisterOperand RO, Operand Mem> :
class MFC3OP<dag outs, dag ins, string asmstr> :
InstSE<outs, ins, asmstr, [], NoItinerary, FrmFR>;
let isBarrier = 1, isTerminator = 1, isCodeGenOnly = 1 in
def TRAP : InstSE<(outs), (ins), "break", [(trap)], NoItinerary, FrmOther> {
let Inst = 0x0000000d;
}
//===----------------------------------------------------------------------===//
// Pseudo instructions
//===----------------------------------------------------------------------===//

11
test/CodeGen/Mips/trap.ll Normal file
View File

@ -0,0 +1,11 @@
; RUN: llc -march=mipsel -mcpu=mips32 < %s | FileCheck %s
declare void @llvm.trap()
define void @f1() {
entry:
call void @llvm.trap()
unreachable
; CHECK: break
}