[TableGen] Replace some calls to ListInit::getSize() with ListInit::empty() if it...
authorCraig Topper <craig.topper@gmail.com>
Thu, 14 May 2015 05:53:53 +0000 (05:53 +0000)
committerCraig Topper <craig.topper@gmail.com>
Thu, 14 May 2015 05:53:53 +0000 (05:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237340 91177308-0d34-0410-b5e6-96231b3b80d8

lib/TableGen/Record.cpp
lib/TableGen/TGParser.cpp
utils/TableGen/CodeGenDAGPatterns.cpp
utils/TableGen/CodeGenMapTable.cpp

index ad9aea204497d72b5962726e730c0869a2b8cf8b..9c8a06f2b5fc6e36c0eb4e78b7a6bf9879749e96 100644 (file)
@@ -778,14 +778,14 @@ Init *UnOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) const {
   }
   case HEAD: {
     if (ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
   }
   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)) {
       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());
       // 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, MultiClass *CurMultiClass) const {
   }
   case EMPTY: {
     if (ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
   }
   case EMPTY: {
     if (ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
-      if (LHSl->getSize() == 0)
+      if (LHSl->empty())
         return IntInit::get(1);
       return IntInit::get(0);
     }
         return IntInit::get(1);
       return IntInit::get(0);
     }
index 56f156dceab1bad815a02f3a0049737d8b812aaf..23ef5354fca46eda6ea1226ffc8156278d1e7a35 100644 (file)
@@ -841,7 +841,7 @@ Init *TGParser::ParseOperation(Record *CurRec, RecTy *ItemType) {
           return nullptr;
         }
 
           return nullptr;
         }
 
-        if (LHSl && LHSl->getSize() == 0) {
+        if (LHSl && LHSl->empty()) {
           TokError("empty list argument in unary operator");
           return nullptr;
         }
           TokError("empty list argument in unary operator");
           return nullptr;
         }
index f03ef61b457a1a54452f62249566408cf5924515..fd02bbdc6b48897629affbe45b1c98adad017422 100644 (file)
@@ -3076,7 +3076,7 @@ void CodeGenDAGPatterns::ParseInstructions() {
     // 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.
     // 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;
 
       std::vector<Record*> Results;
       std::vector<Record*> Operands;
 
@@ -3399,7 +3399,7 @@ void CodeGenDAGPatterns::ParsePatterns() {
     Pattern->InlinePatternFragments();
 
     ListInit *LI = CurPattern->getValueAsListInit("ResultInstrs");
     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);
 
     // Parse the instruction.
     TreePattern Result(CurPattern, LI, false, *this);
index 8abea4808ba2fd7bd7ce095fc99d6faf1d559211..b52a91d0177b5f1c2b8e130c6ba3cbed25953b5c 100644 (file)
@@ -128,7 +128,7 @@ public:
     ListInit *ColValList = MapRec->getValueAsListInit("ValueCols");
 
     // Each instruction map must specify at least one column for it to be valid.
     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!");
 
       PrintFatalError(MapRec->getLoc(), "InstrMapping record `" +
         MapRec->getName() + "' has empty " + "`ValueCols' field!");