mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Fix tablegen's PrintFatalError function to run registered file
cleanups. Also, change code in tablegen which printed a message and then called "exit(1)" to use PrintFatalError, instead. This fixes instances where an empty output file was left behind after a failed tablegen invocation, which would confuse subsequent ninja runs into not attempting to rebuild. Differential Revision: http://reviews.llvm.org/D9608 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237058 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1d4481df82
commit
aeda490976
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include "llvm/TableGen/Error.h"
|
#include "llvm/TableGen/Error.h"
|
||||||
#include "llvm/ADT/Twine.h"
|
#include "llvm/ADT/Twine.h"
|
||||||
|
#include "llvm/Support/Signals.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
@ -64,11 +65,15 @@ void PrintError(const Twine &Msg) {
|
|||||||
|
|
||||||
void PrintFatalError(const Twine &Msg) {
|
void PrintFatalError(const Twine &Msg) {
|
||||||
PrintError(Msg);
|
PrintError(Msg);
|
||||||
|
// The following call runs the file cleanup handlers.
|
||||||
|
sys::RunInterruptHandlers();
|
||||||
std::exit(1);
|
std::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintFatalError(ArrayRef<SMLoc> ErrorLoc, const Twine &Msg) {
|
void PrintFatalError(ArrayRef<SMLoc> ErrorLoc, const Twine &Msg) {
|
||||||
PrintError(ErrorLoc, Msg);
|
PrintError(ErrorLoc, Msg);
|
||||||
|
// The following call runs the file cleanup handlers.
|
||||||
|
sys::RunInterruptHandlers();
|
||||||
std::exit(1);
|
std::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -913,8 +913,7 @@ SDTypeConstraint::SDTypeConstraint(Record *R) {
|
|||||||
x.SDTCisSameNumEltsAs_Info.OtherOperandNum =
|
x.SDTCisSameNumEltsAs_Info.OtherOperandNum =
|
||||||
R->getValueAsInt("OtherOperandNum");
|
R->getValueAsInt("OtherOperandNum");
|
||||||
} else {
|
} else {
|
||||||
errs() << "Unrecognized SDTypeConstraint '" << R->getName() << "'!\n";
|
PrintFatalError("Unrecognized SDTypeConstraint '" + R->getName() + "'!\n");
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -932,11 +931,12 @@ static TreePatternNode *getOperandNum(unsigned OpNo, TreePatternNode *N,
|
|||||||
OpNo -= NumResults;
|
OpNo -= NumResults;
|
||||||
|
|
||||||
if (OpNo >= N->getNumChildren()) {
|
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) << " ";
|
<< (OpNo+NumResults) << " ";
|
||||||
N->dump();
|
N->print(OS);
|
||||||
errs() << '\n';
|
PrintFatalError(OS.str());
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return N->getChild(OpNo);
|
return N->getChild(OpNo);
|
||||||
@ -1116,9 +1116,9 @@ SDNodeInfo::SDNodeInfo(Record *R) : Def(R) {
|
|||||||
} else if (PropList[i]->getName() == "SDNPVariadic") {
|
} else if (PropList[i]->getName() == "SDNPVariadic") {
|
||||||
Properties |= 1 << SDNPVariadic;
|
Properties |= 1 << SDNPVariadic;
|
||||||
} else {
|
} else {
|
||||||
errs() << "Unknown SD Node property '" << PropList[i]->getName()
|
PrintFatalError("Unknown SD Node property '" +
|
||||||
<< "' on node '" << R->getName() << "'!\n";
|
PropList[i]->getName() + "' on node '" +
|
||||||
exit(1);
|
R->getName() + "'!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1223,8 +1223,7 @@ static unsigned GetNumNodeResults(Record *Operator, CodeGenDAGPatterns &CDP) {
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
Operator->dump();
|
Operator->dump();
|
||||||
errs() << "Unhandled node in GetNumNodeResults\n";
|
PrintFatalError("Unhandled node in GetNumNodeResults");
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TreePatternNode::print(raw_ostream &OS) const {
|
void TreePatternNode::print(raw_ostream &OS) const {
|
||||||
@ -2373,10 +2372,9 @@ CodeGenDAGPatterns::CodeGenDAGPatterns(RecordKeeper &R) :
|
|||||||
|
|
||||||
Record *CodeGenDAGPatterns::getSDNodeNamed(const std::string &Name) const {
|
Record *CodeGenDAGPatterns::getSDNodeNamed(const std::string &Name) const {
|
||||||
Record *N = Records.getDef(Name);
|
Record *N = Records.getDef(Name);
|
||||||
if (!N || !N->isSubClassOf("SDNode")) {
|
if (!N || !N->isSubClassOf("SDNode"))
|
||||||
errs() << "Error getting SDNode '" << Name << "'!\n";
|
PrintFatalError("Error getting SDNode '" + Name + "'!");
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
return N;
|
return N;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,9 +411,9 @@ ComplexPattern::ComplexPattern(Record *R) {
|
|||||||
} else if (PropList[i]->getName() == "SDNPWantParent") {
|
} else if (PropList[i]->getName() == "SDNPWantParent") {
|
||||||
Properties |= 1 << SDNPWantParent;
|
Properties |= 1 << SDNPWantParent;
|
||||||
} else {
|
} else {
|
||||||
errs() << "Unsupported SD Node property '" << PropList[i]->getName()
|
PrintFatalError("Unsupported SD Node property '" +
|
||||||
<< "' on ComplexPattern '" << R->getName() << "'!\n";
|
PropList[i]->getName() + "' on ComplexPattern '" +
|
||||||
exit(1);
|
R->getName() + "'!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,8 +268,10 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) {
|
|||||||
// We can't model ComplexPattern uses that don't have their name taken yet.
|
// We can't model ComplexPattern uses that don't have their name taken yet.
|
||||||
// The OPC_CheckComplexPattern operation implicitly records the results.
|
// The OPC_CheckComplexPattern operation implicitly records the results.
|
||||||
if (N->getName().empty()) {
|
if (N->getName().empty()) {
|
||||||
errs() << "We expect complex pattern uses to have names: " << *N << "\n";
|
std::string S;
|
||||||
exit(1);
|
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
|
// Remember this ComplexPattern so that we can emit it after all the other
|
||||||
|
@ -575,10 +575,8 @@ void InstrInfoEmitter::emitEnums(raw_ostream &OS) {
|
|||||||
// We must emit the PHI opcode first...
|
// We must emit the PHI opcode first...
|
||||||
std::string Namespace = Target.getInstNamespace();
|
std::string Namespace = Target.getInstNamespace();
|
||||||
|
|
||||||
if (Namespace.empty()) {
|
if (Namespace.empty())
|
||||||
fprintf(stderr, "No instructions defined!\n");
|
PrintFatalError("No instructions defined!");
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<const CodeGenInstruction*> &NumberedInstructions =
|
const std::vector<const CodeGenInstruction*> &NumberedInstructions =
|
||||||
Target.getInstructionsByEnumValue();
|
Target.getInstructionsByEnumValue();
|
||||||
|
@ -121,10 +121,8 @@ void SubtargetEmitter::Enumeration(raw_ostream &OS,
|
|||||||
unsigned N = DefList.size();
|
unsigned N = DefList.size();
|
||||||
if (N == 0)
|
if (N == 0)
|
||||||
return;
|
return;
|
||||||
if (N > 64) {
|
if (N > 64)
|
||||||
errs() << "Too many (> 64) subtarget features!\n";
|
PrintFatalError("Too many (> 64) subtarget features!");
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
OS << "namespace " << Target << " {\n";
|
OS << "namespace " << Target << " {\n";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user