summaryrefslogtreecommitdiff
path: root/include/llvm/Constant.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-10-28 05:14:34 +0000
committerChris Lattner <sabre@nondot.org>2009-10-28 05:14:34 +0000
commit0eeb913aa17a68b1f2963b02ca1d68f09dba0b78 (patch)
tree59af809ede34a9dd1b0bd71d65537f2787b08ebe /include/llvm/Constant.h
parent46b3abc9f759ed4bbf88be611cc577b21a8ffa8b (diff)
downloadllvm-0eeb913aa17a68b1f2963b02ca1d68f09dba0b78.tar.gz
llvm-0eeb913aa17a68b1f2963b02ca1d68f09dba0b78.tar.bz2
llvm-0eeb913aa17a68b1f2963b02ca1d68f09dba0b78.tar.xz
Previously, all operands to Constant were themselves constant.
In the new world order, BlockAddress can have a BasicBlock operand. This doesn't permute much, because if you have a ConstantExpr (or anything more specific than Constant) we still know the operand has to be a Constant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85375 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Constant.h')
-rw-r--r--include/llvm/Constant.h19
1 files changed, 10 insertions, 9 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