1 //===-- llvm/Constants.h - Constant class subclass definitions --*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 /// @file This file contains the declarations for the subclasses of Constant,
11 /// which represent the different flavors of constant values that live in LLVM.
12 /// Note that Constants are immutable (once created they never change) and are
13 /// fully shared by structural equivalence. This means that two structurally
14 /// equivalent constants will always have the same address. Constant's are
15 /// created on demand as needed and never deleted: thus clients don't have to
16 /// worry about the lifetime of the objects.
18 //===----------------------------------------------------------------------===//
20 #ifndef LLVM_CONSTANTS_H
21 #define LLVM_CONSTANTS_H
23 #include "llvm/Constant.h"
24 #include "llvm/Type.h"
33 template<class ConstantClass, class TypeClass, class ValType>
34 struct ConstantCreator;
35 template<class ConstantClass, class TypeClass>
36 struct ConvertConstantType;
38 //===----------------------------------------------------------------------===//
39 /// This is the shared class of boolean and integrer constants. This class
40 /// represents both boolean and integral constants.
41 /// @brief Class for constant integers.
42 class ConstantInt : public Constant {
46 ConstantInt(const ConstantInt &); // DO NOT IMPLEMENT
47 ConstantInt(const Type *Ty, uint64_t V);
48 ConstantInt(const Type *Ty, int64_t V);
50 friend struct ConstantCreator<ConstantInt, Type, uint64_t>;
52 /// Return the constant as a 64-bit unsigned integer value after it
53 /// has been zero extended as appropriate for the type of this constant.
54 /// @brief Return the zero extended value.
55 inline uint64_t getZExtValue() const {
59 /// Return the constant as a 64-bit integer value after it has been sign
60 /// sign extended as appropriate for the type of this constant.
61 /// @brief Return the sign extended value.
62 inline int64_t getSExtValue() const {
63 unsigned Size = getType()->getPrimitiveSizeInBits();
64 return (int64_t(Val) << (64-Size)) >> (64-Size);
66 /// A helper method that can be used to determine if the constant contained
67 /// within is equal to a constant. This only works for very small values,
68 /// because this is all that can be represented with all types.
69 /// @brief Determine if this constant's value is same as an unsigned char.
70 bool equalsInt(unsigned char V) const {
72 "equalsInt: Can only be used with very small positive constants!");
76 /// getTrue/getFalse - Return the singleton true/false values.
77 static inline ConstantInt *getTrue() {
78 static ConstantInt *T = 0;
80 return T = new ConstantInt(true);
82 static inline ConstantInt *getFalse() {
83 static ConstantInt *F = 0;
85 return F = new ConstantInt(false);
88 /// @brief Static factory method for getting a ConstantInt instance which
89 /// stands for a bool value.
90 static ConstantInt *get(bool Value) { return Value ? getTrue() : getFalse();}
92 /// Return a ConstantInt with the specified value for the specified type. The
93 /// value V will be canonicalized to a uint64_t but accessing it with either
94 /// getSExtValue() or getZExtValue() (ConstantInt) will yield the correct
95 /// sized/signed value for the type Ty.
96 /// @brief Get a ConstantInt for a specific value.
97 static ConstantInt *get(const Type *Ty, int64_t V);
99 /// Returns the opposite value of this ConstantInt.
100 /// @brief Get inverse value.
101 inline ConstantInt *inverted() const {
102 static ConstantInt *CI = 0;
104 return CI = new ConstantInt(getType(),
105 Val ^ (getType() == Type::Int1Ty ? 1 : -1));
108 /// @returns the value of this ConstantInt only if it's a boolean type.
109 /// @brief return the boolean value of this constant.
110 inline bool getBoolValue() const {
111 assert(getType() == Type::Int1Ty && "Should be a boolean constant!");
112 return static_cast<bool>(getZExtValue());
115 /// This static method returns true if the type Ty is big enough to
116 /// represent the value V. This can be used to avoid having the get method
117 /// assert when V is larger than Ty can represent. Note that there are two
118 /// versions of this method, one for unsigned and one for signed integers.
119 /// Although ConstantInt canonicalizes everything to an unsigned integer,
120 /// the signed version avoids callers having to convert a signed quantity
121 /// to the appropriate unsigned type before calling the method.
122 /// @returns true if V is a valid value for type Ty
123 /// @brief Determine if the value is in range for the given type.
124 static bool isValueValidForType(const Type *Ty, uint64_t V);
125 static bool isValueValidForType(const Type *Ty, int64_t V);
127 /// This function will return true iff this constant represents the "null"
128 /// value that would be returned by the getNullValue method.
129 /// @returns true if this is the null integer value.
130 /// @brief Determine if the value is null.
131 virtual bool isNullValue() const {
135 /// This function will return true iff every bit in this constant is set
137 /// @returns true iff this constant's bits are all set to true.
138 /// @brief Determine if the value is all ones.
139 virtual bool isAllOnesValue() const {
140 if (getType() == Type::Int1Ty) return getBoolValue() == true;
141 return getSExtValue() == -1;
144 /// This function will return true iff this constant represents the largest
145 /// value that may be represented by the constant's type.
146 /// @returns true iff this is the largest value that may be represented
148 /// @brief Determine if the value is maximal.
149 virtual bool isMaxValue(bool isSigned) const {
150 if (getType() == Type::Int1Ty) return getBoolValue() == true;
152 int64_t V = getSExtValue();
153 if (V < 0) return false; // Be careful about wrap-around on 'long's
155 return !isValueValidForType(getType(), V) || V < 0;
157 return isAllOnesValue();
160 /// This function will return true iff this constant represents the smallest
161 /// value that may be represented by this constant's type.
162 /// @returns true if this is the smallest value that may be represented by
164 /// @brief Determine if the value is minimal.
165 virtual bool isMinValue(bool isSigned) const {
166 if (getType() == Type::Int1Ty) return getBoolValue() == false;
168 int64_t V = getSExtValue();
169 if (V > 0) return false; // Be careful about wrap-around on 'long's
171 return !isValueValidForType(getType(), V) || V > 0;
173 return getZExtValue() == 0;
176 /// @returns the value for an integer constant of the given type that has all
177 /// its bits set to true.
178 /// @brief Get the all ones value
179 static ConstantInt *getAllOnesValue(const Type *Ty);
181 /// @brief Methods to support type inquiry through isa, cast, and dyn_cast.
182 static inline bool classof(const ConstantInt *) { return true; }
183 static bool classof(const Value *V) {
184 return V->getValueType() == ConstantIntVal;
189 //===----------------------------------------------------------------------===//
190 /// ConstantFP - Floating Point Values [float, double]
192 class ConstantFP : public Constant {
194 friend struct ConstantCreator<ConstantFP, Type, uint64_t>;
195 friend struct ConstantCreator<ConstantFP, Type, uint32_t>;
196 ConstantFP(const ConstantFP &); // DO NOT IMPLEMENT
198 ConstantFP(const Type *Ty, double V);
200 /// get() - Static factory methods - Return objects of the specified value
201 static ConstantFP *get(const Type *Ty, double V);
203 /// isValueValidForType - return true if Ty is big enough to represent V.
204 static bool isValueValidForType(const Type *Ty, double V);
205 inline double getValue() const { return Val; }
207 /// isNullValue - Return true if this is the value that would be returned by
208 /// getNullValue. Don't depend on == for doubles to tell us it's zero, it
209 /// considers -0.0 to be null as well as 0.0. :(
210 virtual bool isNullValue() const;
212 /// isExactlyValue - We don't rely on operator== working on double values, as
213 /// it returns true for things that are clearly not equal, like -0.0 and 0.0.
214 /// As such, this method can be used to do an exact bit-for-bit comparison of
215 /// two floating point values.
216 bool isExactlyValue(double V) const;
218 /// Methods for support type inquiry through isa, cast, and dyn_cast:
219 static inline bool classof(const ConstantFP *) { return true; }
220 static bool classof(const Value *V) {
221 return V->getValueType() == ConstantFPVal;
225 //===----------------------------------------------------------------------===//
226 /// ConstantAggregateZero - All zero aggregate value
228 class ConstantAggregateZero : public Constant {
229 friend struct ConstantCreator<ConstantAggregateZero, Type, char>;
230 ConstantAggregateZero(const ConstantAggregateZero &); // DO NOT IMPLEMENT
232 ConstantAggregateZero(const Type *Ty)
233 : Constant(Ty, ConstantAggregateZeroVal, 0, 0) {}
235 /// get() - static factory method for creating a null aggregate. It is
236 /// illegal to call this method with a non-aggregate type.
237 static Constant *get(const Type *Ty);
239 /// isNullValue - Return true if this is the value that would be returned by
241 virtual bool isNullValue() const { return true; }
243 virtual void destroyConstant();
245 /// Methods for support type inquiry through isa, cast, and dyn_cast:
247 static bool classof(const ConstantAggregateZero *) { return true; }
248 static bool classof(const Value *V) {
249 return V->getValueType() == ConstantAggregateZeroVal;
254 //===----------------------------------------------------------------------===//
255 /// ConstantArray - Constant Array Declarations
257 class ConstantArray : public Constant {
258 friend struct ConstantCreator<ConstantArray, ArrayType,
259 std::vector<Constant*> >;
260 ConstantArray(const ConstantArray &); // DO NOT IMPLEMENT
262 ConstantArray(const ArrayType *T, const std::vector<Constant*> &Val);
265 /// get() - Static factory methods - Return objects of the specified value
266 static Constant *get(const ArrayType *T, const std::vector<Constant*> &);
268 /// This method constructs a ConstantArray and initializes it with a text
269 /// string. The default behavior (AddNull==true) causes a null terminator to
270 /// be placed at the end of the array. This effectively increases the length
271 /// of the array by one (you've been warned). However, in some situations
272 /// this is not desired so if AddNull==false then the string is copied without
273 /// null termination.
274 static Constant *get(const std::string &Initializer, bool AddNull = true);
276 /// getType - Specialize the getType() method to always return an ArrayType,
277 /// which reduces the amount of casting needed in parts of the compiler.
279 inline const ArrayType *getType() const {
280 return reinterpret_cast<const ArrayType*>(Value::getType());
283 /// isString - This method returns true if the array is an array of sbyte or
284 /// ubyte, and if the elements of the array are all ConstantInt's.
285 bool isString() const;
287 /// isCString - This method returns true if the array is a string (see
288 /// isString) and it ends in a null byte \0 and does not contains any other
289 /// null bytes except its terminator.
290 bool isCString() const;
292 /// getAsString - If this array is isString(), then this method converts the
293 /// array to an std::string and returns it. Otherwise, it asserts out.
295 std::string getAsString() const;
297 /// isNullValue - Return true if this is the value that would be returned by
298 /// getNullValue. This always returns false because zero arrays are always
299 /// created as ConstantAggregateZero objects.
300 virtual bool isNullValue() const { return false; }
302 virtual void destroyConstant();
303 virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U);
305 /// Methods for support type inquiry through isa, cast, and dyn_cast:
306 static inline bool classof(const ConstantArray *) { return true; }
307 static bool classof(const Value *V) {
308 return V->getValueType() == ConstantArrayVal;
313 //===----------------------------------------------------------------------===//
314 // ConstantStruct - Constant Struct Declarations
316 class ConstantStruct : public Constant {
317 friend struct ConstantCreator<ConstantStruct, StructType,
318 std::vector<Constant*> >;
319 ConstantStruct(const ConstantStruct &); // DO NOT IMPLEMENT
321 ConstantStruct(const StructType *T, const std::vector<Constant*> &Val);
324 /// get() - Static factory methods - Return objects of the specified value
326 static Constant *get(const StructType *T, const std::vector<Constant*> &V);
327 static Constant *get(const std::vector<Constant*> &V, bool packed = false);
329 /// getType() specialization - Reduce amount of casting...
331 inline const StructType *getType() const {
332 return reinterpret_cast<const StructType*>(Value::getType());
335 /// isNullValue - Return true if this is the value that would be returned by
336 /// getNullValue. This always returns false because zero structs are always
337 /// created as ConstantAggregateZero objects.
338 virtual bool isNullValue() const {
342 virtual void destroyConstant();
343 virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U);
345 /// Methods for support type inquiry through isa, cast, and dyn_cast:
346 static inline bool classof(const ConstantStruct *) { return true; }
347 static bool classof(const Value *V) {
348 return V->getValueType() == ConstantStructVal;
352 //===----------------------------------------------------------------------===//
353 /// ConstantPacked - Constant Packed Declarations
355 class ConstantPacked : public Constant {
356 friend struct ConstantCreator<ConstantPacked, PackedType,
357 std::vector<Constant*> >;
358 ConstantPacked(const ConstantPacked &); // DO NOT IMPLEMENT
360 ConstantPacked(const PackedType *T, const std::vector<Constant*> &Val);
363 /// get() - Static factory methods - Return objects of the specified value
364 static Constant *get(const PackedType *T, const std::vector<Constant*> &);
365 static Constant *get(const std::vector<Constant*> &V);
367 /// getType - Specialize the getType() method to always return an PackedType,
368 /// which reduces the amount of casting needed in parts of the compiler.
370 inline const PackedType *getType() const {
371 return reinterpret_cast<const PackedType*>(Value::getType());
374 /// @returns the value for an packed integer constant of the given type that
375 /// has all its bits set to true.
376 /// @brief Get the all ones value
377 static ConstantPacked *getAllOnesValue(const PackedType *Ty);
379 /// isNullValue - Return true if this is the value that would be returned by
380 /// getNullValue. This always returns false because zero arrays are always
381 /// created as ConstantAggregateZero objects.
382 virtual bool isNullValue() const { return false; }
384 virtual void destroyConstant();
385 virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U);
387 /// Methods for support type inquiry through isa, cast, and dyn_cast:
388 static inline bool classof(const ConstantPacked *) { return true; }
389 static bool classof(const Value *V) {
390 return V->getValueType() == ConstantPackedVal;
394 //===----------------------------------------------------------------------===//
395 /// ConstantPointerNull - a constant pointer value that points to null
397 class ConstantPointerNull : public Constant {
398 friend struct ConstantCreator<ConstantPointerNull, PointerType, char>;
399 ConstantPointerNull(const ConstantPointerNull &); // DO NOT IMPLEMENT
401 ConstantPointerNull(const PointerType *T)
402 : Constant(reinterpret_cast<const Type*>(T),
403 Value::ConstantPointerNullVal, 0, 0) {}
407 /// get() - Static factory methods - Return objects of the specified value
408 static ConstantPointerNull *get(const PointerType *T);
410 /// isNullValue - Return true if this is the value that would be returned by
412 virtual bool isNullValue() const { return true; }
414 virtual void destroyConstant();
416 /// getType - Specialize the getType() method to always return an PointerType,
417 /// which reduces the amount of casting needed in parts of the compiler.
419 inline const PointerType *getType() const {
420 return reinterpret_cast<const PointerType*>(Value::getType());
423 /// Methods for support type inquiry through isa, cast, and dyn_cast:
424 static inline bool classof(const ConstantPointerNull *) { return true; }
425 static bool classof(const Value *V) {
426 return V->getValueType() == ConstantPointerNullVal;
431 /// ConstantExpr - a constant value that is initialized with an expression using
432 /// other constant values.
434 /// This class uses the standard Instruction opcodes to define the various
435 /// constant expressions. The Opcode field for the ConstantExpr class is
436 /// maintained in the Value::SubclassData field.
437 class ConstantExpr : public Constant {
438 friend struct ConstantCreator<ConstantExpr,Type,
439 std::pair<unsigned, std::vector<Constant*> > >;
440 friend struct ConvertConstantType<ConstantExpr, Type>;
443 ConstantExpr(const Type *Ty, unsigned Opcode, Use *Ops, unsigned NumOps)
444 : Constant(Ty, ConstantExprVal, Ops, NumOps) {
445 // Operation type (an Instruction opcode) is stored as the SubclassData.
446 SubclassData = Opcode;
449 // These private methods are used by the type resolution code to create
450 // ConstantExprs in intermediate forms.
451 static Constant *getTy(const Type *Ty, unsigned Opcode,
452 Constant *C1, Constant *C2);
453 static Constant *getCompareTy(unsigned short pred, Constant *C1,
455 static Constant *getShiftTy(const Type *Ty,
456 unsigned Opcode, Constant *C1, Constant *C2);
457 static Constant *getSelectTy(const Type *Ty,
458 Constant *C1, Constant *C2, Constant *C3);
459 static Constant *getGetElementPtrTy(const Type *Ty, Constant *C,
460 const std::vector<Value*> &IdxList);
461 static Constant *getExtractElementTy(const Type *Ty, Constant *Val,
463 static Constant *getInsertElementTy(const Type *Ty, Constant *Val,
464 Constant *Elt, Constant *Idx);
465 static Constant *getShuffleVectorTy(const Type *Ty, Constant *V1,
466 Constant *V2, Constant *Mask);
469 // Static methods to construct a ConstantExpr of different kinds. Note that
470 // these methods may return a object that is not an instance of the
471 // ConstantExpr class, because they will attempt to fold the constant
472 // expression into something simpler if possible.
474 /// Cast constant expr
476 static Constant *getTrunc (Constant *C, const Type *Ty);
477 static Constant *getSExt (Constant *C, const Type *Ty);
478 static Constant *getZExt (Constant *C, const Type *Ty);
479 static Constant *getFPTrunc (Constant *C, const Type *Ty);
480 static Constant *getFPExtend(Constant *C, const Type *Ty);
481 static Constant *getUIToFP (Constant *C, const Type *Ty);
482 static Constant *getSIToFP (Constant *C, const Type *Ty);
483 static Constant *getFPToUI (Constant *C, const Type *Ty);
484 static Constant *getFPToSI (Constant *C, const Type *Ty);
485 static Constant *getPtrToInt(Constant *C, const Type *Ty);
486 static Constant *getIntToPtr(Constant *C, const Type *Ty);
487 static Constant *getBitCast (Constant *C, const Type *Ty);
489 // @brief Convenience function for getting one of the casting operations
490 // using a CastOps opcode.
491 static Constant *getCast(
492 unsigned ops, ///< The opcode for the conversion
493 Constant *C, ///< The constant to be converted
494 const Type *Ty ///< The type to which the constant is converted
497 // @brief Create a ZExt or BitCast cast constant expression
498 static Constant *getZExtOrBitCast(
499 Constant *C, ///< The constant to zext or bitcast
500 const Type *Ty ///< The type to zext or bitcast C to
503 // @brief Create a SExt or BitCast cast constant expression
504 static Constant *getSExtOrBitCast(
505 Constant *C, ///< The constant to sext or bitcast
506 const Type *Ty ///< The type to sext or bitcast C to
509 // @brief Create a Trunc or BitCast cast constant expression
510 static Constant *getTruncOrBitCast(
511 Constant *C, ///< The constant to trunc or bitcast
512 const Type *Ty ///< The type to trunc or bitcast C to
515 /// @brief Create a BitCast or a PtrToInt cast constant expression
516 static Constant *getPointerCast(
517 Constant *C, ///< The pointer value to be casted (operand 0)
518 const Type *Ty ///< The type to which cast should be made
521 /// @brief Create a ZExt, Bitcast or Trunc for integer -> integer casts
522 static Constant *getIntegerCast(
523 Constant *C, ///< The integer constant to be casted
524 const Type *Ty, ///< The integer type to cast to
525 bool isSigned ///< Whether C should be treated as signed or not
528 /// @brief Create a FPExt, Bitcast or FPTrunc for fp -> fp casts
529 static Constant *getFPCast(
530 Constant *C, ///< The integer constant to be casted
531 const Type *Ty ///< The integer type to cast to
534 /// @brief Return true if this is a convert constant expression
537 /// @brief Return true if this is a compare constant expression
538 bool isCompare() const;
540 /// Select constant expr
542 static Constant *getSelect(Constant *C, Constant *V1, Constant *V2) {
543 return getSelectTy(V1->getType(), C, V1, V2);
546 /// getSizeOf constant expr - computes the size of a type in a target
547 /// independent way (Note: the return type is a ULong).
549 static Constant *getSizeOf(const Type *Ty);
551 /// getPtrPtrFromArrayPtr constant expr - given a pointer to a constant array,
552 /// return a pointer to a pointer of the array element type.
553 static Constant *getPtrPtrFromArrayPtr(Constant *C);
555 /// ConstantExpr::get - Return a binary or shift operator constant expression,
556 /// folding if possible.
558 static Constant *get(unsigned Opcode, Constant *C1, Constant *C2);
560 /// @brief Return an ICmp or FCmp comparison operator constant expression.
561 static Constant *getCompare(unsigned short pred, Constant *C1, Constant *C2);
563 /// ConstantExpr::get* - Return some common constants without having to
564 /// specify the full Instruction::OPCODE identifier.
566 static Constant *getNeg(Constant *C);
567 static Constant *getNot(Constant *C);
568 static Constant *getAdd(Constant *C1, Constant *C2);
569 static Constant *getSub(Constant *C1, Constant *C2);
570 static Constant *getMul(Constant *C1, Constant *C2);
571 static Constant *getUDiv(Constant *C1, Constant *C2);
572 static Constant *getSDiv(Constant *C1, Constant *C2);
573 static Constant *getFDiv(Constant *C1, Constant *C2);
574 static Constant *getURem(Constant *C1, Constant *C2); // unsigned rem
575 static Constant *getSRem(Constant *C1, Constant *C2); // signed rem
576 static Constant *getFRem(Constant *C1, Constant *C2);
577 static Constant *getAnd(Constant *C1, Constant *C2);
578 static Constant *getOr(Constant *C1, Constant *C2);
579 static Constant *getXor(Constant *C1, Constant *C2);
580 static Constant* getICmp(unsigned short pred, Constant* LHS, Constant* RHS);
581 static Constant* getFCmp(unsigned short pred, Constant* LHS, Constant* RHS);
582 static Constant *getShl(Constant *C1, Constant *C2);
583 static Constant *getLShr(Constant *C1, Constant *C2);
584 static Constant *getAShr(Constant *C1, Constant *C2);
586 /// Getelementptr form. std::vector<Value*> is only accepted for convenience:
587 /// all elements must be Constant's.
589 static Constant *getGetElementPtr(Constant *C,
590 const std::vector<Constant*> &IdxList);
591 static Constant *getGetElementPtr(Constant *C,
592 const std::vector<Value*> &IdxList);
594 static Constant *getExtractElement(Constant *Vec, Constant *Idx);
595 static Constant *getInsertElement(Constant *Vec, Constant *Elt,Constant *Idx);
596 static Constant *getShuffleVector(Constant *V1, Constant *V2, Constant *Mask);
598 /// isNullValue - Return true if this is the value that would be returned by
600 virtual bool isNullValue() const { return false; }
602 /// getOpcode - Return the opcode at the root of this constant expression
603 unsigned getOpcode() const { return SubclassData; }
605 /// getPredicate - Return the ICMP or FCMP predicate value. Assert if this is
606 /// not an ICMP or FCMP constant expression.
607 unsigned getPredicate() const;
609 /// getOpcodeName - Return a string representation for an opcode.
610 const char *getOpcodeName() const;
612 /// getWithOperandReplaced - Return a constant expression identical to this
613 /// one, but with the specified operand set to the specified value.
614 Constant *getWithOperandReplaced(unsigned OpNo, Constant *Op) const;
616 /// getWithOperands - This returns the current constant expression with the
617 /// operands replaced with the specified values. The specified operands must
618 /// match count and type with the existing ones.
619 Constant *getWithOperands(const std::vector<Constant*> &Ops) const;
621 virtual void destroyConstant();
622 virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U);
624 /// Override methods to provide more type information...
625 inline Constant *getOperand(unsigned i) {
626 return cast<Constant>(User::getOperand(i));
628 inline Constant *getOperand(unsigned i) const {
629 return const_cast<Constant*>(cast<Constant>(User::getOperand(i)));
633 /// Methods for support type inquiry through isa, cast, and dyn_cast:
634 static inline bool classof(const ConstantExpr *) { return true; }
635 static inline bool classof(const Value *V) {
636 return V->getValueType() == ConstantExprVal;
641 //===----------------------------------------------------------------------===//
642 /// UndefValue - 'undef' values are things that do not have specified contents.
643 /// These are used for a variety of purposes, including global variable
644 /// initializers and operands to instructions. 'undef' values can occur with
647 class UndefValue : public Constant {
648 friend struct ConstantCreator<UndefValue, Type, char>;
649 UndefValue(const UndefValue &); // DO NOT IMPLEMENT
651 UndefValue(const Type *T) : Constant(T, UndefValueVal, 0, 0) {}
653 /// get() - Static factory methods - Return an 'undef' object of the specified
656 static UndefValue *get(const Type *T);
658 /// isNullValue - Return true if this is the value that would be returned by
660 virtual bool isNullValue() const { return false; }
662 virtual void destroyConstant();
664 /// Methods for support type inquiry through isa, cast, and dyn_cast:
665 static inline bool classof(const UndefValue *) { return true; }
666 static bool classof(const Value *V) {
667 return V->getValueType() == UndefValueVal;
671 } // End llvm namespace