diff options
author | Joerg Sonnenberger <joerg@bec.de> | 2012-10-25 20:33:17 +0000 |
---|---|---|
committer | Joerg Sonnenberger <joerg@bec.de> | 2012-10-25 20:33:17 +0000 |
commit | 61131ab15fd593a2e295d79fe2714e7bc21f2ec8 (patch) | |
tree | 51cf9b41cbca87291d15c6b490cab78bbbbaba38 /utils/TableGen/CodeGenMapTable.cpp | |
parent | e5a7a68dfabcf10cf5a6409fd1e4020f69564c2e (diff) |
Remove exception handling usage from tblgen.
Most places can use PrintFatalError as the unwinding mechanism was not
used for anything other than printing the error. The single exception
was CodeGenDAGPatterns.cpp, where intermediate errors during type
resolution were ignored to simplify incremental platform development.
This use is replaced by an error flag in TreePattern and bailout earlier
in various places if it is set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166712 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeGenMapTable.cpp')
-rw-r--r-- | utils/TableGen/CodeGenMapTable.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/utils/TableGen/CodeGenMapTable.cpp b/utils/TableGen/CodeGenMapTable.cpp index 4bfd1ba798..1653d67da9 100644 --- a/utils/TableGen/CodeGenMapTable.cpp +++ b/utils/TableGen/CodeGenMapTable.cpp @@ -78,6 +78,7 @@ #include "CodeGenTarget.h" #include "llvm/Support/Format.h" +#include "llvm/TableGen/Error.h" using namespace llvm; typedef std::map<std::string, std::vector<Record*> > InstrRelMapTy; @@ -128,20 +129,19 @@ public: // Each instruction map must specify at least one column for it to be valid. if (ColValList->getSize() == 0) - throw "InstrMapping record `" + MapRec->getName() + "' has empty " + - "`ValueCols' field!"; + PrintFatalError(MapRec->getLoc(), "InstrMapping record `" + + MapRec->getName() + "' has empty " + "`ValueCols' field!"); for (unsigned i = 0, e = ColValList->getSize(); i < e; i++) { ListInit *ColI = dyn_cast<ListInit>(ColValList->getElement(i)); // Make sure that all the sub-lists in 'ValueCols' have same number of // elements as the fields in 'ColFields'. - if (ColI->getSize() == ColFields->getSize()) - ValueCols.push_back(ColI); - else { - throw "Record `" + MapRec->getName() + "', field `" + "ValueCols" + - "' entries don't match with the entries in 'ColFields'!"; - } + if (ColI->getSize() != ColFields->getSize()) + PrintFatalError(MapRec->getLoc(), "Record `" + MapRec->getName() + + "', field `ValueCols' entries don't match with " + + " the entries in 'ColFields'!"); + ValueCols.push_back(ColI); } } @@ -344,10 +344,9 @@ Record *MapTableEmitter::getInstrForColumn(Record *KeyInstr, if (MatchFound) { if (MatchInstr) // Already had a match // Error if multiple matches are found for a column. - throw "Multiple matches found for `" + KeyInstr->getName() + - "', for the relation `" + InstrMapDesc.getName(); - else - MatchInstr = CurInstr; + PrintFatalError("Multiple matches found for `" + KeyInstr->getName() + + "', for the relation `" + InstrMapDesc.getName()); + MatchInstr = CurInstr; } } return MatchInstr; @@ -516,10 +515,9 @@ static void emitEnums(raw_ostream &OS, RecordKeeper &Records) { for (unsigned j = 0; j < ListSize; j++) { ListInit *ListJ = dyn_cast<ListInit>(List->getElement(j)); - if (ListJ->getSize() != ColFields->getSize()) { - throw "Record `" + CurMap->getName() + "', field `" + "ValueCols" + - "' entries don't match with the entries in 'ColFields' !"; - } + if (ListJ->getSize() != ColFields->getSize()) + PrintFatalError("Record `" + CurMap->getName() + "', field " + "`ValueCols' entries don't match with the entries in 'ColFields' !"); ValueCols.push_back(ListJ); } |