[TableGen] Use 'isa' to identify UnsetInits rather than comparing with the singleton...
authorCraig Topper <craig.topper@gmail.com>
Wed, 22 Apr 2015 02:09:45 +0000 (02:09 +0000)
committerCraig Topper <craig.topper@gmail.com>
Wed, 22 Apr 2015 02:09:45 +0000 (02:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235465 91177308-0d34-0410-b5e6-96231b3b80d8

lib/TableGen/Record.cpp
utils/TableGen/CodeGenDAGPatterns.cpp
utils/TableGen/DAGISelMatcherGen.cpp

index 3374432daa6f619d16dce1483a090b45dd32da1f..29217d74c96f15c9edb40b9fc12eab45d773acaf 100644 (file)
@@ -517,7 +517,7 @@ std::string BitsInit::getAsString() const {
 // bits initializer will resolve into VarBitInit to keep the field name and bit
 // number used in targets with fixed insn length.
 static Init *fixBitInit(const RecordVal *RV, Init *Before, Init *After) {
-  if (RV || After != UnsetInit::get())
+  if (RV || !isa<UnsetInit>(After))
     return After;
   return Before;
 }
@@ -1961,7 +1961,7 @@ bool Record::getValueAsBitOrUnset(StringRef FieldName, bool &Unset) const {
     PrintFatalError(getLoc(), "Record `" + getName() +
       "' does not have a field named `" + FieldName.str() + "'!\n");
 
-  if (R->getValue() == UnsetInit::get()) {
+  if (isa<UnsetInit>(R->getValue())) {
     Unset = true;
     return false;
   }
index 56743f3714a17e1d3f855235d6c9509b61be4267..2552050f678ba54fb465307719d7969ce7495930 100644 (file)
@@ -2064,7 +2064,7 @@ TreePatternNode *TreePattern::ParseTreePattern(Init *TheInit, StringRef OpName){
   }
 
   // ?:$name or just $name.
-  if (TheInit == UnsetInit::get()) {
+  if (isa<UnsetInit>(TheInit)) {
     if (OpName.empty())
       error("'?' argument requires a name to match with operand list");
     TreePatternNode *Res = new TreePatternNode(TheInit, 1);
index eb806192bdc393e7e764e84400e33bbe81728157..afc500351a93376c1ed0ae6ea14f78bc16efb6d4 100644 (file)
@@ -220,7 +220,7 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) {
   }
 
   // An UnsetInit represents a named node without any constraints.
-  if (N->getLeafValue() == UnsetInit::get()) {
+  if (isa<UnsetInit>(N->getLeafValue())) {
     assert(N->hasName() && "Unnamed ? leaf");
     return;
   }