1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

[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.

llvm-svn: 235465
This commit is contained in:
Craig Topper 2015-04-22 02:09:45 +00:00
parent 2de52caf56
commit 7bd237e075
3 changed files with 4 additions and 4 deletions

View 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;
}

View 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);

View 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;
}