llvm.org GIT mirror llvm / 7d696d8
Convert more assert(0)+abort() -> LLVM_UNREACHABLE, and abort()/exit() -> llvm_report_error(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75363 91177308-0d34-0410-b5e6-96231b3b80d8 Torok Edwin 10 years ago
39 changed file(s) with 300 addition(s) and 271 deletion(s). Raw diff Collapse all Expand all
5959 #include "llvm/Module.h"
6060 #include "llvm/Pass.h"
6161 #include "llvm/Support/Compiler.h"
62 #include "llvm/Support/ErrorHandling.h"
6263 #include "llvm/Support/InstIterator.h"
6364 #include "llvm/Support/InstVisitor.h"
6465 #include "llvm/Analysis/AliasAnalysis.h"
11521153 default:
11531154 // Is this something we aren't handling yet?
11541155 cerr << "Unknown instruction: " << I;
1155 abort();
1156 llvm_unreachable();
11561157 }
11571158 }
11581159
1515 #include "llvm/Pass.h"
1616 #include "llvm/Function.h"
1717 #include "llvm/Support/Compiler.h"
18 #include "llvm/Support/ErrorHandling.h"
1819 #include "llvm/Support/InstVisitor.h"
1920 #include "llvm/Support/Streams.h"
2021 #include "llvm/ADT/Statistic.h"
4647
4748 void visitInstruction(Instruction &I) {
4849 cerr << "Instruction Count does not know about " << I;
49 abort();
50 llvm_unreachable();
5051 }
5152 public:
5253 static char ID; // Pass identification, replacement for typeid
2222 #include "llvm/CodeGen/DwarfWriter.h"
2323 #include "llvm/Analysis/DebugInfo.h"
2424 #include "llvm/Support/CommandLine.h"
25 #include "llvm/Support/ErrorHandling.h"
2526 #include "llvm/Support/Mangler.h"
2627 #include "llvm/Support/raw_ostream.h"
2728 #include "llvm/Target/TargetAsmInfo.h"
12991300
13001301 void AsmPrinter::EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) {
13011302 // Target doesn't support this yet!
1302 abort();
1303 LLVM_UNREACHABLE("Target does not support EmitMachineConstantPoolValue");
13031304 }
13041305
13051306 /// PrintSpecial - Print information related to the specified machine instr
13271328 }
13281329 O << Counter;
13291330 } else {
1330 cerr << "Unknown special formatter '" << Code
1331 std::string msg;
1332 raw_string_ostream Msg(msg);
1333 Msg << "Unknown special formatter '" << Code
13311334 << "' for machine instr: " << *MI;
1332 exit(1);
1335 llvm_report_error(Msg.str());
13331336 }
13341337 }
13351338
14121415 case '(': // $( -> same as GCC's { character.
14131416 ++LastEmitted; // Consume '(' character.
14141417 if (CurVariant != -1) {
1415 cerr << "Nested variants found in inline asm string: '"
1416 << AsmStr << "'\n";
1417 exit(1);
1418 llvm_report_error("Nested variants found in inline asm string: '"
1419 + std::string(AsmStr) + "'");
14181420 }
14191421 CurVariant = 0; // We're in the first variant now.
14201422 break;
14491451 const char *StrStart = LastEmitted;
14501452 const char *StrEnd = strchr(StrStart, '}');
14511453 if (StrEnd == 0) {
1452 cerr << "Unterminated ${:foo} operand in inline asm string: '"
1453 << AsmStr << "'\n";
1454 exit(1);
1454 llvm_report_error("Unterminated ${:foo} operand in inline asm string: '"
1455 + std::string(AsmStr) + "'");
14551456 }
14561457
14571458 std::string Val(StrStart, StrEnd);
14651466 errno = 0;
14661467 long Val = strtol(IDStart, &IDEnd, 10); // We only accept numbers for IDs.
14671468 if (!isdigit(*IDStart) || (Val == 0 && errno == EINVAL)) {
1468 cerr << "Bad $ operand number in inline asm string: '"
1469 << AsmStr << "'\n";
1470 exit(1);
1469 llvm_report_error("Bad $ operand number in inline asm string: '"
1470 + std::string(AsmStr) + "'");
14711471 }
14721472 LastEmitted = IDEnd;
14731473
14791479 if (*LastEmitted == ':') {
14801480 ++LastEmitted; // Consume ':' character.
14811481 if (*LastEmitted == 0) {
1482 cerr << "Bad ${:} expression in inline asm string: '"
1483 << AsmStr << "'\n";
1484 exit(1);
1482 llvm_report_error("Bad ${:} expression in inline asm string: '"
1483 + std::string(AsmStr) + "'");
14851484 }
14861485
14871486 Modifier[0] = *LastEmitted;
14891488 }
14901489
14911490 if (*LastEmitted != '}') {
1492 cerr << "Bad ${} expression in inline asm string: '"
1493 << AsmStr << "'\n";
1494 exit(1);
1491 llvm_report_error("Bad ${} expression in inline asm string: '"
1492 + std::string(AsmStr) + "'");
14951493 }
14961494 ++LastEmitted; // Consume '}' character.
14971495 }
14981496
14991497 if ((unsigned)Val >= NumOperands-1) {
1500 cerr << "Invalid $ operand number in inline asm string: '"
1501 << AsmStr << "'\n";
1502 exit(1);
1498 llvm_report_error("Invalid $ operand number in inline asm string: '"
1499 + std::string(AsmStr) + "'");
15031500 }
15041501
15051502 // Okay, we finally have a value number. Ask the target to print this
15371534 }
15381535 }
15391536 if (Error) {
1540 cerr << "Invalid operand found in inline asm: '"
1537 std::string msg;
1538 raw_string_ostream Msg(msg);
1539 Msg << "Invalid operand found in inline asm: '"
15411540 << AsmStr << "'\n";
1542 MI->dump();
1543 exit(1);
1541 MI->print(Msg);
1542 llvm_report_error(Msg.str());
15441543 }
15451544 }
15461545 break;
17461745 }
17471746
17481747 cerr << "no GCMetadataPrinter registered for GC: " << Name << "\n";
1749 abort();
1750 }
1748 llvm_unreachable();
1749 }
1515 #include "llvm/CodeGen/GCMetadataPrinter.h"
1616 #include "llvm/Module.h"
1717 #include "llvm/Support/Compiler.h"
18 #include "llvm/Support/ErrorHandling.h"
1819 #include "llvm/Support/raw_ostream.h"
1920 #include "llvm/Target/TargetAsmInfo.h"
2021 #include "llvm/Target/TargetData.h"
114115
115116 uint64_t FrameSize = FI.getFrameSize();
116117 if (FrameSize >= 1<<16) {
117 cerr << "Function '" << FI.getFunction().getNameStart()
118 std::string msg;
119 raw_string_ostream Msg(msg);
120 Msg << "Function '" << FI.getFunction().getNameStart()
118121 << "' is too large for the ocaml GC! "
119122 << "Frame size " << FrameSize << " >= 65536.\n";
120 cerr << "(" << uintptr_t(&FI) << ")\n";
121 abort(); // Very rude!
123 Msg << "(" << uintptr_t(&FI) << ")";
124 llvm_report_error(Msg.str()); // Very rude!
122125 }
123126
124127 OS << "\t" << TAI.getCommentString() << " live roots for "
127130 for (GCFunctionInfo::iterator J = FI.begin(), JE = FI.end(); J != JE; ++J) {
128131 size_t LiveCount = FI.live_size(J);
129132 if (LiveCount >= 1<<16) {
130 cerr << "Function '" << FI.getFunction().getNameStart()
133 std::string msg;
134 raw_string_ostream Msg(msg);
135 Msg << "Function '" << FI.getFunction().getNameStart()
131136 << "' is too large for the ocaml GC! "
132 << "Live root count " << LiveCount << " >= 65536.\n";
133 abort(); // Very rude!
137 << "Live root count " << LiveCount << " >= 65536.";
138 llvm_report_error(Msg.str()); // Very rude!
134139 }
135140
136141 OS << AddressDirective
1717 #include "llvm/CodeGen/Passes.h"
1818 #include "llvm/Function.h"
1919 #include "llvm/Support/Compiler.h"
20 #include "llvm/Support/ErrorHandling.h"
2021
2122 using namespace llvm;
2223
9192 return S;
9293 }
9394 }
94
95
9596 cerr << "unsupported GC: " << Name << "\n";
96 abort();
97 llvm_unreachable();
9798 }
9899
99100 GCFunctionInfo &GCModuleInfo::getFunctionInfo(const Function &F) {
2727 #include "llvm/Target/TargetMachine.h"
2828 #include "llvm/Target/TargetRegisterInfo.h"
2929 #include "llvm/Support/Compiler.h"
30 #include "llvm/Support/ErrorHandling.h"
3031
3132 using namespace llvm;
3233
107108
108109 bool GCStrategy::performCustomLowering(Function &F) {
109110 cerr << "gc " << getName() << " must override performCustomLowering.\n";
110 abort();
111 llvm_unreachable();
111112 return 0;
112113 }
113114
2020 #include "llvm/Target/TargetMachine.h"
2121 #include "llvm/Support/CommandLine.h"
2222 #include "llvm/Support/Debug.h"
23 #include "llvm/Support/ErrorHandling.h"
24 #include "llvm/Support/raw_ostream.h"
2325 #include "llvm/ADT/DepthFirstIterator.h"
2426 #include "llvm/ADT/Statistic.h"
2527 #include "llvm/ADT/STLExtras.h"
11291131 if (TII->isPredicated(I))
11301132 continue;
11311133 if (!TII->PredicateInstruction(I, Cond)) {
1132 cerr << "Unable to predicate " << *I << "!\n";
1133 abort();
1134 std::string msg;
1135 raw_string_ostream Msg(msg);
1136 Msg << "Unable to predicate " << *I << "!";
1137 llvm_report_error(Msg.str());
11341138 }
11351139 }
11361140
11631167
11641168 if (!isPredicated)
11651169 if (!TII->PredicateInstruction(MI, Cond)) {
1166 cerr << "Unable to predicate " << *MI << "!\n";
1167 abort();
1170 std::string msg;
1171 raw_string_ostream Msg(msg);
1172 Msg << "Unable to predicate " << *MI << "!";
1173 llvm_report_error(Msg.str());
11681174 }
11691175 }
11701176
1616 #include "llvm/Type.h"
1717 #include "llvm/CodeGen/IntrinsicLowering.h"
1818 #include "llvm/Support/IRBuilder.h"
19 #include "llvm/Support/ErrorHandling.h"
1920 #include "llvm/Target/TargetData.h"
2021 #include "llvm/ADT/SmallVector.h"
2122 using namespace llvm;
625626 const char *Dname,
626627 const char *LDname) {
627628 switch (CI->getOperand(1)->getType()->getTypeID()) {
628 default: assert(0 && "Invalid type in intrinsic"); abort();
629 default: LLVM_UNREACHABLE( "Invalid type in intrinsic");
629630 case Type::FloatTyID:
630631 ReplaceCallWith(Fname, CI, CI->op_begin() + 1, CI->op_end(),
631632 Type::FloatTy);
651652
652653 switch (Callee->getIntrinsicID()) {
653654 case Intrinsic::not_intrinsic:
654 cerr << "Cannot lower a call to a non-intrinsic function '"
655 << Callee->getName() << "'!\n";
656 abort();
655 llvm_report_error("Cannot lower a call to a non-intrinsic function '"+
656 Callee->getName() + "'!");
657657 default:
658 cerr << "Error: Code generator does not support intrinsic function '"
659 << Callee->getName() << "'!\n";
660 abort();
658 llvm_report_error("Code generator does not support intrinsic function '"+
659 Callee->getName()+"'!");
661660
662661 // The setjmp/longjmp intrinsics should only exist in the code if it was
663662 // never optimized (ie, right out of the CFE), or if it has been hacked on
3333 #include "llvm/Target/TargetOptions.h"
3434 #include "llvm/Support/CommandLine.h"
3535 #include "llvm/Support/Debug.h"
36 #include "llvm/Support/ErrorHandling.h"
37 #include "llvm/Support/raw_ostream.h"
3638 #include "llvm/ADT/DepthFirstIterator.h"
3739 #include "llvm/ADT/SmallSet.h"
3840 #include "llvm/ADT/Statistic.h"
24492451 pli.removeRange(StartIdx, EndIdx);
24502452 Cut = true;
24512453 } else {
2452 cerr << "Ran out of registers during register allocation!\n";
2454 std::string msg;
2455 raw_string_ostream Msg(msg);
2456 Msg << "Ran out of registers during register allocation!";
24532457 if (MI->getOpcode() == TargetInstrInfo::INLINEASM) {
2454 cerr << "Please check your inline asm statement for invalid "
2458 Msg << "\nPlease check your inline asm statement for invalid "
24552459 << "constraints:\n";
2456 MI->print(cerr.stream(), tm_);
2457 }
2458 exit(1);
2460 MI->print(Msg, tm_);
2461 }
2462 llvm_report_error(Msg.str());
24592463 }
24602464 for (const unsigned* AS = tri_->getSubRegisters(SpillReg); *AS; ++AS) {
24612465 if (!hasInterval(*AS))
3434 #include "llvm/Target/TargetMachOWriterInfo.h"
3535 #include "llvm/Support/Mangler.h"
3636 #include "llvm/Support/OutputBuffer.h"
37 #include "llvm/Support/ErrorHandling.h"
3738 #include "llvm/Support/raw_ostream.h"
3839
3940 namespace llvm {
633634 case Instruction::Add:
634635 default:
635636 cerr << "ConstantExpr not handled as global var init: " << *CE << "\n";
636 abort();
637 break;
637 llvm_unreachable();
638638 }
639639 } else if (PC->getType()->isSingleValueType()) {
640640 unsigned char *ptr = (unsigned char *)PA;
709709 ScatteredOffset));
710710 ScatteredOffset = 0;
711711 } else
712 assert(0 && "Unknown constant pointer type!");
712 LLVM_UNREACHABLE("Unknown constant pointer type!");
713713 break;
714714 default:
715 cerr << "ERROR: Constant unimp for type: " << *PC->getType() << "\n";
716 abort();
715 std::string msg;
716 raw_string_ostream Msg(msg);
717 Msg << "ERROR: Constant unimp for type: " << *PC->getType();
718 llvm_report_error(Msg.str());
717719 }
718720 } else if (isa(PC)) {
719721 memset((void*)PA, 0, (size_t)TD->getTypeAllocSize(PC->getType()));
3535 #include "llvm/Target/TargetInstrInfo.h"
3636 #include "llvm/Support/Compiler.h"
3737 #include "llvm/Support/Debug.h"
38 #include "llvm/Support/ErrorHandling.h"
39 #include "llvm/Support/raw_ostream.h"
3840 #include
3941
4042 using namespace llvm;
218220 OutFile.close();
219221
220222 if (foundErrors) {
221 cerr << "\nStopping with " << foundErrors << " machine code errors.\n";
222 exit(1);
223 std::string msg;
224 raw_string_ostream Msg(msg);
225 Msg << "\nStopping with " << foundErrors << " machine code errors.";
226 llvm_report_error(Msg.str());
223227 }
224228
225229 return false; // no changes
3030 #include "llvm/Target/TargetRegisterInfo.h"
3131 #include "llvm/Support/CommandLine.h"
3232 #include "llvm/Support/Debug.h"
33 #include "llvm/Support/ErrorHandling.h"
3334 #include "llvm/ADT/DenseMap.h"
3435 #include "llvm/ADT/DepthFirstIterator.h"
3536 #include "llvm/ADT/SmallPtrSet.h"
10351036
10361037 if (ValNo->isUnused()) {
10371038 // Defined by a dead def? How can this be?
1038 assert(0 && "Val# is defined by a dead def?");
1039 abort();
1039 LLVM_UNREACHABLE("Val# is defined by a dead def?");
10401040 }
10411041
10421042 MachineInstr *DefMI = ValNo->isDefAccurate()
3333 #include "llvm/ADT/Statistic.h"
3434 #include "llvm/ADT/STLExtras.h"
3535 #include "llvm/Support/Debug.h"
36 #include "llvm/Support/ErrorHandling.h"
3637 #include "llvm/Support/Compiler.h"
38 #include "llvm/Support/ErrorHandling.h"
3739 #include
3840 #include
3941 #include
234236 }
235237 }
236238 if (Error)
237 abort();
239 llvm_unreachable();
238240 #endif
239241 regUse_.clear();
240242 regUseBackUp_.clear();
11011103 DowngradedRegs.clear();
11021104 assignRegOrStackSlotAtInterval(cur);
11031105 } else {
1104 cerr << "Ran out of registers during register allocation!\n";
1105 exit(1);
1106 llvm_report_error("Ran out of registers during register allocation!");
11061107 }
11071108 return;
11081109 }
2424 #include "llvm/Support/CommandLine.h"
2525 #include "llvm/Support/Debug.h"
2626 #include "llvm/Support/Compiler.h"
27 #include "llvm/Support/ErrorHandling.h"
28 #include "llvm/Support/raw_ostream.h"
2729 #include "llvm/ADT/DenseMap.h"
2830 #include "llvm/ADT/IndexedMap.h"
2931 #include "llvm/ADT/SmallSet.h"
516518 getVirtRegLastUse(VirtReg) = std::make_pair(MI, OpNum);
517519
518520 if (!ReloadedRegs.insert(PhysReg)) {
519 cerr << "Ran out of registers during register allocation!\n";
521 std::string msg;
522 raw_string_ostream Msg(msg);
523 Msg << "Ran out of registers during register allocation!";
520524 if (MI->getOpcode() == TargetInstrInfo::INLINEASM) {
521 cerr << "Please check your inline asm statement for invalid "
525 Msg << "\nPlease check your inline asm statement for invalid "
522526 << "constraints:\n";
523 MI->print(cerr.stream(), TM);
524 }
525 exit(1);
527 MI->print(Msg, TM);
528 }
529 llvm_report_error(Msg.str());
526530 }
527531 for (const unsigned *SubRegs = TRI->getSubRegisters(PhysReg);
528532 *SubRegs; ++SubRegs) {
529533 if (!ReloadedRegs.insert(*SubRegs)) {
530 cerr << "Ran out of registers during register allocation!\n";
534 std::string msg;
535 raw_string_ostream Msg(msg);
536 Msg << "Ran out of registers during register allocation!";
531537 if (MI->getOpcode() == TargetInstrInfo::INLINEASM) {
532 cerr << "Please check your inline asm statement for invalid "
538 Msg << "\nPlease check your inline asm statement for invalid "
533539 << "constraints:\n";
534 MI->print(cerr.stream(), TM);
535 }
536 exit(1);
540 MI->print(Msg, TM);
541 }
542 llvm_report_error(Msg.str());
537543 }
538544 }
539545
1919 #include "llvm/CodeGen/MachineBasicBlock.h"
2020 #include "llvm/CodeGen/MachineInstr.h"
2121 #include "llvm/CodeGen/MachineRegisterInfo.h"
22 #include "llvm/Support/ErrorHandling.h"
2223 #include "llvm/Target/TargetRegisterInfo.h"
2324 #include "llvm/Target/TargetInstrInfo.h"
2425 #include "llvm/Target/TargetMachine.h"
458459 }
459460
460461 if (ScavengedReg != 0) {
461 assert(0 && "Scavenger slot is live, unable to scavenge another register!");
462 abort();
462 LLVM_UNREACHABLE("Scavenger slot is live, unable to scavenge another register!");
463463 }
464464
465465 // Spill the scavenged register before I.
1212 //===----------------------------------------------------------------------===//
1313
1414 #include "llvm/CodeGen/CallingConvLower.h"
15 #include "llvm/Support/ErrorHandling.h"
16 #include "llvm/Support/raw_ostream.h"
1517 #include "llvm/Target/TargetRegisterInfo.h"
1618 #include "llvm/Target/TargetData.h"
1719 #include "llvm/Target/TargetMachine.h"
6466 ISD::ArgFlagsTy ArgFlags =
6567 cast(TheArgs->getOperand(3+i))->getArgFlags();
6668 if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) {
67 cerr << "Formal argument #" << i << " has unhandled type "
68 << ArgVT.getMVTString() << "\n";
69 abort();
69 std::string msg;
70 raw_string_ostream Msg(msg);
71 Msg << "Formal argument #" << i << " has unhandled type "
72 << ArgVT.getMVTString();
73 llvm_report_error(Msg.str());
7074 }
7175 }
7276 }
8084 ISD::ArgFlagsTy ArgFlags =
8185 cast(TheRet->getOperand(i*2+2))->getArgFlags();
8286 if (Fn(i, VT, VT, CCValAssign::Full, ArgFlags, *this)){
83 cerr << "Return operand #" << i << " has unhandled type "
84 << VT.getMVTString() << "\n";
85 abort();
87 std::string msg;
88 raw_string_ostream Msg(msg);
89 Msg << "Return operand #" << i << " has unhandled type "
90 << VT.getMVTString();
91 llvm_report_error(Msg.str());
8692 }
8793 }
8894 }
96102 MVT ArgVT = TheCall->getArg(i).getValueType();
97103 ISD::ArgFlagsTy ArgFlags = TheCall->getArgFlags(i);
98104 if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) {
99 cerr << "Call operand #" << i << " has unhandled type "
100 << ArgVT.getMVTString() << "\n";
101 abort();
105 std::string msg;
106 raw_string_ostream Msg(msg);
107 Msg << "Call operand #" << i << " has unhandled type "
108 << ArgVT.getMVTString();
109 llvm_report_error(Msg.str());
102110 }
103111 }
104112 }
113121 MVT ArgVT = ArgVTs[i];
114122 ISD::ArgFlagsTy ArgFlags = Flags[i];
115123 if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) {
116 cerr << "Call operand #" << i << " has unhandled type "
117 << ArgVT.getMVTString() << "\n";
118 abort();
124 std::string msg;
125 raw_string_ostream Msg(msg);
126 Msg << "Call operand #" << i << " has unhandled type "
127 << ArgVT.getMVTString();
128 llvm_report_error(Msg.str());
119129 }
120130 }
121131 }
129139 if (TheCall->isInreg())
130140 Flags.setInReg();
131141 if (Fn(i, VT, VT, CCValAssign::Full, Flags, *this)) {
132 cerr << "Call result #" << i << " has unhandled type "
133 << VT.getMVTString() << "\n";
134 abort();
142 std::string msg;
143 raw_string_ostream Msg(msg);
144 Msg << "Call result #" << i << " has unhandled type "
145 << VT.getMVTString();
146 llvm_report_error(Msg.str());
135147 }
136148 }
137149 }
140152 /// produce a single value.
141153 void CCState::AnalyzeCallResult(MVT VT, CCAssignFn Fn) {
142154 if (Fn(0, VT, VT, CCValAssign::Full, ISD::ArgFlagsTy(), *this)) {
143 cerr << "Call result has unhandled type "
144 << VT.getMVTString() << "\n";
145 abort();
155 std::string msg;
156 raw_string_ostream Msg(msg);
157 Msg << "Call result has unhandled type "
158 << VT.getMVTString();
159 llvm_report_error(Msg.str());
146160 }
147161 }
3232 #include "llvm/Support/Compiler.h"
3333 #include "llvm/Support/CommandLine.h"
3434 #include "llvm/Support/Debug.h"
35 #include "llvm/Support/ErrorHandling.h"
3536 #include "llvm/Support/MathExtras.h"
3637 #include
3738 #include
22572258 if (!LegalOperations || TLI.isCondCodeLegal(NotCC, LHS.getValueType())) {
22582259 switch (N0.getOpcode()) {
22592260 default:
2260 assert(0 && "Unhandled SetCC Equivalent!");
2261 abort();
2261 LLVM_UNREACHABLE("Unhandled SetCC Equivalent!");
22622262 case ISD::SETCC:
22632263 return DAG.getSetCC(N->getDebugLoc(), VT, LHS, RHS, NotCC);
22642264 case ISD::SELECT_CC:
3131 #include "llvm/GlobalVariable.h"
3232 #include "llvm/Support/CommandLine.h"
3333 #include "llvm/Support/Compiler.h"
34 #include "llvm/Support/ErrorHandling.h"
3435 #include "llvm/Support/MathExtras.h"
3536 #include "llvm/ADT/DenseMap.h"
3637 #include "llvm/ADT/SmallVector.h"
947948 #ifndef NDEBUG
948949 cerr << "NODE: "; Node->dump(&DAG); cerr << "\n";
949950 #endif
950 assert(0 && "Do not know how to legalize this operator!");
951 abort();
951 LLVM_UNREACHABLE("Do not know how to legalize this operator!");
952952 case ISD::CALL:
953953 // The only option for this is to custom lower it.
954954 Tmp3 = TLI.LowerOperation(Result.getValue(0), DAG);
16981698 ISD::CondCode CC1 = ISD::SETCC_INVALID, CC2 = ISD::SETCC_INVALID;
16991699 unsigned Opc = 0;
17001700 switch (CCCode) {
1701 default: assert(0 && "Don't know how to expand this condition!"); abort();
1701 default: LLVM_UNREACHABLE("Don't know how to expand this condition!");
17021702 case ISD::SETOEQ: CC1 = ISD::SETEQ; CC2 = ISD::SETO; Opc = ISD::AND; break;
17031703 case ISD::SETOGT: CC1 = ISD::SETGT; CC2 = ISD::SETO; Opc = ISD::AND; break;
17041704 case ISD::SETOGE: CC1 = ISD::SETGE; CC2 = ISD::SETO; Opc = ISD::AND; break;
21462146 MVT SHVT = TLI.getShiftAmountTy();
21472147 SDValue Tmp1, Tmp2, Tmp3, Tmp4, Tmp5, Tmp6, Tmp7, Tmp8;
21482148 switch (VT.getSimpleVT()) {
2149 default: assert(0 && "Unhandled Expand type in BSWAP!"); abort();
2149 default: LLVM_UNREACHABLE("Unhandled Expand type in BSWAP!");
21502150 case MVT::i16:
21512151 Tmp2 = DAG.getNode(ISD::SHL, dl, VT, Op, DAG.getConstant(8, SHVT));
21522152 Tmp1 = DAG.getNode(ISD::SRL, dl, VT, Op, DAG.getConstant(8, SHVT));
1919 //===----------------------------------------------------------------------===//
2020
2121 #include "LegalizeTypes.h"
22 #include "llvm/Support/ErrorHandling.h"
23 #include "llvm/Support/raw_ostream.h"
2224 using namespace llvm;
2325
2426 /// GetFPLibCall - Return the right libcall for the given floating point type.
5052 cerr << "SoftenFloatResult #" << ResNo << ": ";
5153 N->dump(&DAG); cerr << "\n";
5254 #endif
53 assert(0 && "Do not know how to soften the result of this operator!");
54 abort();
55 LLVM_UNREACHABLE("Do not know how to soften the result of this operator!");
5556
5657 case ISD::BIT_CONVERT: R = SoftenFloatRes_BIT_CONVERT(N); break;
5758 case ISD::BUILD_PAIR: R = SoftenFloatRes_BUILD_PAIR(N); break;
539540 cerr << "SoftenFloatOperand Op #" << OpNo << ": ";
540541 N->dump(&DAG); cerr << "\n";
541542 #endif
542 assert(0 && "Do not know how to soften this operator's operand!");
543 abort();
543 LLVM_UNREACHABLE("Do not know how to soften this operator's operand!");
544544
545545 case ISD::BIT_CONVERT: Res = SoftenFloatOp_BIT_CONVERT(N); break;
546546 case ISD::BR_CC: Res = SoftenFloatOp_BR_CC(N); break;
780780 cerr << "ExpandFloatResult #" << ResNo << ": ";
781781 N->dump(&DAG); cerr << "\n";
782782 #endif
783 assert(0 && "Do not know how to expand the result of this operator!");
784 abort();
783 LLVM_UNREACHABLE("Do not know how to expand the result of this operator!");
785784
786785 case ISD::MERGE_VALUES: SplitRes_MERGE_VALUES(N, Lo, Hi); break;
787786 case ISD::UNDEF: SplitRes_UNDEF(N, Lo, Hi); break;
11801179 cerr << "ExpandFloatOperand Op #" << OpNo << ": ";
11811180 N->dump(&DAG); cerr << "\n";
11821181 #endif
1183 assert(0 && "Do not know how to expand this operator's operand!");
1184 abort();
1182 LLVM_UNREACHABLE("Do not know how to expand this operator's operand!");
11851183
11861184 case ISD::BIT_CONVERT: Res = ExpandOp_BIT_CONVERT(N); break;
11871185 case ISD::BUILD_VECTOR: Res = ExpandOp_BUILD_VECTOR(N); break;
1919
2020 #include "LegalizeTypes.h"
2121 #include "llvm/CodeGen/PseudoSourceValue.h"
22 #include "llvm/Support/ErrorHandling.h"
2223 using namespace llvm;
2324
2425 //===----------------------------------------------------------------------===//
4344 cerr << "PromoteIntegerResult #" << ResNo << ": ";
4445 N->dump(&DAG); cerr << "\n";
4546 #endif
46 assert(0 && "Do not know how to promote this operator!");
47 abort();
47 LLVM_UNREACHABLE("Do not know how to promote this operator!");
4848 case ISD::AssertSext: Res = PromoteIntRes_AssertSext(N); break;
4949 case ISD::AssertZext: Res = PromoteIntRes_AssertZext(N); break;
5050 case ISD::BIT_CONVERT: Res = PromoteIntRes_BIT_CONVERT(N); break;
609609 cerr << "PromoteIntegerOperand Op #" << OpNo << ": ";
610610 N->dump(&DAG); cerr << "\n";
611611 #endif
612 assert(0 && "Do not know how to promote this operator's operand!");
613 abort();
612 LLVM_UNREACHABLE("Do not know how to promote this operator's operand!");
614613
615614 case ISD::ANY_EXTEND: Res = PromoteIntOp_ANY_EXTEND(N); break;
616615 case ISD::BIT_CONVERT: Res = PromoteIntOp_BIT_CONVERT(N); break;
923922 cerr << "ExpandIntegerResult #" << ResNo << ": ";
924923 N->dump(&DAG); cerr << "\n";
925924 #endif
926 assert(0 && "Do not know how to expand the result of this operator!");
927 abort();
925 LLVM_UNREACHABLE("Do not know how to expand the result of this operator!");
928926
929927 case ISD::MERGE_VALUES: SplitRes_MERGE_VALUES(N, Lo, Hi); break;
930928 case ISD::SELECT: SplitRes_SELECT(N, Lo, Hi); break;
19691967 cerr << "ExpandIntegerOperand Op #" << OpNo << ": ";
19701968 N->dump(&DAG); cerr << "\n";
19711969 #endif
1972 assert(0 && "Do not know how to expand this operator's operand!");
1973 abort();
1970 LLVM_UNREACHABLE("Do not know how to expand this operator's operand!");
19741971
19751972 case ISD::BIT_CONVERT: Res = ExpandOp_BIT_CONVERT(N); break;
19761973 case ISD::BR_CC: Res = ExpandIntOp_BR_CC(N); break;
1616 #include "llvm/CallingConv.h"
1717 #include "llvm/ADT/SetVector.h"
1818 #include "llvm/Support/CommandLine.h"
19 #include "llvm/Support/ErrorHandling.h"
1920 #include "llvm/Target/TargetData.h"
2021 using namespace llvm;
2122
148149 if (Mapped & 128)
149150 cerr << " WidenedVectors";
150151 cerr << "\n";
151 abort();
152 llvm_unreachable();
152153 }
153154 }
154155 }
430431
431432 if (Failed) {
432433 I->dump(&DAG); cerr << "\n";
433 abort();
434 llvm_unreachable();
434435 }
435436 }
436437 #endif
2222 #include "LegalizeTypes.h"
2323 #include "llvm/CodeGen/PseudoSourceValue.h"
2424 #include "llvm/Target/TargetData.h"
25 #include "llvm/Support/ErrorHandling.h"
2526 using namespace llvm;
2627
2728 //===----------------------------------------------------------------------===//
3940 cerr << "ScalarizeVectorResult #" << ResNo << ": ";
4041 N->dump(&DAG); cerr << "\n";
4142 #endif
42 assert(0 && "Do not know how to scalarize the result of this operator!");
43 abort();
43 LLVM_UNREACHABLE("Do not know how to scalarize the result of this operator!");
4444
4545 case ISD::BIT_CONVERT: R = ScalarizeVecRes_BIT_CONVERT(N); break;
4646 case ISD::BUILD_VECTOR: R = N->getOperand(0); break;
377377 cerr << "SplitVectorResult #" << ResNo << ": ";
378378 N->dump(&DAG); cerr << "\n";
379379 #endif
380 assert(0 && "Do not know how to split the result of this operator!");
381 abort();
380 LLVM_UNREACHABLE("Do not know how to split the result of this operator!");
382381
383382 case ISD::MERGE_VALUES: SplitRes_MERGE_VALUES(N, Lo, Hi); break;
384383 case ISD::SELECT: SplitRes_SELECT(N, Lo, Hi); break;
928927 cerr << "SplitVectorOperand Op #" << OpNo << ": ";
929928 N->dump(&DAG); cerr << "\n";
930929 #endif
931 assert(0 && "Do not know how to split this operator's operand!");
932 abort();
930 LLVM_UNREACHABLE("Do not know how to split this operator's operand!");
933931
934932 case ISD::BIT_CONVERT: Res = SplitVecOp_BIT_CONVERT(N); break;
935933 case ISD::EXTRACT_SUBVECTOR: Res = SplitVecOp_EXTRACT_SUBVECTOR(N); break;
11181116 cerr << "WidenVectorResult #" << ResNo << ": ";
11191117 N->dump(&DAG); cerr << "\n";
11201118 #endif
1121 assert(0 && "Do not know how to widen the result of this operator!");
1122 abort();
1119 LLVM_UNREACHABLE("Do not know how to widen the result of this operator!");
11231120
11241121 case ISD::BIT_CONVERT: Res = WidenVecRes_BIT_CONVERT(N); break;
11251122 case ISD::BUILD_VECTOR: Res = WidenVecRes_BUILD_VECTOR(N); break;
17751772 cerr << "WidenVectorOperand op #" << ResNo << ": ";
17761773 N->dump(&DAG); cerr << "\n";
17771774 #endif
1778 assert(0 && "Do not know how to widen this operator's operand!");
1779 abort();
1775 LLVM_UNREACHABLE("Do not know how to widen this operator's operand!");
17801776
17811777 case ISD::BIT_CONVERT: Res = WidenVecOp_BIT_CONVERT(N); break;
17821778 case ISD::CONCAT_VECTORS: Res = WidenVecOp_CONCAT_VECTORS(N); break;
2323 #include "llvm/ADT/Statistic.h"
2424 #include "llvm/ADT/STLExtras.h"
2525 #include "llvm/Support/CommandLine.h"
26 #include "llvm/Support/ErrorHandling.h"
2627 using namespace llvm;
2728
2829 STATISTIC(NumUnfolds, "Number of nodes unfolded");
567568 }
568569
569570 if (!CurSU) {
570 assert(false && "Unable to resolve live physical register dependencies!");
571 abort();
571 LLVM_UNREACHABLE("Unable to resolve live physical register dependencies!");
572572 }
573573 }
574574
4848 #include "llvm/Support/Compiler.h"
4949 #include "llvm/Support/CommandLine.h"
5050 #include "llvm/Support/Debug.h"
51 #include "llvm/Support/ErrorHandling.h"
5152 #include "llvm/Support/MathExtras.h"
5253 #include "llvm/Support/raw_ostream.h"
5354 #include
816817 // Note: this doesn't use InstVisitor, because it has to work with
817818 // ConstantExpr's in addition to instructions.
818819 switch (Opcode) {
819 default: assert(0 && "Unknown instruction type encountered!");
820 abort();
820 default: LLVM_UNREACHABLE("Unknown instruction type encountered!");
821821 // Build the switch statement using the Instruction.def file.
822822 #define HANDLE_INST(NUM, OPCODE, CLASS) \
823823 case Instruction::OPCODE:return visit##OPCODE((CLASS&)I);
41594159 }
41604160 case Intrinsic::part_select: {
41614161 // Currently not implemented: just abort
4162 assert(0 && "part_select intrinsic not implemented");
4163 abort();
4162 llvm_report_error("part_select intrinsic not implemented");
41644163 }
41654164 case Intrinsic::part_set: {
41664165 // Currently not implemented: just abort
4167 assert(0 && "part_set intrinsic not implemented");
4168 abort();
4166 llvm_report_error("part_set intrinsic not implemented");
41694167 }
41704168 case Intrinsic::bswap:
41714169 setValue(&I, DAG.getNode(ISD::BSWAP, dl,
50835081 Input.ConstraintVT.isInteger()) ||
50845082 (OpInfo.ConstraintVT.getSizeInBits() !=
50855083 Input.ConstraintVT.getSizeInBits())) {
5086 cerr << "llvm: error: Unsupported asm: input constraint with a "
5087 << "matching output constraint of incompatible type!\n";
5088 exit(1);
5084 llvm_report_error("llvm: error: Unsupported asm: input constraint"
5085 " with a matching output constraint of incompatible"
5086 " type!");
50895087 }
50905088 Input.ConstraintVT = OpInfo.ConstraintVT;
50915089 }
51885186 // Copy the output from the appropriate register. Find a register that
51895187 // we can use.
51905188 if (OpInfo.AssignedRegs.Regs.empty()) {
5191 cerr << "llvm: error: Couldn't allocate output reg for constraint '"
5192 << OpInfo.ConstraintCode << "'!\n";
5193 exit(1);
5189 llvm_report_error("llvm: error: Couldn't allocate output reg for"
5190 " constraint '" + OpInfo.ConstraintCode + "'!");
51945191 }
51955192
51965193 // If this is an indirect operand, store through the pointer after the
52435240 || (OpFlag & 7) == 6 /* EARLYCLOBBER REGDEF */) {
52445241 // Add (OpFlag&0xffff)>>3 registers to MatchedRegs.
52455242 if (OpInfo.isIndirect) {
5246 cerr << "llvm: error: "
5247 "Don't know how to handle tied indirect "
5248 "register inputs yet!\n";
5249 exit(1);
5243 llvm_report_error("llvm: error: "
5244 "Don't know how to handle tied indirect "
5245 "register inputs yet!");
52505246 }
52515247 RegsForValue MatchedRegs;
52525248 MatchedRegs.TLI = &TLI;
52885284 TLI.LowerAsmOperandForConstraint(InOperandVal, OpInfo.ConstraintCode[0],
52895285 hasMemory, Ops, DAG);
52905286 if (Ops.empty()) {
5291 cerr << "llvm: error: Invalid operand for inline asm constraint '"
5292 << OpInfo.ConstraintCode << "'!\n";
5293 exit(1);
5287 llvm_report_error("llvm: error: Invalid operand for inline asm"
5288 " constraint '" + OpInfo.ConstraintCode + "'!");
52945289 }
52955290
52965291 // Add information to the INLINEASM node to know about this input.
53205315
53215316 // Copy the input into the appropriate registers.
53225317 if (OpInfo.AssignedRegs.Regs.empty()) {
5323 cerr << "llvm: error: Couldn't allocate input reg for constraint '"
5324 << OpInfo.ConstraintCode << "'!\n";
5325 exit(1);
5318 llvm_report_error("llvm: error: Couldn't allocate input reg for"
5319 " constraint '"+ OpInfo.ConstraintCode +"'!");
53265320 }
53275321
53285322 OpInfo.AssignedRegs.getCopyToRegs(InOperandVal, DAG, getCurDebugLoc(),
57755769 }
57765770
57775771 SDValue TargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) {
5778 assert(0 && "LowerOperation not implemented for this target!");
5779 abort();
5772 LLVM_UNREACHABLE("LowerOperation not implemented for this target!");
57805773 return SDValue();
57815774 }
57825775
4646 #include "llvm/Target/TargetOptions.h"
4747 #include "llvm/Support/Compiler.h"
4848 #include "llvm/Support/Debug.h"
49 #include "llvm/Support/ErrorHandling.h"
4950 #include "llvm/Support/MathExtras.h"
5051 #include "llvm/Support/Timer.h"
5152 #include
150151 // basic blocks, and the scheduler passes ownership of it to this method.
151152 MachineBasicBlock *TargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
152153 MachineBasicBlock *MBB) const {
153 cerr << "If a target marks an instruction with "
154 << "'usesCustomDAGSchedInserter', it must implement "
155 << "TargetLowering::EmitInstrWithCustomInserter!\n";
156 abort();
154 llvm_report_error("If a target marks an instruction with "
155 "'usesCustomDAGSchedInserter', it must implement "
156 "TargetLowering::EmitInstrWithCustomInserter!");
157157 return 0;
158158 }
159159
874874 if (EnableFastISelAbort)
875875 // The "fast" selector couldn't handle something and bailed.
876876 // For the purpose of debugging, just abort.
877 assert(0 && "FastISel didn't select the entire block");
877 LLVM_UNREACHABLE("FastISel didn't select the entire block");
878878 }
879879 break;
880880 }
12141214 // Otherwise, this is a memory operand. Ask the target to select it.
12151215 std::vector SelOps;
12161216 if (SelectInlineAsmMemoryOperand(InOps[i+1], 'm', SelOps)) {
1217 cerr << "Could not match memory address. Inline asm failure!\n";
1218 exit(1);
1217 llvm_report_error("Could not match memory address. Inline asm"
1218 " failure!");
12191219 }
12201220
12211221 // Add this to the output node.
2323 #include "llvm/Support/Debug.h"
2424 #include "llvm/Support/ErrorHandling.h"
2525 #include "llvm/Support/MutexGuard.h"
26 #include "llvm/Support/raw_ostream.h"
2627 #include "llvm/System/DynamicLibrary.h"
2728 #include "llvm/System/Host.h"
2829 #include "llvm/Target/TargetData.h"
331332 switch (NumArgs) {
332333 case 3:
333334 if (FTy->getParamType(2) != PPInt8Ty) {
334 cerr << "Invalid type for third argument of main() supplied\n";
335 abort();
335 llvm_report_error("Invalid type for third argument of main() supplied");
336336 }
337337 // FALLS THROUGH
338338 case 2:
339339 if (FTy->getParamType(1) != PPInt8Ty) {
340 cerr << "Invalid type for second argument of main() supplied\n";
341 abort();
340 llvm_report_error("Invalid type for second argument of main() supplied");
342341 }
343342 // FALLS THROUGH
344343 case 1:
345344 if (FTy->getParamType(0) != Type::Int32Ty) {
346 cerr << "Invalid type for first argument of main() supplied\n";
347 abort();
345 llvm_report_error("Invalid type for first argument of main() supplied");
348346 }
349347 // FALLS THROUGH
350348 case 0:
351349 if (!isa(FTy->getReturnType()) &&
352350 FTy->getReturnType() != Type::VoidTy) {
353 cerr << "Invalid return type of main() supplied\n";
354 abort();
351 llvm_report_error("Invalid return type of main() supplied");
355352 }
356353 break;
357354 default:
358 cerr << "Invalid number of arguments of main() supplied\n";
359 abort();
355 llvm_report_error("Invalid number of arguments of main() supplied");
360356 }
361357
362358 if (NumArgs) {
590586 GenericValue RHS = getConstantValue(CE->getOperand(1));
591587 GenericValue GV;
592588 switch (CE->getOperand(0)->getType()->getTypeID()) {
593 default: assert(0 && "Bad add type!"); abort();
589 default: LLVM_UNREACHABLE("Bad add type!");
594590 case Type::IntegerTyID:
595591 switch (CE->getOpcode()) {
596592 default: assert(0 && "Invalid integer opcode");
608604 break;
609605 case Type::FloatTyID:
610606 switch (CE->getOpcode()) {
611 default: assert(0 && "Invalid float opcode"); abort();
607 default: LLVM_UNREACHABLE("Invalid float opcode");
612608 case Instruction::FAdd:
613609 GV.FloatVal = LHS.FloatVal + RHS.FloatVal; break;
614610 case Instruction::FSub:
623619 break;
624620 case Type::DoubleTyID:
625621 switch (CE->getOpcode()) {
626 default: assert(0 && "Invalid double opcode"); abort();
622 default: LLVM_UNREACHABLE("Invalid double opcode");
627623 case Instruction::FAdd:
628624 GV.DoubleVal = LHS.DoubleVal + RHS.DoubleVal; break;
629625 case Instruction::FSub:
671667 default:
672668 break;
673669 }
674 cerr << "ConstantExpr not handled: " << *CE << "\n";
675 abort();
670 std::string msg;
671 raw_string_ostream Msg(msg);
672 Msg << "ConstantExpr not handled: " << *CE;
673 llvm_report_error(Msg.str());
676674 }
677675
678676 GenericValue Result;
702700 assert(0 && "Unknown constant pointer type!");
703701 break;
704702 default:
705 cerr << "ERROR: Constant unimplemented for type: " << *C->getType() << "\n";
706 abort();
703 std::string msg;
704 raw_string_ostream Msg(msg);
705 Msg << "ERROR: Constant unimplemented for type: " << *C->getType();
706 llvm_report_error(Msg.str());
707707 }
708708 return Result;
709709 }
837837 break;
838838 }
839839 default:
840 cerr << "Cannot load value of type " << *Ty << "!\n";
841 abort();
840 std::string msg;
841 raw_string_ostream Msg(msg);
842 Msg << "Cannot load value of type " << *Ty << "!";
843 llvm_report_error(Msg.str());
842844 }
843845 }
844846
2121 #include "llvm/ADT/Statistic.h"
2222 #include "llvm/Support/CommandLine.h"
2323 #include "llvm/Support/Debug.h"
24 #include "llvm/Support/ErrorHandling.h"
2425 #include "llvm/Support/MathExtras.h"
2526 #include
2627 #include
5657 IMPLEMENT_BINARY_OPERATOR(+, Double);
5758 default:
5859 cerr << "Unhandled type for FAdd instruction: " << *Ty << "\n";
59 abort();
60 llvm_unreachable();
6061 }
6162 }
6263
6768 IMPLEMENT_BINARY_OPERATOR(-, Double);
6869 default:
6970 cerr << "Unhandled type for FSub instruction: " << *Ty << "\n";
70 abort();
71 llvm_unreachable();
7172 }
7273 }
7374
7879 IMPLEMENT_BINARY_OPERATOR(*, Double);
7980 default:
8081 cerr << "Unhandled type for FMul instruction: " << *Ty << "\n";
81 abort();
82 llvm_unreachable();
8283 }
8384 }
8485
8990 IMPLEMENT_BINARY_OPERATOR(/, Double);
9091 default:
9192 cerr << "Unhandled type for FDiv instruction: " << *Ty << "\n";
92 abort();
93 llvm_unreachable();
9394 }
9495 }
9596
104105 break;
105106 default:
106107 cerr << "Unhandled type for Rem instruction: " << *Ty << "\n";
107 abort();
108 llvm_unreachable();
108109 }
109110 }
110111
131132 IMPLEMENT_POINTER_ICMP(==);
132133 default:
133134 cerr << "Unhandled type for ICMP_EQ predicate: " << *Ty << "\n";
134 abort();
135 llvm_unreachable();
135136 }
136137 return Dest;
137138 }
144145 IMPLEMENT_POINTER_ICMP(!=);
145146 default:
146147 cerr << "Unhandled type for ICMP_NE predicate: " << *Ty << "\n";
147 abort();
148 llvm_unreachable();
148149 }
149150 return Dest;
150151 }
157158 IMPLEMENT_POINTER_ICMP(<);
158159 default:
159160 cerr << "Unhandled type for ICMP_ULT predicate: " << *Ty << "\n";
160 abort();
161 llvm_unreachable();
161162 }
162163 return Dest;
163164 }
170171 IMPLEMENT_POINTER_ICMP(<);
171172 default:
172173 cerr << "Unhandled type for ICMP_SLT predicate: " << *Ty << "\n";
173 abort();
174 llvm_unreachable();
174175 }
175176 return Dest;
176177 }
183184 IMPLEMENT_POINTER_ICMP(>);
184185 default:
185186 cerr << "Unhandled type for ICMP_UGT predicate: " << *Ty << "\n";
186 abort();
187 llvm_unreachable();
187188 }
188189 return Dest;
189190 }
196197 IMPLEMENT_POINTER_ICMP(>);
197198 default:
198199 cerr << "Unhandled type for ICMP_SGT predicate: " << *Ty << "\n";
199 abort();
200 llvm_unreachable();
200201 }
201202 return Dest;
202203 }
209210 IMPLEMENT_POINTER_ICMP(<=);
210211 default:
211212 cerr << "Unhandled type for ICMP_ULE predicate: " << *Ty << "\n";
212 abort();
213 llvm_unreachable();
213214 }
214215 return Dest;
215216 }
222223 IMPLEMENT_POINTER_ICMP(<=);
223224 default:
224225 cerr << "Unhandled type for ICMP_SLE predicate: " << *Ty << "\n";
225 abort();
226 llvm_unreachable();
226227 }
227228 return Dest;
228229 }
235236 IMPLEMENT_POINTER_ICMP(>=);
236237 default:
237238 cerr << "Unhandled type for ICMP_UGE predicate: " << *Ty << "\n";
238 abort();
239 llvm_unreachable();
239240 }
240241 return Dest;
241242 }
248249 IMPLEMENT_POINTER_ICMP(>=);
249250 default:
250251 cerr << "Unhandled type for ICMP_SGE predicate: " << *Ty << "\n";
251 abort();
252 llvm_unreachable();
252253 }
253254 return Dest;
254255 }
273274 case ICmpInst::ICMP_SGE: R = executeICMP_SGE(Src1, Src2, Ty); break;
274275 default:
275276 cerr << "Don't know how to handle this ICmp predicate!\n-->" << I;
276 abort();
277 llvm_unreachable();
277278 }
278279
279280 SetValue(&I, R, SF);
292293 IMPLEMENT_FCMP(==, Double);
293294 default:
294295 cerr << "Unhandled type for FCmp EQ instruction: " << *Ty << "\n";
295 abort();
296 llvm_unreachable();
296297 }
297298 return Dest;
298299 }
306307
307308 default:
308309 cerr << "Unhandled type for FCmp NE instruction: " << *Ty << "\n";
309 abort();
310 llvm_unreachable();
310311 }
311312 return Dest;
312313 }
319320 IMPLEMENT_FCMP(<=, Double);
320321 default:
321322 cerr << "Unhandled type for FCmp LE instruction: " << *Ty << "\n";
322 abort();
323 llvm_unreachable();
323324 }
324325 return Dest;
325326 }
332333 IMPLEMENT_FCMP(>=, Double);
333334 default:
334335 cerr << "Unhandled type for FCmp GE instruction: " << *Ty << "\n";
335 abort();
336 llvm_unreachable();
336337 }
337338 return Dest;
338339 }
345346 IMPLEMENT_FCMP(<, Double);
346347 default:
347348 cerr << "Unhandled type for FCmp LT instruction: " << *Ty << "\n";
348 abort();
349 llvm_unreachable();
349350 }
350351 return Dest;
351352 }
358359 IMPLEMENT_FCMP(>, Double);
359360 default:
360361 cerr << "Unhandled type for FCmp GT instruction: " << *Ty << "\n";
361 abort();
362 llvm_unreachable();
362363 }
363364 return Dest;
364365 }
467468 case FCmpInst::FCMP_OGE: R = executeFCMP_OGE(Src1, Src2, Ty); break;
468469 default:
469470 cerr << "Don't know how to handle this FCmp predicate!\n-->" << I;
470 abort();
471 llvm_unreachable();
471472 }
472473
473474 SetValue(&I, R, SF);
513514 }
514515 default:
515516 cerr << "Unhandled Cmp predicate\n";
516 abort();
517 llvm_unreachable();
517518 }
518519 }
519520
542543 case Instruction::Xor: R.IntVal = Src1.IntVal ^ Src2.IntVal; break;
543544 default:
544545 cerr << "Don't know how to handle this binary operator!\n-->" << I;
545 abort();
546 llvm_unreachable();
546547 }
547548
548549 SetValue(&I, R, SF);
629630 do {
630631 ECStack.pop_back ();
631632 if (ECStack.empty ())
632 abort ();
633 llvm_report_error("Empty stack during unwind!");
633634 Inst = ECStack.back ().Caller.getInstruction ();
634635 } while (!(Inst && isa (Inst)));
635636
642643 }
643644
644645 void Interpreter::visitUnreachableInst(UnreachableInst &I) {
645 cerr << "ERROR: Program executed an 'unreachable' instruction!\n";
646 abort();
646 llvm_report_error("ERROR: Program executed an 'unreachable' instruction!");
647647 }
648648
649649 void Interpreter::visitBranchInst(BranchInst &I) {
11751175 IMPLEMENT_VAARG(Double);
11761176 default:
11771177 cerr << "Unhandled dest type for vaarg instruction: " << *Ty << "\n";
1178 abort();
1178 llvm_unreachable();
11791179 }
11801180
11811181 // Set the Value of this Instruction.
12621262 break;
12631263 default:
12641264 cerr << "Unhandled ConstantExpr: " << *CE << "\n";
1265 abort();
1265 llvm_unreachable();
12661266 return GenericValue();
12671267 }
12681268 return Dest;
2222 #include "llvm/DerivedTypes.h"
2323 #include "llvm/Module.h"
2424 #include "llvm/Config/config.h" // Detect libffi
25 #include "llvm/Support/ErrorHandling.h"
2526 #include "llvm/Support/Streams.h"
2627 #include "llvm/System/DynamicLibrary.h"
2728 #include "llvm/Target/TargetData.h"
125126 default: break;
126127 }
127128 // TODO: Support other types such as StructTyID, ArrayTyID, OpaqueTyID, etc.
128 cerr << "Type could not be mapped for use with libffi.\n";
129 abort();
129 llvm_report_error("Type could not be mapped for use with libffi.");
130130 return NULL;
131131 }
132132
174174 default: break;
175175 }
176176 // TODO: Support other types such as StructTyID, ArrayTyID, OpaqueTyID, etc.
177 cerr << "Type value could not be mapped for use with libffi.\n";
178 abort();
177 llvm_report_error("Type value could not be mapped for use with libffi.");
179178 return NULL;
180179 }
181180
189188 // TODO: We don't have type information about the remaining arguments, because
190189 // this information is never passed into ExecutionEngine::runFunction().
191190 if (ArgVals.size() > NumArgs && F->isVarArg()) {
192 cerr << "Calling external var arg function '" << F->getName()
193 << "' is not supported by the Interpreter.\n";
194 abort();
191 llvm_report_error("Calling external var arg function '" + F->getName()
192 + "' is not supported by the Interpreter.");
195193 }
196194
197195 unsigned ArgBytes = 0;
279277 return Result;
280278 #endif // USE_LIBFFI
281279
282 cerr << "Tried to execute an unknown external function: "
283 << F->getType()->getDescription() << " " << F->getName() << "\n";
284 if (F->getName() != "__main")
285 abort();
280 if (F->getName() == "__main")
281 cerr << "Tried to execute an unknown external function: "
282 << F->getType()->getDescription() << " __main\n";
283 else
284 llvm_report_error("Tried to execute an unknown external function: " +
285 F->getType()->getDescription() + " " +F->getName());
286286 return GenericValue();
287287 }
288288
312312 // void abort(void)
313313 GenericValue lle_X_abort(const FunctionType *FT,
314314 const std::vector &Args) {
315 //FIXME: should we report or raise here?
316 //llvm_report_error("Interpreted program raised SIGABRT");
315317 raise (SIGABRT);
316318 return GenericValue();
317319 }
1515 //===----------------------------------------------------------------------===//
1616
1717 #include "JIT.h"
18 #include "llvm/Support/ErrorHandling.h"
1819 #include "llvm/Support/Streams.h"
1920 #include "llvm/System/DynamicLibrary.h"
2021 #include "llvm/Config/config.h"
139140 return RP;
140141
141142 if (AbortOnFailure) {
142 cerr << "ERROR: Program used external function '" << Name
143 << "' which could not be resolved!\n";
144 abort();
143 llvm_report_error("ERROR: Program used external function '"+Name+
144 "' which could not be resolved!");
145145 }
146146 return 0;
147147 }
226226 // Turn the machine code intermediate representation into bytes in memory that
227227 // may be executed.
228228 if (TM.addPassesToEmitMachineCode(PM, *JCE, OptLevel)) {
229 cerr << "Target does not support machine code emission!\n";
230 abort();
229 llvm_report_error("Target does not support machine code emission!");
231230 }
232231
233232 // Register routine for informing unwinding runtime about new EH frames
275274 // Turn the machine code intermediate representation into bytes in memory
276275 // that may be executed.
277276 if (TM.addPassesToEmitMachineCode(PM, *JCE, CodeGenOpt::Default)) {
278 cerr << "Target does not support machine code emission!\n";
279 abort();
277 llvm_report_error("Target does not support machine code emission!");
280278 }
281279
282280 // Initialize passes.
308306 // Turn the machine code intermediate representation into bytes in memory
309307 // that may be executed.
310308 if (TM.addPassesToEmitMachineCode(PM, *JCE, CodeGenOpt::Default)) {
311 cerr << "Target does not support machine code emission!\n";
312 abort();
309 llvm_report_error("Target does not support machine code emission!");
313310 }
314311
315312 // Initialize passes.
340337 // Turn the machine code intermediate representation into bytes in memory
341338 // that may be executed.
342339 if (TM.addPassesToEmitMachineCode(PM, *JCE, CodeGenOpt::Default)) {
343 cerr << "Target does not support machine code emission!\n";
344 abort();
340 llvm_report_error("Target does not support machine code emission!");
345341 }
346342
347343 // Initialize passes.
631627
632628 std::string ErrorMsg;
633629 if (MP->materializeFunction(F, &ErrorMsg)) {
634 cerr << "Error reading function '" << F->getName()
635 << "' from bitcode file: " << ErrorMsg << "\n";
636 abort();
630 llvm_report_error("Error reading function '" + F->getName()+
631 "' from bitcode file: " + ErrorMsg);
637632 }
638633
639634 // Now retry to get the address.
723718 // situation. It's returned in the same block of memory as code which may
724719 // not be writable.
725720 if (isGVCompilationDisabled() && !GV->isConstant()) {
726 cerr << "Compilation of non-internal GlobalValue is disabled!\n";
727 abort();
721 llvm_report_error("Compilation of non-internal GlobalValue is disabled!");
728722 }
729723
730724 // Some applications require globals and code to live together, so they may
3232 #include "llvm/Target/TargetMachine.h"
3333 #include "llvm/Target/TargetOptions.h"
3434 #include "llvm/Support/Debug.h"
35 #include "llvm/Support/ErrorHandling.h"
3536 #include "llvm/Support/MutexGuard.h"
3637 #include "llvm/Support/ValueHandle.h"
38 #include "llvm/Support/raw_ostream.h"
3739 #include "llvm/System/Disassembler.h"
3840 #include "llvm/System/Memory.h"
3941 #include "llvm/Target/TargetInstrInfo.h"
372374
373375 // If lazy compilation is disabled, emit a useful error message and abort.
374376 if (TheJIT->isLazyCompilationDisabled()) {
375 cerr << "LLVM JIT requested to do lazy compilation of function '"
376 << F->getName() << "' when lazy compiles are disabled!\n";
377 abort();
377 llvm_report_error("LLVM JIT requested to do lazy compilation of function '"
378 + F->getName() + "' when lazy compiles are disabled!");
378379 }
379380
380381 // We might like to remove the stub from the StubToFunction map.
776777 break;
777778 }
778779 default: {
779 cerr << "ConstantExpr not handled: " << *CE << "\n";
780 abort();
780 std::string msg;
781 raw_string_ostream Msg(msg);
782 Msg << "ConstantExpr not handled: " << *CE;
783 llvm_report_error(Msg.str());
781784 }
782785 }
783786 }
919922 bool JITEmitter::finishFunction(MachineFunction &F) {
920923 if (CurBufferPtr == BufferEnd) {
921924 // FIXME: Allocate more space, then try again.
922 cerr << "JIT: Ran out of space for generated machine code!\n";
923 abort();
925 llvm_report_error("JIT: Ran out of space for generated machine code!");
924926 }
925927
926928 emitJumpTableInfo(F.getJumpTableInfo());
10161018
10171019 if (CurBufferPtr == BufferEnd) {
10181020 // FIXME: Allocate more space, then try again.
1019 cerr << "JIT: Ran out of space for generated machine code!\n";
1020 abort();
1021 llvm_report_error("JIT: Ran out of space for generated machine code!");
10211022 }
10221023
10231024 BufferBegin = CurBufferPtr = 0;
11981199 ConstPoolAddresses.push_back(CAddr);
11991200 if (CPE.isMachineConstantPoolEntry()) {
12001201 // FIXME: add support to lower machine constant pool values into bytes!
1201 cerr << "Initialize memory with machine specific constant pool entry"
1202 << " has not been implemented!\n";
1203 abort();
1202 llvm_report_error("Initialize memory with machine specific constant pool"
1203 "entry has not been implemented!");
12041204 }
12051205 TheJIT->InitializeMemory(CPE.Val.ConstVal, (void*)CAddr);
12061206 DOUT << "JIT: CP" << i << " at [0x"
1313 #include "llvm/GlobalValue.h"
1414 #include "llvm/ExecutionEngine/JITMemoryManager.h"
1515 #include "llvm/Support/Compiler.h"
16 #include "llvm/Support/ErrorHandling.h"
1617 #include "llvm/System/Memory.h"
1718 #include
1819 #include
355356 // Check for overflow.
356357 if (CurGlobalPtr > GlobalEnd) {
357358 // FIXME: Allocate more memory.
358 fprintf(stderr, "JIT ran out of memory for globals!\n");
359 abort();
359 llvm_report_error("JIT ran out of memory for globals!");
360360 }
361361
362362 return Result;
554554 ~(intptr_t)(Alignment-1));
555555 if (CurStubPtr < StubBase) {
556556 // FIXME: allocate a new block
557 fprintf(stderr, "JIT ran out of memory for function stubs!\n");
558 abort();
557 llvm_report_error("JIT ran out of memory for function stubs!");
559558 }
560559 return CurStubPtr;
561560 }
566565 std::string ErrMsg;
567566 sys::MemoryBlock B = sys::Memory::AllocateRWX(size, BOld, &ErrMsg);
568567 if (B.base() == 0) {
569 fprintf(stderr,
570 "Allocation failed when allocating new memory in the JIT\n%s\n",
571 ErrMsg.c_str());
572 abort();
568 llvm_report_error("Allocation failed when allocating new memory in the"
569 " JIT\n" + ErrMsg);
573570 }
574571 Blocks.push_back(B);
575572 return B;
1818 #include "llvm/Config/config.h"
1919 #include "llvm/ADT/OwningPtr.h"
2020 #include "llvm/Support/CommandLine.h"
21 #include "llvm/Support/ErrorHandling.h"
2122 #include "llvm/Support/MemoryBuffer.h"
2223 #include "llvm/Support/ManagedStatic.h"
2324 #include "llvm/Support/Streams.h"
203204 cerr << ProgramName
204205 << ": Bad ValueMask flag! CommandLine usage error:"
205206 << Handler->getValueExpectedFlag() << "\n";
206 abort();
207 break;
207 llvm_unreachable();
208208 }
209209
210210 // If this isn't a multi-arg option, just run the handler.
4747 #include "llvm/Support/CallSite.h"
4848 #include "llvm/Support/ConstantRange.h"
4949 #include "llvm/Support/Debug.h"
50 #include "llvm/Support/ErrorHandling.h"
5051 #include "llvm/Support/GetElementPtrTypeIterator.h"
5152 #include "llvm/Support/InstVisitor.h"
5253 #include "llvm/Support/MathExtras.h"
19261927 New = CmpInst::Create(*Context, CI->getOpcode(), CI->getPredicate(),
19271928 Op0, Op1, SO->getName()+".cmp");
19281929 else {
1929 assert(0 && "Unknown binary instruction type!");
1930 abort();
1930 LLVM_UNREACHABLE("Unknown binary instruction type!");
19311931 }
19321932 return IC->InsertNewInstBefore(New, I);
19331933 }
91139113 static Constant *GetSelectFoldableConstant(Instruction *I,
91149114 LLVMContext *Context) {
91159115 switch (I->getOpcode()) {
9116 default: assert(0 && "This cannot happen!"); abort();
9116 default: LLVM_UNREACHABLE("This cannot happen!");
91179117 case Instruction::Add:
91189118 case Instruction::Sub:
91199119 case Instruction::Or:
3434 #include "llvm/Support/CallSite.h"
3535 #include "llvm/Support/Compiler.h"
3636 #include "llvm/Support/Debug.h"
37 #include "llvm/Support/ErrorHandling.h"
3738 #include "llvm/Support/InstVisitor.h"
3839 #include "llvm/ADT/DenseMap.h"
3940 #include "llvm/ADT/DenseSet.h"
512513 }
513514 return false;
514515 } else {
516 #ifndef NDEBUG
515517 cerr << "Unknown terminator instruction: " << *TI;
516 abort();
518 #endif
519 llvm_unreachable();
517520 }
518521 }
519522
3333 #include "llvm/Transforms/Utils/PromoteMemToReg.h"
3434 #include "llvm/Transforms/Utils/Local.h"
3535 #include "llvm/Support/Debug.h"
36 #include "llvm/Support/ErrorHandling.h"
3637 #include "llvm/Support/GetElementPtrTypeIterator.h"
3738 #include "llvm/Support/IRBuilder.h"
3839 #include "llvm/Support/MathExtras.h"
15091510 continue;
15101511 }
15111512
1512 assert(0 && "Unsupported operation!");
1513 abort();
1513 LLVM_UNREACHABLE("Unsupported operation!");
15141514 }
15151515 }
15161516
2323 #include "llvm/Analysis/Dominators.h"
2424 #include "llvm/Target/TargetData.h"
2525 #include "llvm/Transforms/Utils/Local.h"
26 #include "llvm/Support/ErrorHandling.h"
2627 #include "llvm/Support/ValueHandle.h"
2728 #include
2829 using namespace llvm;
262263 case Instruction::Switch: // Should remove entry
263264 default:
264265 case Instruction::Ret: // Cannot happen, has no successors!
265 assert(0 && "Unhandled terminator instruction type in RemoveSuccessor!");
266 abort();
266 LLVM_UNREACHABLE("Unhandled terminator instruction type in RemoveSuccessor!");
267267 }
268268
269269 if (NewTI) // If it's a different instruction, replace.
2727 #include "llvm/Support/CommandLine.h"
2828 #include "llvm/Support/Compiler.h"
2929 #include "llvm/Support/Debug.h"
30 #include "llvm/Support/ErrorHandling.h"
3031 #include "llvm/ADT/StringExtras.h"
3132 #include
3233 #include
709710 // cerr << "OLD FUNCTION: " << *oldFunction;
710711 // verifyFunction(*oldFunction);
711712
712 DEBUG(if (verifyFunction(*newFunction)) abort());
713 DEBUG(if (verifyFunction(*newFunction))
714 llvm_report_error("verifyFunction failed!"));
713715 return newFunction;
714716 }
715717
2222 #include "llvm/ADT/StringMap.h"
2323 #include "llvm/Support/Compiler.h"
2424 #include "llvm/Support/Debug.h"
25 #include "llvm/Support/ErrorHandling.h"
2526 #include "llvm/Support/ManagedStatic.h"
2627 #include "llvm/Support/MathExtras.h"
2728 #include "llvm/System/Mutex.h"
11191120 template
11201121 struct VISIBILITY_HIDDEN ConvertConstantType {
11211122 static void convert(ConstantClass *OldC, const TypeClass *NewTy) {
1122 assert(0 && "This type cannot be converted!\n");
1123 abort();
1123 LLVM_UNREACHABLE("This type cannot be converted!\n");
11241124 }
11251125 };
11261126