summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/TableGen/Error.cpp5
-rw-r--r--llvm/utils/TableGen/CodeGenDAGPatterns.cpp28
-rw-r--r--llvm/utils/TableGen/CodeGenTarget.cpp6
-rw-r--r--llvm/utils/TableGen/DAGISelMatcherGen.cpp6
-rw-r--r--llvm/utils/TableGen/InstrInfoEmitter.cpp6
-rw-r--r--llvm/utils/TableGen/SubtargetEmitter.cpp6
6 files changed, 29 insertions, 28 deletions
diff --git a/llvm/lib/TableGen/Error.cpp b/llvm/lib/TableGen/Error.cpp
index 8d9ae20dd52..fd089356625 100644
--- a/llvm/lib/TableGen/Error.cpp
+++ b/llvm/lib/TableGen/Error.cpp
@@ -14,6 +14,7 @@
#include "llvm/TableGen/Error.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/Support/Signals.h"
#include "llvm/Support/raw_ostream.h"
#include <cstdlib>
@@ -64,11 +65,15 @@ void PrintError(const Twine &Msg) {
void PrintFatalError(const Twine &Msg) {
PrintError(Msg);
+ // The following call runs the file cleanup handlers.
+ sys::RunInterruptHandlers();
std::exit(1);
}
void PrintFatalError(ArrayRef<SMLoc> ErrorLoc, const Twine &Msg) {
PrintError(ErrorLoc, Msg);
+ // The following call runs the file cleanup handlers.
+ sys::RunInterruptHandlers();
std::exit(1);
}
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index 2552050f678..f03ef61b457 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -913,8 +913,7 @@ SDTypeConstraint::SDTypeConstraint(Record *R) {
x.SDTCisSameNumEltsAs_Info.OtherOperandNum =
R->getValueAsInt("OtherOperandNum");
} else {
- errs() << "Unrecognized SDTypeConstraint '" << R->getName() << "'!\n";
- exit(1);
+ PrintFatalError("Unrecognized SDTypeConstraint '" + R->getName() + "'!\n");
}
}
@@ -932,11 +931,12 @@ static TreePatternNode *getOperandNum(unsigned OpNo, TreePatternNode *N,
OpNo -= NumResults;
if (OpNo >= N->getNumChildren()) {
- errs() << "Invalid operand number in type constraint "
+ std::string S;
+ raw_string_ostream OS(S);
+ OS << "Invalid operand number in type constraint "
<< (OpNo+NumResults) << " ";
- N->dump();
- errs() << '\n';
- exit(1);
+ N->print(OS);
+ PrintFatalError(OS.str());
}
return N->getChild(OpNo);
@@ -1116,9 +1116,9 @@ SDNodeInfo::SDNodeInfo(Record *R) : Def(R) {
} else if (PropList[i]->getName() == "SDNPVariadic") {
Properties |= 1 << SDNPVariadic;
} else {
- errs() << "Unknown SD Node property '" << PropList[i]->getName()
- << "' on node '" << R->getName() << "'!\n";
- exit(1);
+ PrintFatalError("Unknown SD Node property '" +
+ PropList[i]->getName() + "' on node '" +
+ R->getName() + "'!");
}
}
@@ -1223,8 +1223,7 @@ static unsigned GetNumNodeResults(Record *Operator, CodeGenDAGPatterns &CDP) {
return 1;
Operator->dump();
- errs() << "Unhandled node in GetNumNodeResults\n";
- exit(1);
+ PrintFatalError("Unhandled node in GetNumNodeResults");
}
void TreePatternNode::print(raw_ostream &OS) const {
@@ -2373,10 +2372,9 @@ CodeGenDAGPatterns::CodeGenDAGPatterns(RecordKeeper &R) :
Record *CodeGenDAGPatterns::getSDNodeNamed(const std::string &Name) const {
Record *N = Records.getDef(Name);
- if (!N || !N->isSubClassOf("SDNode")) {
- errs() << "Error getting SDNode '" << Name << "'!\n";
- exit(1);
- }
+ if (!N || !N->isSubClassOf("SDNode"))
+ PrintFatalError("Error getting SDNode '" + Name + "'!");
+
return N;
}
diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp
index fc8a8a2a787..da54a75713b 100644
--- a/llvm/utils/TableGen/CodeGenTarget.cpp
+++ b/llvm/utils/TableGen/CodeGenTarget.cpp
@@ -411,9 +411,9 @@ ComplexPattern::ComplexPattern(Record *R) {
} else if (PropList[i]->getName() == "SDNPWantParent") {
Properties |= 1 << SDNPWantParent;
} else {
- errs() << "Unsupported SD Node property '" << PropList[i]->getName()
- << "' on ComplexPattern '" << R->getName() << "'!\n";
- exit(1);
+ PrintFatalError("Unsupported SD Node property '" +
+ PropList[i]->getName() + "' on ComplexPattern '" +
+ R->getName() + "'!");
}
}
diff --git a/llvm/utils/TableGen/DAGISelMatcherGen.cpp b/llvm/utils/TableGen/DAGISelMatcherGen.cpp
index afc500351a9..9663b71d662 100644
--- a/llvm/utils/TableGen/DAGISelMatcherGen.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcherGen.cpp
@@ -268,8 +268,10 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) {
// We can't model ComplexPattern uses that don't have their name taken yet.
// The OPC_CheckComplexPattern operation implicitly records the results.
if (N->getName().empty()) {
- errs() << "We expect complex pattern uses to have names: " << *N << "\n";
- exit(1);
+ std::string S;
+ raw_string_ostream OS(S);
+ OS << "We expect complex pattern uses to have names: " << *N;
+ PrintFatalError(OS.str());
}
// Remember this ComplexPattern so that we can emit it after all the other
diff --git a/llvm/utils/TableGen/InstrInfoEmitter.cpp b/llvm/utils/TableGen/InstrInfoEmitter.cpp
index f999326bc97..d007c1d3907 100644
--- a/llvm/utils/TableGen/InstrInfoEmitter.cpp
+++ b/llvm/utils/TableGen/InstrInfoEmitter.cpp
@@ -575,10 +575,8 @@ void InstrInfoEmitter::emitEnums(raw_ostream &OS) {
// We must emit the PHI opcode first...
std::string Namespace = Target.getInstNamespace();
- if (Namespace.empty()) {
- fprintf(stderr, "No instructions defined!\n");
- exit(1);
- }
+ if (Namespace.empty())
+ PrintFatalError("No instructions defined!");
const std::vector<const CodeGenInstruction*> &NumberedInstructions =
Target.getInstructionsByEnumValue();
diff --git a/llvm/utils/TableGen/SubtargetEmitter.cpp b/llvm/utils/TableGen/SubtargetEmitter.cpp
index e5c62fa1375..5ab7b136cf4 100644
--- a/llvm/utils/TableGen/SubtargetEmitter.cpp
+++ b/llvm/utils/TableGen/SubtargetEmitter.cpp
@@ -121,10 +121,8 @@ void SubtargetEmitter::Enumeration(raw_ostream &OS,
unsigned N = DefList.size();
if (N == 0)
return;
- if (N > 64) {
- errs() << "Too many (> 64) subtarget features!\n";
- exit(1);
- }
+ if (N > 64)
+ PrintFatalError("Too many (> 64) subtarget features!");
OS << "namespace " << Target << " {\n";
OpenPOWER on IntegriCloud