diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Constant.h | 7 | ||||
-rw-r--r-- | include/llvm/Constants.h | 16 |
2 files changed, 15 insertions, 8 deletions
diff --git a/include/llvm/Constant.h b/include/llvm/Constant.h index 3ce8d2c243..f7d4dd2d32 100644 --- a/include/llvm/Constant.h +++ b/include/llvm/Constant.h @@ -97,6 +97,13 @@ public: /// constant exprs and other cases we can't handle, we return an empty vector. void getVectorElements(SmallVectorImpl<Constant*> &Elts) const; + /// getAggregateElement - For aggregates (struct/array/vector) return the + /// constant that corresponds to the specified element if possible, or null if + /// not. This can return null if the element index is a ConstantExpr, or if + /// 'this' is a constant expr. + Constant *getAggregateElement(unsigned Elt) const; + Constant *getAggregateElement(Constant *Elt) const; + /// destroyConstant - Called if some element of this constant is no longer /// valid. At this point only other constants may be on the use_list for this /// constant. Any constants on our Use list must also be destroy'd. The diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index 1823f1d49e..a685ccc31c 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -316,19 +316,19 @@ public: /// getSequentialElement - If this CAZ has array or vector type, return a zero /// with the right element type. - Constant *getSequentialElement(); + Constant *getSequentialElement() const; /// getStructElement - If this CAZ has struct type, return a zero with the /// right element type for the specified element. - Constant *getStructElement(unsigned Elt); + Constant *getStructElement(unsigned Elt) const; /// getElementValue - Return a zero of the right value for the specified GEP /// index. - Constant *getElementValue(Constant *C); + Constant *getElementValue(Constant *C) const; /// getElementValue - Return a zero of the right value for the specified GEP /// index. - Constant *getElementValue(unsigned Idx); + Constant *getElementValue(unsigned Idx) const; /// Methods for support type inquiry through isa, cast, and dyn_cast: /// @@ -1157,19 +1157,19 @@ public: /// getSequentialElement - If this Undef has array or vector type, return a /// undef with the right element type. - UndefValue *getSequentialElement(); + UndefValue *getSequentialElement() const; /// getStructElement - If this undef has struct type, return a undef with the /// right element type for the specified element. - UndefValue *getStructElement(unsigned Elt); + UndefValue *getStructElement(unsigned Elt) const; /// getElementValue - Return an undef of the right value for the specified GEP /// index. - UndefValue *getElementValue(Constant *C); + UndefValue *getElementValue(Constant *C) const; /// getElementValue - Return an undef of the right value for the specified GEP /// index. - UndefValue *getElementValue(unsigned Idx); + UndefValue *getElementValue(unsigned Idx) const; virtual void destroyConstant(); |