summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorTorok Edwin <edwintorok@gmail.com>2009-07-11 13:10:19 +0000
committerTorok Edwin <edwintorok@gmail.com>2009-07-11 13:10:19 +0000
commit7d696d80409aad20bb5da0fc4eccab941dd371d4 (patch)
tree948cd8ec42ea724903f0789140bdbfd4f11241dc /lib/CodeGen
parent238f5100c60ba69afc388a78a296606bb2e72dce (diff)
downloadllvm-7d696d80409aad20bb5da0fc4eccab941dd371d4.tar.gz
llvm-7d696d80409aad20bb5da0fc4eccab941dd371d4.tar.bz2
llvm-7d696d80409aad20bb5da0fc4eccab941dd371d4.tar.xz
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
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp49
-rw-r--r--lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp17
-rw-r--r--lib/CodeGen/GCMetadata.cpp5
-rw-r--r--lib/CodeGen/GCStrategy.cpp3
-rw-r--r--lib/CodeGen/IfConversion.cpp14
-rw-r--r--lib/CodeGen/IntrinsicLowering.cpp13
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp12
-rw-r--r--lib/CodeGen/MachOWriter.cpp12
-rw-r--r--lib/CodeGen/MachineVerifier.cpp8
-rw-r--r--lib/CodeGen/PreAllocSplitting.cpp4
-rw-r--r--lib/CodeGen/RegAllocLinearScan.cpp7
-rw-r--r--lib/CodeGen/RegAllocLocal.cpp22
-rw-r--r--lib/CodeGen/RegisterScavenging.cpp4
-rw-r--r--lib/CodeGen/SelectionDAG/CallingConvLower.cpp50
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp4
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp8
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp14
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp13
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeTypes.cpp5
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp16
-rw-r--r--lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp4
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp41
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp14
23 files changed, 183 insertions, 156 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 6d125810d9..daa4a702dc 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -23,6 +23,7 @@
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/Analysis/DebugInfo.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Mangler.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetAsmInfo.h"
@@ -1300,7 +1301,7 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV, unsigned AddrSpace) {
void AsmPrinter::EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) {
// Target doesn't support this yet!
- abort();
+ LLVM_UNREACHABLE("Target does not support EmitMachineConstantPoolValue");
}
/// PrintSpecial - Print information related to the specified machine instr
@@ -1328,9 +1329,11 @@ void AsmPrinter::PrintSpecial(const MachineInstr *MI, const char *Code) const {
}
O << Counter;
} else {
- cerr << "Unknown special formatter '" << Code
+ std::string msg;
+ raw_string_ostream Msg(msg);
+ Msg << "Unknown special formatter '" << Code
<< "' for machine instr: " << *MI;
- exit(1);
+ llvm_report_error(Msg.str());
}
}
@@ -1413,9 +1416,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
case '(': // $( -> same as GCC's { character.
++LastEmitted; // Consume '(' character.
if (CurVariant != -1) {
- cerr << "Nested variants found in inline asm string: '"
- << AsmStr << "'\n";
- exit(1);
+ llvm_report_error("Nested variants found in inline asm string: '"
+ + std::string(AsmStr) + "'");
}
CurVariant = 0; // We're in the first variant now.
break;
@@ -1450,9 +1452,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
const char *StrStart = LastEmitted;
const char *StrEnd = strchr(StrStart, '}');
if (StrEnd == 0) {
- cerr << "Unterminated ${:foo} operand in inline asm string: '"
- << AsmStr << "'\n";
- exit(1);
+ llvm_report_error("Unterminated ${:foo} operand in inline asm string: '"
+ + std::string(AsmStr) + "'");
}
std::string Val(StrStart, StrEnd);
@@ -1466,9 +1467,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
errno = 0;
long Val = strtol(IDStart, &IDEnd, 10); // We only accept numbers for IDs.
if (!isdigit(*IDStart) || (Val == 0 && errno == EINVAL)) {
- cerr << "Bad $ operand number in inline asm string: '"
- << AsmStr << "'\n";
- exit(1);
+ llvm_report_error("Bad $ operand number in inline asm string: '"
+ + std::string(AsmStr) + "'");
}
LastEmitted = IDEnd;
@@ -1480,9 +1480,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
if (*LastEmitted == ':') {
++LastEmitted; // Consume ':' character.
if (*LastEmitted == 0) {
- cerr << "Bad ${:} expression in inline asm string: '"
- << AsmStr << "'\n";
- exit(1);
+ llvm_report_error("Bad ${:} expression in inline asm string: '"
+ + std::string(AsmStr) + "'");
}
Modifier[0] = *LastEmitted;
@@ -1490,17 +1489,15 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
}
if (*LastEmitted != '}') {
- cerr << "Bad ${} expression in inline asm string: '"
- << AsmStr << "'\n";
- exit(1);
+ llvm_report_error("Bad ${} expression in inline asm string: '"
+ + std::string(AsmStr) + "'");
}
++LastEmitted; // Consume '}' character.
}
if ((unsigned)Val >= NumOperands-1) {
- cerr << "Invalid $ operand number in inline asm string: '"
- << AsmStr << "'\n";
- exit(1);
+ llvm_report_error("Invalid $ operand number in inline asm string: '"
+ + std::string(AsmStr) + "'");
}
// Okay, we finally have a value number. Ask the target to print this
@@ -1538,10 +1535,12 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
}
}
if (Error) {
- cerr << "Invalid operand found in inline asm: '"
+ std::string msg;
+ raw_string_ostream Msg(msg);
+ Msg << "Invalid operand found in inline asm: '"
<< AsmStr << "'\n";
- MI->dump();
- exit(1);
+ MI->print(Msg);
+ llvm_report_error(Msg.str());
}
}
break;
@@ -1747,5 +1746,5 @@ GCMetadataPrinter *AsmPrinter::GetOrCreateGCPrinter(GCStrategy *S) {
}
cerr << "no GCMetadataPrinter registered for GC: " << Name << "\n";
- abort();
+ llvm_unreachable();
}
diff --git a/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp b/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
index 8ba903a65d..0d3a2780ba 100644
--- a/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
@@ -16,6 +16,7 @@
#include "llvm/CodeGen/GCMetadataPrinter.h"
#include "llvm/Module.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
@@ -115,11 +116,13 @@ void OcamlGCMetadataPrinter::finishAssembly(raw_ostream &OS, AsmPrinter &AP,
uint64_t FrameSize = FI.getFrameSize();
if (FrameSize >= 1<<16) {
- cerr << "Function '" << FI.getFunction().getNameStart()
+ std::string msg;
+ raw_string_ostream Msg(msg);
+ Msg << "Function '" << FI.getFunction().getNameStart()
<< "' is too large for the ocaml GC! "
<< "Frame size " << FrameSize << " >= 65536.\n";
- cerr << "(" << uintptr_t(&FI) << ")\n";
- abort(); // Very rude!
+ Msg << "(" << uintptr_t(&FI) << ")";
+ llvm_report_error(Msg.str()); // Very rude!
}
OS << "\t" << TAI.getCommentString() << " live roots for "
@@ -128,10 +131,12 @@ void OcamlGCMetadataPrinter::finishAssembly(raw_ostream &OS, AsmPrinter &AP,
for (GCFunctionInfo::iterator J = FI.begin(), JE = FI.end(); J != JE; ++J) {
size_t LiveCount = FI.live_size(J);
if (LiveCount >= 1<<16) {
- cerr << "Function '" << FI.getFunction().getNameStart()
+ std::string msg;
+ raw_string_ostream Msg(msg);
+ Msg << "Function '" << FI.getFunction().getNameStart()
<< "' is too large for the ocaml GC! "
- << "Live root count " << LiveCount << " >= 65536.\n";
- abort(); // Very rude!
+ << "Live root count " << LiveCount << " >= 65536.";
+ llvm_report_error(Msg.str()); // Very rude!
}
OS << AddressDirective
diff --git a/lib/CodeGen/GCMetadata.cpp b/lib/CodeGen/GCMetadata.cpp
index cf2ebb39ad..14177dacdc 100644
--- a/lib/CodeGen/GCMetadata.cpp
+++ b/lib/CodeGen/GCMetadata.cpp
@@ -18,6 +18,7 @@
#include "llvm/CodeGen/Passes.h"
#include "llvm/Function.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/ErrorHandling.h"
using namespace llvm;
@@ -92,9 +93,9 @@ GCStrategy *GCModuleInfo::getOrCreateStrategy(const Module *M,
return S;
}
}
-
+
cerr << "unsupported GC: " << Name << "\n";
- abort();
+ llvm_unreachable();
}
GCFunctionInfo &GCModuleInfo::getFunctionInfo(const Function &F) {
diff --git a/lib/CodeGen/GCStrategy.cpp b/lib/CodeGen/GCStrategy.cpp
index ad7421abc2..560cf7df81 100644
--- a/lib/CodeGen/GCStrategy.cpp
+++ b/lib/CodeGen/GCStrategy.cpp
@@ -28,6 +28,7 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/ErrorHandling.h"
using namespace llvm;
@@ -108,7 +109,7 @@ bool GCStrategy::initializeCustomLowering(Module &M) { return false; }
bool GCStrategy::performCustomLowering(Function &F) {
cerr << "gc " << getName() << " must override performCustomLowering.\n";
- abort();
+ llvm_unreachable();
return 0;
}
diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp
index d5e7ea59a7..739c06b11a 100644
--- a/lib/CodeGen/IfConversion.cpp
+++ b/lib/CodeGen/IfConversion.cpp
@@ -21,6 +21,8 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h"
@@ -1130,8 +1132,10 @@ void IfConverter::PredicateBlock(BBInfo &BBI,
if (TII->isPredicated(I))
continue;
if (!TII->PredicateInstruction(I, Cond)) {
- cerr << "Unable to predicate " << *I << "!\n";
- abort();
+ std::string msg;
+ raw_string_ostream Msg(msg);
+ Msg << "Unable to predicate " << *I << "!";
+ llvm_report_error(Msg.str());
}
}
@@ -1164,8 +1168,10 @@ void IfConverter::CopyAndPredicateBlock(BBInfo &ToBBI, BBInfo &FromBBI,
if (!isPredicated)
if (!TII->PredicateInstruction(MI, Cond)) {
- cerr << "Unable to predicate " << *MI << "!\n";
- abort();
+ std::string msg;
+ raw_string_ostream Msg(msg);
+ Msg << "Unable to predicate " << *MI << "!";
+ llvm_report_error(Msg.str());
}
}
diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp
index 64a5c9e699..9eacdfe4d5 100644
--- a/lib/CodeGen/IntrinsicLowering.cpp
+++ b/lib/CodeGen/IntrinsicLowering.cpp
@@ -17,6 +17,7 @@
#include "llvm/Type.h"
#include "llvm/CodeGen/IntrinsicLowering.h"
#include "llvm/Support/IRBuilder.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Target/TargetData.h"
#include "llvm/ADT/SmallVector.h"
using namespace llvm;
@@ -626,7 +627,7 @@ static void ReplaceFPIntrinsicWithCall(CallInst *CI, const char *Fname,
const char *Dname,
const char *LDname) {
switch (CI->getOperand(1)->getType()->getTypeID()) {
- default: assert(0 && "Invalid type in intrinsic"); abort();
+ default: LLVM_UNREACHABLE( "Invalid type in intrinsic");
case Type::FloatTyID:
ReplaceCallWith(Fname, CI, CI->op_begin() + 1, CI->op_end(),
Type::FloatTy);
@@ -652,13 +653,11 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
switch (Callee->getIntrinsicID()) {
case Intrinsic::not_intrinsic:
- cerr << "Cannot lower a call to a non-intrinsic function '"
- << Callee->getName() << "'!\n";
- abort();
+ llvm_report_error("Cannot lower a call to a non-intrinsic function '"+
+ Callee->getName() + "'!");
default:
- cerr << "Error: Code generator does not support intrinsic function '"
- << Callee->getName() << "'!\n";
- abort();
+ llvm_report_error("Code generator does not support intrinsic function '"+
+ Callee->getName()+"'!");
// The setjmp/longjmp intrinsics should only exist in the code if it was
// never optimized (ie, right out of the CFE), or if it has been hacked on
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index b13f494273..6abe465cb1 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -34,6 +34,8 @@
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/Statistic.h"
@@ -2450,13 +2452,15 @@ bool LiveIntervals::spillPhysRegAroundRegDefsUses(const LiveInterval &li,
pli.removeRange(StartIdx, EndIdx);
Cut = true;
} else {
- cerr << "Ran out of registers during register allocation!\n";
+ std::string msg;
+ raw_string_ostream Msg(msg);
+ Msg << "Ran out of registers during register allocation!";
if (MI->getOpcode() == TargetInstrInfo::INLINEASM) {
- cerr << "Please check your inline asm statement for invalid "
+ Msg << "\nPlease check your inline asm statement for invalid "
<< "constraints:\n";
- MI->print(cerr.stream(), tm_);
+ MI->print(Msg, tm_);
}
- exit(1);
+ llvm_report_error(Msg.str());
}
for (const unsigned* AS = tri_->getSubRegisters(SpillReg); *AS; ++AS) {
if (!hasInterval(*AS))
diff --git a/lib/CodeGen/MachOWriter.cpp b/lib/CodeGen/MachOWriter.cpp
index 3ad03a4eee..12f5cecbef 100644
--- a/lib/CodeGen/MachOWriter.cpp
+++ b/lib/CodeGen/MachOWriter.cpp
@@ -35,6 +35,7 @@
#include "llvm/Target/TargetMachOWriterInfo.h"
#include "llvm/Support/Mangler.h"
#include "llvm/Support/OutputBuffer.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
@@ -634,8 +635,7 @@ void MachOWriter::InitMem(const Constant *C, uintptr_t Offset,
case Instruction::Add:
default:
cerr << "ConstantExpr not handled as global var init: " << *CE << "\n";
- abort();
- break;
+ llvm_unreachable();
}
} else if (PC->getType()->isSingleValueType()) {
unsigned char *ptr = (unsigned char *)PA;
@@ -710,11 +710,13 @@ void MachOWriter::InitMem(const Constant *C, uintptr_t Offset,
ScatteredOffset));
ScatteredOffset = 0;
} else
- assert(0 && "Unknown constant pointer type!");
+ LLVM_UNREACHABLE("Unknown constant pointer type!");
break;
default:
- cerr << "ERROR: Constant unimp for type: " << *PC->getType() << "\n";
- abort();
+ std::string msg;
+ raw_string_ostream Msg(msg);
+ Msg << "ERROR: Constant unimp for type: " << *PC->getType();
+ llvm_report_error(Msg.str());
}
} else if (isa<ConstantAggregateZero>(PC)) {
memset((void*)PA, 0, (size_t)TD->getTypeAllocSize(PC->getType()));
diff --git a/lib/CodeGen/MachineVerifier.cpp b/lib/CodeGen/MachineVerifier.cpp
index be1396c7a8..e9b90fa040 100644
--- a/lib/CodeGen/MachineVerifier.cpp
+++ b/lib/CodeGen/MachineVerifier.cpp
@@ -36,6 +36,8 @@
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
#include <fstream>
using namespace llvm;
@@ -219,8 +221,10 @@ MachineVerifier::runOnMachineFunction(MachineFunction &MF)
OutFile.close();
if (foundErrors) {
- cerr << "\nStopping with " << foundErrors << " machine code errors.\n";
- exit(1);
+ std::string msg;
+ raw_string_ostream Msg(msg);
+ Msg << "\nStopping with " << foundErrors << " machine code errors.";
+ llvm_report_error(Msg.str());
}
return false; // no changes
diff --git a/lib/CodeGen/PreAllocSplitting.cpp b/lib/CodeGen/PreAllocSplitting.cpp
index 076f4896cf..52a403bd36 100644
--- a/lib/CodeGen/PreAllocSplitting.cpp
+++ b/lib/CodeGen/PreAllocSplitting.cpp
@@ -31,6 +31,7 @@
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/SmallPtrSet.h"
@@ -1036,8 +1037,7 @@ bool PreAllocSplitting::SplitRegLiveInterval(LiveInterval *LI) {
if (ValNo->isUnused()) {
// Defined by a dead def? How can this be?
- assert(0 && "Val# is defined by a dead def?");
- abort();
+ LLVM_UNREACHABLE("Val# is defined by a dead def?");
}
MachineInstr *DefMI = ValNo->isDefAccurate()
diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp
index 904b4cb2a4..fb837511c5 100644
--- a/lib/CodeGen/RegAllocLinearScan.cpp
+++ b/lib/CodeGen/RegAllocLinearScan.cpp
@@ -34,7 +34,9 @@
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/ErrorHandling.h"
#include <algorithm>
#include <set>
#include <queue>
@@ -235,7 +237,7 @@ namespace {
}
}
if (Error)
- abort();
+ llvm_unreachable();
#endif
regUse_.clear();
regUseBackUp_.clear();
@@ -1102,8 +1104,7 @@ void RALinScan::assignRegOrStackSlotAtInterval(LiveInterval* cur)
DowngradedRegs.clear();
assignRegOrStackSlotAtInterval(cur);
} else {
- cerr << "Ran out of registers during register allocation!\n";
- exit(1);
+ llvm_report_error("Ran out of registers during register allocation!");
}
return;
}
diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp
index e1cc20cf4f..1b09f77613 100644
--- a/lib/CodeGen/RegAllocLocal.cpp
+++ b/lib/CodeGen/RegAllocLocal.cpp
@@ -25,6 +25,8 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/IndexedMap.h"
#include "llvm/ADT/SmallSet.h"
@@ -517,24 +519,28 @@ MachineInstr *RALocal::reloadVirtReg(MachineBasicBlock &MBB, MachineInstr *MI,
getVirtRegLastUse(VirtReg) = std::make_pair(MI, OpNum);
if (!ReloadedRegs.insert(PhysReg)) {
- cerr << "Ran out of registers during register allocation!\n";
+ std::string msg;
+ raw_string_ostream Msg(msg);
+ Msg << "Ran out of registers during register allocation!";
if (MI->getOpcode() == TargetInstrInfo::INLINEASM) {
- cerr << "Please check your inline asm statement for invalid "
+ Msg << "\nPlease check your inline asm statement for invalid "
<< "constraints:\n";
- MI->print(cerr.stream(), TM);
+ MI->print(Msg, TM);
}
- exit(1);
+ llvm_report_error(Msg.str());
}
for (const unsigned *SubRegs = TRI->getSubRegisters(PhysReg);
*SubRegs; ++SubRegs) {
if (!ReloadedRegs.insert(*SubRegs)) {
- cerr << "Ran out of registers during register allocation!\n";
+ std::string msg;
+ raw_string_ostream Msg(msg);
+ Msg << "Ran out of registers during register allocation!";
if (MI->getOpcode() == TargetInstrInfo::INLINEASM) {
- cerr << "Please check your inline asm statement for invalid "
+ Msg << "\nPlease check your inline asm statement for invalid "
<< "constraints:\n";
- MI->print(cerr.stream(), TM);
+ MI->print(Msg, TM);
}
- exit(1);
+ llvm_report_error(Msg.str());
}
}
diff --git a/lib/CodeGen/RegisterScavenging.cpp b/lib/CodeGen/RegisterScavenging.cpp
index d7fe7a2d54..ab9a0e340d 100644
--- a/lib/CodeGen/RegisterScavenging.cpp
+++ b/lib/CodeGen/RegisterScavenging.cpp
@@ -20,6 +20,7 @@
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetMachine.h"
@@ -459,8 +460,7 @@ unsigned RegScavenger::scavengeRegister(const TargetRegisterClass *RC,
}
if (ScavengedReg != 0) {
- assert(0 && "Scavenger slot is live, unable to scavenge another register!");
- abort();
+ LLVM_UNREACHABLE("Scavenger slot is live, unable to scavenge another register!");
}
// Spill the scavenged register before I.
diff --git a/lib/CodeGen/SelectionDAG/CallingConvLower.cpp b/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
index 8b8f0e5f84..9289711e6e 100644
--- a/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
+++ b/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
@@ -13,6 +13,8 @@
//===----------------------------------------------------------------------===//
#include "llvm/CodeGen/CallingConvLower.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
@@ -65,9 +67,11 @@ void CCState::AnalyzeFormalArguments(SDNode *TheArgs, CCAssignFn Fn) {
ISD::ArgFlagsTy ArgFlags =
cast<ARG_FLAGSSDNode>(TheArgs->getOperand(3+i))->getArgFlags();
if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) {
- cerr << "Formal argument #" << i << " has unhandled type "
- << ArgVT.getMVTString() << "\n";
- abort();
+ std::string msg;
+ raw_string_ostream Msg(msg);
+ Msg << "Formal argument #" << i << " has unhandled type "
+ << ArgVT.getMVTString();
+ llvm_report_error(Msg.str());
}
}
}
@@ -81,9 +85,11 @@ void CCState::AnalyzeReturn(SDNode *TheRet, CCAssignFn Fn) {
ISD::ArgFlagsTy ArgFlags =
cast<ARG_FLAGSSDNode>(TheRet->getOperand(i*2+2))->getArgFlags();
if (Fn(i, VT, VT, CCValAssign::Full, ArgFlags, *this)){
- cerr << "Return operand #" << i << " has unhandled type "
- << VT.getMVTString() << "\n";
- abort();
+ std::string msg;
+ raw_string_ostream Msg(msg);
+ Msg << "Return operand #" << i << " has unhandled type "
+ << VT.getMVTString();
+ llvm_report_error(Msg.str());
}
}
}
@@ -97,9 +103,11 @@ void CCState::AnalyzeCallOperands(CallSDNode *TheCall, CCAssignFn Fn) {
MVT ArgVT = TheCall->getArg(i).getValueType();
ISD::ArgFlagsTy ArgFlags = TheCall->getArgFlags(i);
if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) {
- cerr << "Call operand #" << i << " has unhandled type "
- << ArgVT.getMVTString() << "\n";
- abort();
+ std::string msg;
+ raw_string_ostream Msg(msg);
+ Msg << "Call operand #" << i << " has unhandled type "
+ << ArgVT.getMVTString();
+ llvm_report_error(Msg.str());
}
}
}
@@ -114,9 +122,11 @@ void CCState::AnalyzeCallOperands(SmallVectorImpl<MVT> &ArgVTs,
MVT ArgVT = ArgVTs[i];
ISD::ArgFlagsTy ArgFlags = Flags[i];
if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) {
- cerr << "Call operand #" << i << " has unhandled type "
- << ArgVT.getMVTString() << "\n";
- abort();
+ std::string msg;
+ raw_string_ostream Msg(msg);
+ Msg << "Call operand #" << i << " has unhandled type "
+ << ArgVT.getMVTString();
+ llvm_report_error(Msg.str());
}
}
}
@@ -130,9 +140,11 @@ void CCState::AnalyzeCallResult(CallSDNode *TheCall, CCAssignFn Fn) {
if (TheCall->isInreg())
Flags.setInReg();
if (Fn(i, VT, VT, CCValAssign::Full, Flags, *this)) {
- cerr << "Call result #" << i << " has unhandled type "
- << VT.getMVTString() << "\n";
- abort();
+ std::string msg;
+ raw_string_ostream Msg(msg);
+ Msg << "Call result #" << i << " has unhandled type "
+ << VT.getMVTString();
+ llvm_report_error(Msg.str());
}
}
}
@@ -141,8 +153,10 @@ void CCState::AnalyzeCallResult(CallSDNode *TheCall, CCAssignFn Fn) {
/// produce a single value.
void CCState::AnalyzeCallResult(MVT VT, CCAssignFn Fn) {
if (Fn(0, VT, VT, CCValAssign::Full, ISD::ArgFlagsTy(), *this)) {
- cerr << "Call result has unhandled type "
- << VT.getMVTString() << "\n";
- abort();
+ std::string msg;
+ raw_string_ostream Msg(msg);
+ Msg << "Call result has unhandled type "
+ << VT.getMVTString();
+ llvm_report_error(Msg.str());
}
}
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 868a5b5727..eb9dccb289 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -33,6 +33,7 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include <algorithm>
#include <set>
@@ -2258,8 +2259,7 @@ SDValue DAGCombiner::visitXOR(SDNode *N) {
if (!LegalOperations || TLI.isCondCodeLegal(NotCC, LHS.getValueType())) {
switch (N0.getOpcode()) {
default:
- assert(0 && "Unhandled SetCC Equivalent!");
- abort();
+ LLVM_UNREACHABLE("Unhandled SetCC Equivalent!");
case ISD::SETCC:
return DAG.getSetCC(N->getDebugLoc(), VT, LHS, RHS, NotCC);
case ISD::SELECT_CC:
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 19456417b7..a4fff892da 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -32,6 +32,7 @@
#include "llvm/GlobalVariable.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
@@ -948,8 +949,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
#ifndef NDEBUG
cerr << "NODE: "; Node->dump(&DAG); cerr << "\n";
#endif
- assert(0 && "Do not know how to legalize this operator!");
- abort();
+ LLVM_UNREACHABLE("Do not know how to legalize this operator!");
case ISD::CALL:
// The only option for this is to custom lower it.
Tmp3 = TLI.LowerOperation(Result.getValue(0), DAG);
@@ -1699,7 +1699,7 @@ void SelectionDAGLegalize::LegalizeSetCCCondCode(MVT VT,
ISD::CondCode CC1 = ISD::SETCC_INVALID, CC2 = ISD::SETCC_INVALID;
unsigned Opc = 0;
switch (CCCode) {
- default: assert(0 && "Don't know how to expand this condition!"); abort();
+ default: LLVM_UNREACHABLE("Don't know how to expand this condition!");
case ISD::SETOEQ: CC1 = ISD::SETEQ; CC2 = ISD::SETO; Opc = ISD::AND; break;
case ISD::SETOGT: CC1 = ISD::SETGT; CC2 = ISD::SETO; Opc = ISD::AND; break;
case ISD::SETOGE: CC1 = ISD::SETGE; CC2 = ISD::SETO; Opc = ISD::AND; break;
@@ -2147,7 +2147,7 @@ SDValue SelectionDAGLegalize::ExpandBSWAP(SDValue Op, DebugLoc dl) {
MVT SHVT = TLI.getShiftAmountTy();
SDValue Tmp1, Tmp2, Tmp3, Tmp4, Tmp5, Tmp6, Tmp7, Tmp8;
switch (VT.getSimpleVT()) {
- default: assert(0 && "Unhandled Expand type in BSWAP!"); abort();
+ default: LLVM_UNREACHABLE("Unhandled Expand type in BSWAP!");
case MVT::i16:
Tmp2 = DAG.getNode(ISD::SHL, dl, VT, Op, DAG.getConstant(8, SHVT));
Tmp1 = DAG.getNode(ISD::SRL, dl, VT, Op, DAG.getConstant(8, SHVT));
diff --git a/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
index 1ad0ddd69e..9428525cf8 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
@@ -20,6 +20,8 @@
//===----------------------------------------------------------------------===//
#include "LegalizeTypes.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
using namespace llvm;
/// GetFPLibCall - Return the right libcall for the given floating point type.
@@ -51,8 +53,7 @@ void DAGTypeLegalizer::SoftenFloatResult(SDNode *N, unsigned ResNo) {
cerr << "SoftenFloatResult #" << ResNo << ": ";
N->dump(&DAG); cerr << "\n";
#endif
- assert(0 && "Do not know how to soften the result of this operator!");
- abort();
+ LLVM_UNREACHABLE("Do not know how to soften the result of this operator!");
case ISD::BIT_CONVERT: R = SoftenFloatRes_BIT_CONVERT(N); break;
case ISD::BUILD_PAIR: R = SoftenFloatRes_BUILD_PAIR(N); break;
@@ -540,8 +541,7 @@ bool DAGTypeLegalizer::SoftenFloatOperand(SDNode *N, unsigned OpNo) {
cerr << "SoftenFloatOperand Op #" << OpNo << ": ";
N->dump(&DAG); cerr << "\n";
#endif
- assert(0 && "Do not know how to soften this operator's operand!");
- abort();
+ LLVM_UNREACHABLE("Do not know how to soften this operator's operand!");
case ISD::BIT_CONVERT: Res = SoftenFloatOp_BIT_CONVERT(N); break;
case ISD::BR_CC: Res = SoftenFloatOp_BR_CC(N); break;
@@ -781,8 +781,7 @@ void DAGTypeLegalizer::ExpandFloatResult(SDNode *N, unsigned ResNo) {
cerr << "ExpandFloatResult #" << ResNo << ": ";
N->dump(&DAG); cerr << "\n";
#endif
- assert(0 && "Do not know how to expand the result of this operator!");
- abort();
+ LLVM_UNREACHABLE("Do not know how to expand the result of this operator!");
case ISD::MERGE_VALUES: SplitRes_MERGE_VALUES(N, Lo, Hi); break;
case ISD::UNDEF: SplitRes_UNDEF(N, Lo, Hi); break;
@@ -1181,8 +1180,7 @@ bool DAGTypeLegalizer::ExpandFloatOperand(SDNode *N, unsigned OpNo) {
cerr << "ExpandFloatOperand Op #" << OpNo << ": ";
N->dump(&DAG); cerr << "\n";
#endif
- assert(0 && "Do not know how to expand this operator's operand!");
- abort();
+ LLVM_UNREACHABLE("Do not know how to expand this operator's operand!");
case ISD::BIT_CONVERT: Res = ExpandOp_BIT_CONVERT(N); break;
case ISD::BUILD_VECTOR: Res = ExpandOp_BUILD_VECTOR(N); break;
diff --git a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index 92446544a5..730619c7f4 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -20,6 +20,7 @@
#include "LegalizeTypes.h"
#include "llvm/CodeGen/PseudoSourceValue.h"
+#include "llvm/Support/ErrorHandling.h"
using namespace llvm;
//===----------------------------------------------------------------------===//
@@ -44,8 +45,7 @@ void DAGTypeLegalizer::PromoteIntegerResult(SDNode *N, unsigned ResNo) {
cerr << "PromoteIntegerResult #" << ResNo << ": ";
N->dump(&DAG); cerr << "\n";
#endif
- assert(0 && "Do not know how to promote this operator!");
- abort();
+ LLVM_UNREACHABLE("Do not know how to promote this operator!");
case ISD::AssertSext: Res = PromoteIntRes_AssertSext(N); break;
case ISD::AssertZext: Res = PromoteIntRes_AssertZext(N); break;
case ISD::BIT_CONVERT: Res = PromoteIntRes_BIT_CONVERT(N); break;
@@ -610,8 +610,7 @@ bool DAGTypeLegalizer::PromoteIntegerOperand(SDNode *N, unsigned OpNo) {
cerr << "PromoteIntegerOperand Op #" << OpNo << ": ";
N->dump(&DAG); cerr << "\n";
#endif
- assert(0 && "Do not know how to promote this operator's operand!");
- abort();
+ LLVM_UNREACHABLE("Do not know how to promote this operator's operand!");
case ISD::ANY_EXTEND: Res = PromoteIntOp_ANY_EXTEND(N); break;
case ISD::BIT_CONVERT: Res = PromoteIntOp_BIT_CONVERT(N); break;
@@ -924,8 +923,7 @@ void DAGTypeLegalizer::ExpandIntegerResult(SDNode *N, unsigned ResNo) {
cerr << "ExpandIntegerResult #" << ResNo << ": ";
N->dump(&DAG); cerr << "\n";
#endif
- assert(0 && "Do not know how to expand the result of this operator!");
- abort();
+ LLVM_UNREACHABLE("Do not know how to expand the result of this operator!");
case ISD::MERGE_VALUES: SplitRes_MERGE_VALUES(N, Lo, Hi); break;
case ISD::SELECT: SplitRes_SELECT(N, Lo, Hi); break;
@@ -1970,8 +1968,7 @@ bool DAGTypeLegalizer::ExpandIntegerOperand(SDNode *N, unsigned OpNo) {
cerr << "ExpandIntegerOperand Op #" << OpNo << ": ";
N->dump(&DAG); cerr << "\n";
#endif
- assert(0 && "Do not know how to expand this operator's operand!");
- abort();
+ LLVM_UNREACHABLE("Do not know how to expand this operator's operand!");
case ISD::BIT_CONVERT: Res = ExpandOp_BIT_CONVERT(N); break;
case ISD::BR_CC: Res = ExpandIntOp_BR_CC(N); break;
diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
index 183b1fa51f..f8d198a34b 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
@@ -17,6 +17,7 @@
#include "llvm/CallingConv.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Target/TargetData.h"
using namespace llvm;
@@ -149,7 +150,7 @@ void DAGTypeLegalizer::PerformExpensiveChecks() {
if (Mapped & 128)
cerr << " WidenedVectors";
cerr << "\n";
- abort();
+ llvm_unreachable();
}
}
}
@@ -431,7 +432,7 @@ NodeDone:
if (Failed) {
I->dump(&DAG); cerr << "\n";
- abort();
+ llvm_unreachable();
}
}
#endif
diff --git a/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
index 8bec4c7b15..d4e886d254 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
@@ -23,6 +23,7 @@
#include "LegalizeTypes.h"
#include "llvm/CodeGen/PseudoSourceValue.h"
#include "llvm/Target/TargetData.h"
+#include "llvm/Support/ErrorHandling.h"
using namespace llvm;
//===----------------------------------------------------------------------===//
@@ -40,8 +41,7 @@ void DAGTypeLegalizer::ScalarizeVectorResult(SDNode *N, unsigned ResNo) {
cerr << "ScalarizeVectorResult #" << ResNo << ": ";
N->dump(&DAG); cerr << "\n";
#endif
- assert(0 && "Do not know how to scalarize the result of this operator!");
- abort();
+ LLVM_UNREACHABLE("Do not know how to scalarize the result of this operator!");
case ISD::BIT_CONVERT: R = ScalarizeVecRes_BIT_CONVERT(N); break;
case ISD::BUILD_VECTOR: R = N->getOperand(0); break;
@@ -378,8 +378,7 @@ void DAGTypeLegalizer::SplitVectorResult(SDNode *N, unsigned ResNo) {
cerr << "SplitVectorResult #" << ResNo << ": ";
N->dump(&DAG); cerr << "\n";
#endif
- assert(0 && "Do not know how to split the result of this operator!");
- abort();
+ LLVM_UNREACHABLE("Do not know how to split the result of this operator!");
case ISD::MERGE_VALUES: SplitRes_MERGE_VALUES(N, Lo, Hi); break;
case ISD::SELECT: SplitRes_SELECT(N, Lo, Hi); break;
@@ -929,8 +928,7 @@ bool DAGTypeLegalizer::SplitVectorOperand(SDNode *N, unsigned OpNo) {
cerr << "SplitVectorOperand Op #" << OpNo << ": ";
N->dump(&DAG); cerr << "\n";
#endif
- assert(0 && "Do not know how to split this operator's operand!");
- abort();
+ LLVM_UNREACHABLE("Do not know how to split this operator's operand!");
case ISD::BIT_CONVERT: Res = SplitVecOp_BIT_CONVERT(N); break;
case ISD::EXTRACT_SUBVECTOR: Res = SplitVecOp_EXTRACT_SUBVECTOR(N); break;
@@ -1119,8 +1117,7 @@ void DAGTypeLegalizer::WidenVectorResult(SDNode *N, unsigned ResNo) {
cerr << "WidenVectorResult #" << ResNo << ": ";
N->dump(&DAG); cerr << "\n";
#endif
- assert(0 && "Do not know how to widen the result of this operator!");
- abort();
+ LLVM_UNREACHABLE("Do not know how to widen the result of this operator!");
case ISD::BIT_CONVERT: Res = WidenVecRes_BIT_CONVERT(N); break;
case ISD::BUILD_VECTOR: Res = WidenVecRes_BUILD_VECTOR(N); break;
@@ -1776,8 +1773,7 @@ bool DAGTypeLegalizer::WidenVectorOperand(SDNode *N, unsigned ResNo) {
cerr << "WidenVectorOperand op #" << ResNo << ": ";
N->dump(&DAG); cerr << "\n";
#endif
- assert(0 && "Do not know how to widen this operator's operand!");
- abort();
+ LLVM_UNREACHABLE("Do not know how to widen this operator's operand!");
case ISD::BIT_CONVERT: Res = WidenVecOp_BIT_CONVERT(N); break;
case ISD::CONCAT_VECTORS: Res = WidenVecOp_CONCAT_VECTORS(N); break;
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
index af73b28fae..4f6e59cd0d 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
@@ -24,6 +24,7 @@
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/ErrorHandling.h"
using namespace llvm;
STATISTIC(NumUnfolds, "Number of nodes unfolded");
@@ -568,8 +569,7 @@ void ScheduleDAGFast::ListScheduleBottomUp() {
}
if (!CurSU) {
- assert(false && "Unable to resolve live physical register dependencies!");
- abort();
+ LLVM_UNREACHABLE("Unable to resolve live physical register dependencies!");
}
}
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
index 391cf17fa1..1e31b8f551 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
@@ -49,6 +49,7 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
@@ -817,8 +818,7 @@ void SelectionDAGLowering::visit(unsigned Opcode, User &I) {
// Note: this doesn't use InstVisitor, because it has to work with
// ConstantExpr's in addition to instructions.
switch (Opcode) {
- default: assert(0 && "Unknown instruction type encountered!");
- abort();
+ default: LLVM_UNREACHABLE("Unknown instruction type encountered!");
// Build the switch statement using the Instruction.def file.
#define HANDLE_INST(NUM, OPCODE, CLASS) \
case Instruction::OPCODE:return visit##OPCODE((CLASS&)I);
@@ -4160,13 +4160,11 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
}
case Intrinsic::part_select: {
// Currently not implemented: just abort
- assert(0 && "part_select intrinsic not implemented");
- abort();
+ llvm_report_error("part_select intrinsic not implemented");
}
case Intrinsic::part_set: {
// Currently not implemented: just abort
- assert(0 && "part_set intrinsic not implemented");
- abort();
+ llvm_report_error("part_set intrinsic not implemented");
}
case Intrinsic::bswap:
setValue(&I, DAG.getNode(ISD::BSWAP, dl,
@@ -5084,9 +5082,9 @@ void SelectionDAGLowering::visitInlineAsm(CallSite CS) {
Input.ConstraintVT.isInteger()) ||
(OpInfo.ConstraintVT.getSizeInBits() !=
Input.ConstraintVT.getSizeInBits())) {
- cerr << "llvm: error: Unsupported asm: input constraint with a "
- << "matching output constraint of incompatible type!\n";
- exit(1);
+ llvm_report_error("llvm: error: Unsupported asm: input constraint"
+ " with a matching output constraint of incompatible"
+ " type!");
}
Input.ConstraintVT = OpInfo.ConstraintVT;
}
@@ -5189,9 +5187,8 @@ void SelectionDAGLowering::visitInlineAsm(CallSite CS) {
// Copy the output from the appropriate register. Find a register that
// we can use.
if (OpInfo.AssignedRegs.Regs.empty()) {
- cerr << "llvm: error: Couldn't allocate output reg for constraint '"
- << OpInfo.ConstraintCode << "'!\n";
- exit(1);
+ llvm_report_error("llvm: error: Couldn't allocate output reg for"
+ " constraint '" + OpInfo.ConstraintCode + "'!");
}
// If this is an indirect operand, store through the pointer after the
@@ -5244,10 +5241,9 @@ void SelectionDAGLowering::visitInlineAsm(CallSite CS) {
|| (OpFlag & 7) == 6 /* EARLYCLOBBER REGDEF */) {
// Add (OpFlag&0xffff)>>3 registers to MatchedRegs.
if (OpInfo.isIndirect) {
- cerr << "llvm: error: "
- "Don't know how to handle tied indirect "
- "register inputs yet!\n";
- exit(1);
+ llvm_report_error("llvm: error: "
+ "Don't know how to handle tied indirect "
+ "register inputs yet!");
}
RegsForValue MatchedRegs;
MatchedRegs.TLI = &TLI;
@@ -5289,9 +5285,8 @@ void SelectionDAGLowering::visitInlineAsm(CallSite CS) {
TLI.LowerAsmOperandForConstraint(InOperandVal, OpInfo.ConstraintCode[0],
hasMemory, Ops, DAG);
if (Ops.empty()) {
- cerr << "llvm: error: Invalid operand for inline asm constraint '"
- << OpInfo.ConstraintCode << "'!\n";
- exit(1);
+ llvm_report_error("llvm: error: Invalid operand for inline asm"
+ " constraint '" + OpInfo.ConstraintCode + "'!");
}
// Add information to the INLINEASM node to know about this input.
@@ -5321,9 +5316,8 @@ void SelectionDAGLowering::visitInlineAsm(CallSite CS) {
// Copy the input into the appropriate registers.
if (OpInfo.AssignedRegs.Regs.empty()) {
- cerr << "llvm: error: Couldn't allocate input reg for constraint '"
- << OpInfo.ConstraintCode << "'!\n";
- exit(1);
+ llvm_report_error("llvm: error: Couldn't allocate input reg for"
+ " constraint '"+ OpInfo.ConstraintCode +"'!");
}
OpInfo.AssignedRegs.getCopyToRegs(InOperandVal, DAG, getCurDebugLoc(),
@@ -5776,8 +5770,7 @@ void TargetLowering::LowerOperationWrapper(SDNode *N,
}
SDValue TargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) {
- assert(0 && "LowerOperation not implemented for this target!");
- abort();
+ LLVM_UNREACHABLE("LowerOperation not implemented for this target!");
return SDValue();
}
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 485545c63a..cadf854f21 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -47,6 +47,7 @@
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Timer.h"
#include <algorithm>
@@ -151,10 +152,9 @@ namespace llvm {
// basic blocks, and the scheduler passes ownership of it to this method.
MachineBasicBlock *TargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
MachineBasicBlock *MBB) const {
- cerr << "If a target marks an instruction with "
- << "'usesCustomDAGSchedInserter', it must implement "
- << "TargetLowering::EmitInstrWithCustomInserter!\n";
- abort();
+ llvm_report_error("If a target marks an instruction with "
+ "'usesCustomDAGSchedInserter', it must implement "
+ "TargetLowering::EmitInstrWithCustomInserter!");
return 0;
}
@@ -875,7 +875,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn,
if (EnableFastISelAbort)
// The "fast" selector couldn't handle something and bailed.
// For the purpose of debugging, just abort.
- assert(0 && "FastISel didn't select the entire block");
+ LLVM_UNREACHABLE("FastISel didn't select the entire block");
}
break;
}
@@ -1215,8 +1215,8 @@ SelectInlineAsmMemoryOperands(std::vector<SDValue> &Ops) {
// Otherwise, this is a memory operand. Ask the target to select it.
std::vector<SDValue> SelOps;
if (SelectInlineAsmMemoryOperand(InOps[i+1], 'm', SelOps)) {
- cerr << "Could not match memory address. Inline asm failure!\n";
- exit(1);
+ llvm_report_error("Could not match memory address. Inline asm"
+ " failure!");
}
// Add this to the output node.