summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2008-01-15 07:02:33 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2008-01-15 07:02:33 +0000
commit6bbbc4cbfae44d5684d7a379b63cf2c665c5aac6 (patch)
treedaed7b222863045014610eeb9f5d33d37951ee4c /llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
parent15346fae7098d12e53574090aa67039fed20062d (diff)
downloadbcm5719-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.cpp19
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() &&
OpenPOWER on IntegriCloud