forked from OSchip/llvm-project
[IR] Add classof methods to ConstantExpr subclasses.
I didn't notice these were missing when I wrote 1544019
.
This commit is contained in:
parent
361853c96f
commit
779e4d82de
|
@ -56,6 +56,14 @@ public:
|
|||
}
|
||||
|
||||
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
|
||||
|
||||
static bool classof(const ConstantExpr *CE) {
|
||||
return Instruction::isCast(CE->getOpcode()) ||
|
||||
Instruction::isUnaryOp(CE->getOpcode());
|
||||
}
|
||||
static bool classof(const Value *V) {
|
||||
return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
|
||||
}
|
||||
};
|
||||
|
||||
/// BinaryConstantExpr - This class is private to Constants.cpp, and is used
|
||||
|
@ -77,6 +85,13 @@ public:
|
|||
|
||||
/// Transparently provide more efficient getOperand methods.
|
||||
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
|
||||
|
||||
static bool classof(const ConstantExpr *CE) {
|
||||
return Instruction::isBinaryOp(CE->getOpcode());
|
||||
}
|
||||
static bool classof(const Value *V) {
|
||||
return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
|
||||
}
|
||||
};
|
||||
|
||||
/// SelectConstantExpr - This class is private to Constants.cpp, and is used
|
||||
|
@ -97,6 +112,13 @@ public:
|
|||
|
||||
/// Transparently provide more efficient getOperand methods.
|
||||
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
|
||||
|
||||
static bool classof(const ConstantExpr *CE) {
|
||||
return CE->getOpcode() == Instruction::Select;
|
||||
}
|
||||
static bool classof(const Value *V) {
|
||||
return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
|
||||
}
|
||||
};
|
||||
|
||||
/// ExtractElementConstantExpr - This class is private to
|
||||
|
@ -118,6 +140,13 @@ public:
|
|||
|
||||
/// Transparently provide more efficient getOperand methods.
|
||||
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
|
||||
|
||||
static bool classof(const ConstantExpr *CE) {
|
||||
return CE->getOpcode() == Instruction::ExtractElement;
|
||||
}
|
||||
static bool classof(const Value *V) {
|
||||
return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
|
||||
}
|
||||
};
|
||||
|
||||
/// InsertElementConstantExpr - This class is private to
|
||||
|
@ -140,6 +169,13 @@ public:
|
|||
|
||||
/// Transparently provide more efficient getOperand methods.
|
||||
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
|
||||
|
||||
static bool classof(const ConstantExpr *CE) {
|
||||
return CE->getOpcode() == Instruction::InsertElement;
|
||||
}
|
||||
static bool classof(const Value *V) {
|
||||
return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
|
||||
}
|
||||
};
|
||||
|
||||
/// ShuffleVectorConstantExpr - This class is private to
|
||||
|
@ -168,6 +204,13 @@ public:
|
|||
|
||||
/// Transparently provide more efficient getOperand methods.
|
||||
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
|
||||
|
||||
static bool classof(const ConstantExpr *CE) {
|
||||
return CE->getOpcode() == Instruction::ShuffleVector;
|
||||
}
|
||||
static bool classof(const Value *V) {
|
||||
return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V));
|
||||
}
|
||||
};
|
||||
|
||||
/// ExtractValueConstantExpr - This class is private to
|
||||
|
|
Loading…
Reference in New Issue