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/SelectionDAG/LegalizeDAG.cpp | |
| 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/SelectionDAG/LegalizeDAG.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 19 |
1 files changed, 19 insertions, 0 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() && |

