aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Constant.h19
-rw-r--r--include/llvm/Constants.h4
2 files changed, 12 insertions, 11 deletions
diff --git a/include/llvm/Constant.h b/include/llvm/Constant.h
index a42c7d4371..bcaa56e390 100644
--- a/include/llvm/Constant.h
+++ b/include/llvm/Constant.h
@@ -48,6 +48,10 @@ protected:
: User(ty, vty, Ops, NumOps) {}
void destroyConstantImpl();
+
+ void setOperand(unsigned i, Value *V) {
+ User::setOperand(i, V);
+ }
public:
/// isNullValue - Return true if this is the value that would be returned by
/// getNullValue.
@@ -83,16 +87,13 @@ public:
/// FIXME: This really should not be in VMCore.
PossibleRelocationsTy getRelocationInfo() const;
- // Specialize get/setOperand for Constants as their operands are always
- // constants as well.
- Constant *getOperand(unsigned i) {
- return static_cast<Constant*>(User::getOperand(i));
- }
- const Constant *getOperand(unsigned i) const {
- return static_cast<const Constant*>(User::getOperand(i));
+ // Specialize get/setOperand for Users as their operands are always
+ // constants or BasicBlocks as well.
+ User *getOperand(unsigned i) {
+ return static_cast<User*>(User::getOperand(i));
}
- void setOperand(unsigned i, Constant *C) {
- User::setOperand(i, C);
+ const User *getOperand(unsigned i) const {
+ return static_cast<const User*>(User::getOperand(i));
}
/// getVectorElements - This method, which is only valid on constant of vector
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index 0b881dc688..99928d9b85 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -564,7 +564,7 @@ public:
static BlockAddress *get(BasicBlock *BB);
/// Transparently provide more efficient getOperand methods.
- DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
+ DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
Function *getFunction() const { return (Function*)Op<0>().get(); }
BasicBlock *getBasicBlock() const { return (BasicBlock*)Op<1>().get(); }
@@ -587,7 +587,7 @@ template <>
struct OperandTraits<BlockAddress> : public FixedNumOperandTraits<2> {
};
-DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(BlockAddress, Constant)
+DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(BlockAddress, Value)
//===----------------------------------------------------------------------===//
/// ConstantExpr - a constant value that is initialized with an expression using