From 61131ab15fd593a2e295d79fe2714e7bc21f2ec8 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Thu, 25 Oct 2012 20:33:17 +0000 Subject: 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 --- utils/TableGen/CodeGenMapTable.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'utils/TableGen/CodeGenMapTable.cpp') 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 > 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(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(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); } -- cgit v1.2.3-18-g5258