[llvm] r235465 - [TableGen] Use 'isa' to identify UnsetInits rather than comparing with the singleton object created by UnsetInit::get(). Makes it more consistent with the other types.
Craig Topper
craig.topper at gmail.com
Tue Apr 21 19:09:45 PDT 2015
Author: ctopper
Date: Tue Apr 21 21:09:45 2015
New Revision: 235465
URL: http://llvm.org/viewvc/llvm-project?rev=235465&view=rev
Log:
[TableGen] Use 'isa' to identify UnsetInits rather than comparing with the singleton object created by UnsetInit::get(). Makes it more consistent with the other types.
Modified:
llvm/trunk/lib/TableGen/Record.cpp
llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
Modified: llvm/trunk/lib/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=235465&r1=235464&r2=235465&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Record.cpp (original)
+++ llvm/trunk/lib/TableGen/Record.cpp Tue Apr 21 21:09:45 2015
@@ -517,7 +517,7 @@ std::string BitsInit::getAsString() cons
// 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(String
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;
}
Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=235465&r1=235464&r2=235465&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Tue Apr 21 21:09:45 2015
@@ -2064,7 +2064,7 @@ TreePatternNode *TreePattern::ParseTreeP
}
// ?:$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);
Modified: llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp?rev=235465&r1=235464&r2=235465&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp Tue Apr 21 21:09:45 2015
@@ -220,7 +220,7 @@ void MatcherGen::EmitLeafMatchCode(const
}
// 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;
}
More information about the llvm-commits
mailing list