Home | History | Annotate | Download | only in IR

Lines Matching defs:Constant

1 //===-- llvm/Constant.h - Constant class definition -------------*- C++ -*-===//
10 // This file contains the declaration of the Constant class.
25 /// of all constant values in an LLVM program. A constant is a value that is
32 /// or expression based (computations yielding a constant value composed of
33 /// only certain operators and other constant values).
40 /// @brief LLVM Constant Representation
41 class Constant : public User {
42 void operator=(const Constant &) = delete;
43 Constant(const Constant &) = delete;
47 Constant(Type *ty, ValueTy vty, Use *Ops, unsigned NumOps)
74 /// Return true if evaluation of this constant could trap. This is true for
75 /// things like constant expressions that could divide by zero.
84 /// Return true if the constant has users other than constant expressions and
95 /// For aggregates (struct/array/vector) return the constant that corresponds
97 /// if the element index is a ConstantExpr, or if 'this' is a constant expr.
98 Constant *getAggregateElement(unsigned Elt) const;
99 Constant *getAggregateElement(Constant *Elt) const;
101 /// If this is a splat vector constant, meaning that all of the elements have
103 Constant *getSplatValue() const;
105 /// If C is a constant integer then return its value, otherwise C must be a
106 /// vector of constant integers, all equal, and the common value is returned.
109 /// Called if some element of this constant is no longer valid.
111 /// constant. Any constants on our Use list must also be destroy'd. The
112 /// implementation must be sure to remove the constant from the list of
127 /// a new constant that is equivalent to the current one, with all uses of
129 /// of the users of 'this' are replaced to use the new constant, and then
136 static Constant *getNullValue(Type* Ty);
138 /// @returns the value for an integer or vector of integer constant of the
141 static Constant *getAllOnesValue(Type* Ty);
143 /// Return the value for an integer or pointer constant, or a vector thereof,
145 static Constant *getIntegerValue(Type *Ty, const APInt &V);
147 /// If there are any dead constant users dangling off of this constant, remove
153 Constant *stripPointerCasts() {
154 return cast<Constant>(Value::stripPointerCasts());
157 const Constant *stripPointerCasts() const {
158 return const_cast<Constant*>(this)->stripPointerCasts();