[llvm] r237340 - [TableGen] Replace some calls to ListInit::getSize() with ListInit::empty() if it was just comparing to 0. NFC.
Craig Topper
craig.topper at gmail.com
Wed May 13 22:53:53 PDT 2015
Author: ctopper
Date: Thu May 14 00:53:53 2015
New Revision: 237340
URL: http://llvm.org/viewvc/llvm-project?rev=237340&view=rev
Log:
[TableGen] Replace some calls to ListInit::getSize() with ListInit::empty() if it was just comparing to 0. NFC.
Modified:
llvm/trunk/lib/TableGen/Record.cpp
llvm/trunk/lib/TableGen/TGParser.cpp
llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
llvm/trunk/utils/TableGen/CodeGenMapTable.cpp
Modified: llvm/trunk/lib/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=237340&r1=237339&r2=237340&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Record.cpp (original)
+++ llvm/trunk/lib/TableGen/Record.cpp Thu May 14 00:53:53 2015
@@ -778,14 +778,14 @@ Init *UnOpInit::Fold(Record *CurRec, Mul
}
case HEAD: {
if (ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
- assert(LHSl->getSize() != 0 && "Empty list in car");
+ assert(!LHSl->empty() && "Empty list in car");
return LHSl->getElement(0);
}
break;
}
case TAIL: {
if (ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
- assert(LHSl->getSize() != 0 && "Empty list in cdr");
+ assert(!LHSl->empty() && "Empty list in cdr");
// Note the +1. We can't just pass the result of getValues()
// directly.
return ListInit::get(LHSl->getValues().slice(1), LHSl->getType());
@@ -794,7 +794,7 @@ Init *UnOpInit::Fold(Record *CurRec, Mul
}
case EMPTY: {
if (ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
- if (LHSl->getSize() == 0)
+ if (LHSl->empty())
return IntInit::get(1);
return IntInit::get(0);
}
Modified: llvm/trunk/lib/TableGen/TGParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGParser.cpp?rev=237340&r1=237339&r2=237340&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/TGParser.cpp (original)
+++ llvm/trunk/lib/TableGen/TGParser.cpp Thu May 14 00:53:53 2015
@@ -841,7 +841,7 @@ Init *TGParser::ParseOperation(Record *C
return nullptr;
}
- if (LHSl && LHSl->getSize() == 0) {
+ if (LHSl && LHSl->empty()) {
TokError("empty list argument in unary operator");
return nullptr;
}
Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=237340&r1=237339&r2=237340&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Thu May 14 00:53:53 2015
@@ -3076,7 +3076,7 @@ void CodeGenDAGPatterns::ParseInstructio
// null_frag operator is as-if no pattern were specified. Normally this
// is from a multiclass expansion w/ a SDPatternOperator passed in as
// null_frag.
- if (!LI || LI->getSize() == 0 || hasNullFragReference(LI)) {
+ if (!LI || LI->empty() || hasNullFragReference(LI)) {
std::vector<Record*> Results;
std::vector<Record*> Operands;
@@ -3399,7 +3399,7 @@ void CodeGenDAGPatterns::ParsePatterns()
Pattern->InlinePatternFragments();
ListInit *LI = CurPattern->getValueAsListInit("ResultInstrs");
- if (LI->getSize() == 0) continue; // no pattern.
+ if (LI->empty()) continue; // no pattern.
// Parse the instruction.
TreePattern Result(CurPattern, LI, false, *this);
Modified: llvm/trunk/utils/TableGen/CodeGenMapTable.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenMapTable.cpp?rev=237340&r1=237339&r2=237340&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenMapTable.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenMapTable.cpp Thu May 14 00:53:53 2015
@@ -128,7 +128,7 @@ public:
ListInit *ColValList = MapRec->getValueAsListInit("ValueCols");
// Each instruction map must specify at least one column for it to be valid.
- if (ColValList->getSize() == 0)
+ if (ColValList->empty())
PrintFatalError(MapRec->getLoc(), "InstrMapping record `" +
MapRec->getName() + "' has empty " + "`ValueCols' field!");
More information about the llvm-commits
mailing list