diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2008-01-15 07:02:33 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2008-01-15 07:02:33 +0000 |
commit | 6bbbc4cbfae44d5684d7a379b63cf2c665c5aac6 (patch) | |
tree | daed7b222863045014610eeb9f5d33d37951ee4c /llvm/lib/CodeGen | |
parent | 15346fae7098d12e53574090aa67039fed20062d (diff) | |
download | bcm5719-llvm-6bbbc4cbfae44d5684d7a379b63cf2c665c5aac6.tar.gz bcm5719-llvm-6bbbc4cbfae44d5684d7a379b63cf2c665c5aac6.zip |
For PR1839: add initial support for __builtin_trap. llvm-gcc part is missed
as well as PPC codegen
llvm-svn: 46001
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 19 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 5 |
3 files changed, 26 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index dd7c0e9f33a..8e9cd742339 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -3734,6 +3734,25 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { break; } } + case ISD::TRAP: { + MVT::ValueType VT = Node->getValueType(0); + switch (TLI.getOperationAction(Node->getOpcode(), VT)) { + default: assert(0 && "This action not supported for this op yet!"); + case TargetLowering::Custom: + Result = TLI.LowerOperation(Op, DAG); + if (Result.Val) break; + // Fall Thru + case TargetLowering::Legal: + // If this operation is not supported, lower it to 'abort()' call + SDOperand Chain = LegalizeOp(Node->getOperand(0)); + TargetLowering::ArgListTy Args; + std::pair<SDOperand,SDOperand> CallResult = + TLI.LowerCallTo(Chain, Type::VoidTy, false, false, CallingConv::C, false, + DAG.getExternalSymbol("abort", MVT::Other), Args, DAG); + Result = CallResult.second; + break; + } + } } assert(Result.getValueType() == Op.getValueType() && diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 22065156497..381e9dec646 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -3770,7 +3770,8 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const { case ISD::BUILD_PAIR: return "build_pair"; case ISD::STACKSAVE: return "stacksave"; case ISD::STACKRESTORE: return "stackrestore"; - + case ISD::TRAP: return "trap"; + // Block memory operations. case ISD::MEMSET: return "memset"; case ISD::MEMCPY: return "memcpy"; diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 2934345b603..67da406e7e7 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -2932,6 +2932,11 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { setValue(&I, DAG.getNode(ISD::FLT_ROUNDS, MVT::i32)); return 0; } + + case Intrinsic::trap: { + DAG.setRoot(DAG.getNode(ISD::TRAP, MVT::Other, getRoot())); + return 0; + } } } |