Remove trailing spaces.

llvm-svn: 168208
This commit is contained in:
Jakub Staszak 2012-11-16 22:07:00 +00:00
parent 8f56f88661
commit 2b7259788f
1 changed files with 70 additions and 70 deletions

View File

@ -8,9 +8,9 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
/// @file /// @file
/// This file contains the declarations for the subclasses of Constant, /// This file contains the declarations for the subclasses of Constant,
/// which represent the different flavors of constant values that live in LLVM. /// which represent the different flavors of constant values that live in LLVM.
/// Note that Constants are immutable (once created they never change) and are /// Note that Constants are immutable (once created they never change) and are
/// fully shared by structural equivalence. This means that two structurally /// fully shared by structural equivalence. This means that two structurally
/// equivalent constants will always have the same address. Constant's are /// equivalent constants will always have the same address. Constant's are
/// created on demand as needed and never deleted: thus clients don't have to /// created on demand as needed and never deleted: thus clients don't have to
@ -44,7 +44,7 @@ template<class ConstantClass, class TypeClass>
struct ConvertConstantType; struct ConvertConstantType;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
/// This is the shared class of boolean and integer constants. This class /// This is the shared class of boolean and integer constants. This class
/// represents both boolean and integral constants. /// represents both boolean and integral constants.
/// @brief Class for constant integers. /// @brief Class for constant integers.
class ConstantInt : public Constant { class ConstantInt : public Constant {
@ -63,11 +63,11 @@ public:
static ConstantInt *getFalse(LLVMContext &Context); static ConstantInt *getFalse(LLVMContext &Context);
static Constant *getTrue(Type *Ty); static Constant *getTrue(Type *Ty);
static Constant *getFalse(Type *Ty); static Constant *getFalse(Type *Ty);
/// If Ty is a vector type, return a Constant with a splat of the given /// If Ty is a vector type, return a Constant with a splat of the given
/// value. Otherwise return a ConstantInt for the given value. /// value. Otherwise return a ConstantInt for the given value.
static Constant *get(Type *Ty, uint64_t V, bool isSigned = false); static Constant *get(Type *Ty, uint64_t V, bool isSigned = false);
/// Return a ConstantInt with the specified integer value for the specified /// Return a ConstantInt with the specified integer value for the specified
/// type. If the type is wider than 64 bits, the value will be zero-extended /// type. If the type is wider than 64 bits, the value will be zero-extended
/// to fit the type, unless isSigned is true, in which case the value will /// to fit the type, unless isSigned is true, in which case the value will
@ -84,27 +84,27 @@ public:
/// @brief Get a ConstantInt for a specific signed value. /// @brief Get a ConstantInt for a specific signed value.
static ConstantInt *getSigned(IntegerType *Ty, int64_t V); static ConstantInt *getSigned(IntegerType *Ty, int64_t V);
static Constant *getSigned(Type *Ty, int64_t V); static Constant *getSigned(Type *Ty, int64_t V);
/// Return a ConstantInt with the specified value and an implied Type. The /// Return a ConstantInt with the specified value and an implied Type. The
/// type is the integer type that corresponds to the bit width of the value. /// type is the integer type that corresponds to the bit width of the value.
static ConstantInt *get(LLVMContext &Context, const APInt &V); static ConstantInt *get(LLVMContext &Context, const APInt &V);
/// Return a ConstantInt constructed from the string strStart with the given /// Return a ConstantInt constructed from the string strStart with the given
/// radix. /// radix.
static ConstantInt *get(IntegerType *Ty, StringRef Str, static ConstantInt *get(IntegerType *Ty, StringRef Str,
uint8_t radix); uint8_t radix);
/// If Ty is a vector type, return a Constant with a splat of the given /// If Ty is a vector type, return a Constant with a splat of the given
/// value. Otherwise return a ConstantInt for the given value. /// value. Otherwise return a ConstantInt for the given value.
static Constant *get(Type* Ty, const APInt& V); static Constant *get(Type* Ty, const APInt& V);
/// Return the constant as an APInt value reference. This allows clients to /// Return the constant as an APInt value reference. This allows clients to
/// obtain a copy of the value, with all its precision in tact. /// obtain a copy of the value, with all its precision in tact.
/// @brief Return the constant's value. /// @brief Return the constant's value.
inline const APInt &getValue() const { inline const APInt &getValue() const {
return Val; return Val;
} }
/// getBitWidth - Return the bitwidth of this constant. /// getBitWidth - Return the bitwidth of this constant.
unsigned getBitWidth() const { return Val.getBitWidth(); } unsigned getBitWidth() const { return Val.getBitWidth(); }
@ -126,8 +126,8 @@ public:
return Val.getSExtValue(); return Val.getSExtValue();
} }
/// A helper method that can be used to determine if the constant contained /// A helper method that can be used to determine if the constant contained
/// within is equal to a constant. This only works for very small values, /// within is equal to a constant. This only works for very small values,
/// because this is all that can be represented with all types. /// because this is all that can be represented with all types.
/// @brief Determine if this constant's value is same as an unsigned char. /// @brief Determine if this constant's value is same as an unsigned char.
bool equalsInt(uint64_t V) const { bool equalsInt(uint64_t V) const {
@ -141,11 +141,11 @@ public:
return reinterpret_cast<IntegerType*>(Value::getType()); return reinterpret_cast<IntegerType*>(Value::getType());
} }
/// This static method returns true if the type Ty is big enough to /// This static method returns true if the type Ty is big enough to
/// represent the value V. This can be used to avoid having the get method /// represent the value V. This can be used to avoid having the get method
/// assert when V is larger than Ty can represent. Note that there are two /// assert when V is larger than Ty can represent. Note that there are two
/// versions of this method, one for unsigned and one for signed integers. /// versions of this method, one for unsigned and one for signed integers.
/// Although ConstantInt canonicalizes everything to an unsigned integer, /// Although ConstantInt canonicalizes everything to an unsigned integer,
/// the signed version avoids callers having to convert a signed quantity /// the signed version avoids callers having to convert a signed quantity
/// to the appropriate unsigned type before calling the method. /// to the appropriate unsigned type before calling the method.
/// @returns true if V is a valid value for type Ty /// @returns true if V is a valid value for type Ty
@ -162,7 +162,7 @@ public:
return Val == 0; return Val == 0;
} }
/// This is just a convenience method to make client code smaller for a /// This is just a convenience method to make client code smaller for a
/// common case. It also correctly performs the comparison without the /// common case. It also correctly performs the comparison without the
/// potential for an assertion from getZExtValue(). /// potential for an assertion from getZExtValue().
/// @brief Determine if the value is one. /// @brief Determine if the value is one.
@ -174,17 +174,17 @@ public:
/// to true. /// to true.
/// @returns true iff this constant's bits are all set to true. /// @returns true iff this constant's bits are all set to true.
/// @brief Determine if the value is all ones. /// @brief Determine if the value is all ones.
bool isMinusOne() const { bool isMinusOne() const {
return Val.isAllOnesValue(); return Val.isAllOnesValue();
} }
/// This function will return true iff this constant represents the largest /// This function will return true iff this constant represents the largest
/// value that may be represented by the constant's type. /// value that may be represented by the constant's type.
/// @returns true iff this is the largest value that may be represented /// @returns true iff this is the largest value that may be represented
/// by this type. /// by this type.
/// @brief Determine if the value is maximal. /// @brief Determine if the value is maximal.
bool isMaxValue(bool isSigned) const { bool isMaxValue(bool isSigned) const {
if (isSigned) if (isSigned)
return Val.isMaxSignedValue(); return Val.isMaxSignedValue();
else else
return Val.isMaxValue(); return Val.isMaxValue();
@ -192,11 +192,11 @@ public:
/// This function will return true iff this constant represents the smallest /// This function will return true iff this constant represents the smallest
/// value that may be represented by this constant's type. /// value that may be represented by this constant's type.
/// @returns true if this is the smallest value that may be represented by /// @returns true if this is the smallest value that may be represented by
/// this type. /// this type.
/// @brief Determine if the value is minimal. /// @brief Determine if the value is minimal.
bool isMinValue(bool isSigned) const { bool isMinValue(bool isSigned) const {
if (isSigned) if (isSigned)
return Val.isMinSignedValue(); return Val.isMinSignedValue();
else else
return Val.isMinValue(); return Val.isMinValue();
@ -248,7 +248,7 @@ public:
/// method returns the negative zero constant for floating point or vector /// method returns the negative zero constant for floating point or vector
/// floating point types; for all other types, it returns the null value. /// floating point types; for all other types, it returns the null value.
static Constant *getZeroValueForNegation(Type *Ty); static Constant *getZeroValueForNegation(Type *Ty);
/// get() - This returns a ConstantFP, or a vector containing a splat of a /// get() - This returns a ConstantFP, or a vector containing a splat of a
/// ConstantFP, for the specified value in the specified type. This should /// ConstantFP, for the specified value in the specified type. This should
/// only be used for simple constant values like 2.0/1.0 etc, that are /// only be used for simple constant values like 2.0/1.0 etc, that are
@ -258,7 +258,7 @@ public:
static ConstantFP *get(LLVMContext &Context, const APFloat &V); static ConstantFP *get(LLVMContext &Context, const APFloat &V);
static ConstantFP *getNegativeZero(Type* Ty); static ConstantFP *getNegativeZero(Type* Ty);
static ConstantFP *getInfinity(Type *Ty, bool Negative = false); static ConstantFP *getInfinity(Type *Ty, bool Negative = false);
/// isValueValidForType - return true if Ty is big enough to represent V. /// isValueValidForType - return true if Ty is big enough to represent V.
static bool isValueValidForType(Type *Ty, const APFloat &V); static bool isValueValidForType(Type *Ty, const APFloat &V);
inline const APFloat &getValueAPF() const { return Val; } inline const APFloat &getValueAPF() const { return Val; }
@ -308,7 +308,7 @@ protected:
} }
public: public:
static ConstantAggregateZero *get(Type *Ty); static ConstantAggregateZero *get(Type *Ty);
virtual void destroyConstant(); virtual void destroyConstant();
/// getSequentialElement - If this CAZ has array or vector type, return a zero /// getSequentialElement - If this CAZ has array or vector type, return a zero
@ -346,7 +346,7 @@ protected:
public: public:
// ConstantArray accessors // ConstantArray accessors
static Constant *get(ArrayType *T, ArrayRef<Constant*> V); static Constant *get(ArrayType *T, ArrayRef<Constant*> V);
/// Transparently provide more efficient getOperand methods. /// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant); DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
@ -392,7 +392,7 @@ public:
static Constant *getAnon(ArrayRef<Constant*> V, bool Packed = false) { static Constant *getAnon(ArrayRef<Constant*> V, bool Packed = false) {
return get(getTypeForElements(V, Packed), V); return get(getTypeForElements(V, Packed), V);
} }
static Constant *getAnon(LLVMContext &Ctx, static Constant *getAnon(LLVMContext &Ctx,
ArrayRef<Constant*> V, bool Packed = false) { ArrayRef<Constant*> V, bool Packed = false) {
return get(getTypeForElements(Ctx, V, Packed), V); return get(getTypeForElements(Ctx, V, Packed), V);
} }
@ -405,7 +405,7 @@ public:
static StructType *getTypeForElements(LLVMContext &Ctx, static StructType *getTypeForElements(LLVMContext &Ctx,
ArrayRef<Constant*> V, ArrayRef<Constant*> V,
bool Packed = false); bool Packed = false);
/// Transparently provide more efficient getOperand methods. /// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant); DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
@ -443,11 +443,11 @@ protected:
public: public:
// ConstantVector accessors // ConstantVector accessors
static Constant *get(ArrayRef<Constant*> V); static Constant *get(ArrayRef<Constant*> V);
/// getSplat - Return a ConstantVector with the specified constant in each /// getSplat - Return a ConstantVector with the specified constant in each
/// element. /// element.
static Constant *getSplat(unsigned NumElts, Constant *Elt); static Constant *getSplat(unsigned NumElts, Constant *Elt);
/// Transparently provide more efficient getOperand methods. /// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant); DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
@ -512,7 +512,7 @@ public:
return V->getValueID() == ConstantPointerNullVal; return V->getValueID() == ConstantPointerNullVal;
} }
}; };
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
/// ConstantDataSequential - A vector or array constant whose element type is a /// ConstantDataSequential - A vector or array constant whose element type is a
/// simple 1/2/4/8-byte integer or float/double, and whose elements are just /// simple 1/2/4/8-byte integer or float/double, and whose elements are just
@ -527,7 +527,7 @@ class ConstantDataSequential : public Constant {
/// DataElements - A pointer to the bytes underlying this constant (which is /// DataElements - A pointer to the bytes underlying this constant (which is
/// owned by the uniquing StringMap). /// owned by the uniquing StringMap).
const char *DataElements; const char *DataElements;
/// Next - This forms a link list of ConstantDataSequential nodes that have /// Next - This forms a link list of ConstantDataSequential nodes that have
/// the same value but different type. For example, 0,0,0,1 could be a 4 /// the same value but different type. For example, 0,0,0,1 could be a 4
/// element array of i8, or a 1-element array of i32. They'll both end up in /// element array of i8, or a 1-element array of i32. They'll both end up in
@ -539,7 +539,7 @@ protected:
explicit ConstantDataSequential(Type *ty, ValueTy VT, const char *Data) explicit ConstantDataSequential(Type *ty, ValueTy VT, const char *Data)
: Constant(ty, VT, 0, 0), DataElements(Data), Next(0) {} : Constant(ty, VT, 0, 0), DataElements(Data), Next(0) {}
~ConstantDataSequential() { delete Next; } ~ConstantDataSequential() { delete Next; }
static Constant *getImpl(StringRef Bytes, Type *Ty); static Constant *getImpl(StringRef Bytes, Type *Ty);
protected: protected:
@ -548,13 +548,13 @@ protected:
return User::operator new(s, 0); return User::operator new(s, 0);
} }
public: public:
/// isElementTypeCompatible - Return true if a ConstantDataSequential can be /// isElementTypeCompatible - Return true if a ConstantDataSequential can be
/// formed with a vector or array of the specified element type. /// formed with a vector or array of the specified element type.
/// ConstantDataArray only works with normal float and int types that are /// ConstantDataArray only works with normal float and int types that are
/// stored densely in memory, not with things like i42 or x86_f80. /// stored densely in memory, not with things like i42 or x86_f80.
static bool isElementTypeCompatible(const Type *Ty); static bool isElementTypeCompatible(const Type *Ty);
/// getElementAsInteger - If this is a sequential container of integers (of /// getElementAsInteger - If this is a sequential container of integers (of
/// any size), return the specified element in the low bits of a uint64_t. /// any size), return the specified element in the low bits of a uint64_t.
uint64_t getElementAsInteger(unsigned i) const; uint64_t getElementAsInteger(unsigned i) const;
@ -566,26 +566,26 @@ public:
/// getElementAsFloat - If this is an sequential container of floats, return /// getElementAsFloat - If this is an sequential container of floats, return
/// the specified element as a float. /// the specified element as a float.
float getElementAsFloat(unsigned i) const; float getElementAsFloat(unsigned i) const;
/// getElementAsDouble - If this is an sequential container of doubles, return /// getElementAsDouble - If this is an sequential container of doubles, return
/// the specified element as a double. /// the specified element as a double.
double getElementAsDouble(unsigned i) const; double getElementAsDouble(unsigned i) const;
/// getElementAsConstant - Return a Constant for a specified index's element. /// getElementAsConstant - Return a Constant for a specified index's element.
/// Note that this has to compute a new constant to return, so it isn't as /// Note that this has to compute a new constant to return, so it isn't as
/// efficient as getElementAsInteger/Float/Double. /// efficient as getElementAsInteger/Float/Double.
Constant *getElementAsConstant(unsigned i) const; Constant *getElementAsConstant(unsigned i) const;
/// getType - Specialize the getType() method to always return a /// getType - Specialize the getType() method to always return a
/// SequentialType, which reduces the amount of casting needed in parts of the /// SequentialType, which reduces the amount of casting needed in parts of the
/// compiler. /// compiler.
inline SequentialType *getType() const { inline SequentialType *getType() const {
return reinterpret_cast<SequentialType*>(Value::getType()); return reinterpret_cast<SequentialType*>(Value::getType());
} }
/// getElementType - Return the element type of the array/vector. /// getElementType - Return the element type of the array/vector.
Type *getElementType() const; Type *getElementType() const;
/// getNumElements - Return the number of elements in the array or vector. /// getNumElements - Return the number of elements in the array or vector.
unsigned getNumElements() const; unsigned getNumElements() const;
@ -594,14 +594,14 @@ public:
/// byte. /// byte.
uint64_t getElementByteSize() const; uint64_t getElementByteSize() const;
/// isString - This method returns true if this is an array of i8. /// isString - This method returns true if this is an array of i8.
bool isString() const; bool isString() const;
/// isCString - This method returns true if the array "isString", ends with a /// isCString - This method returns true if the array "isString", ends with a
/// nul byte, and does not contains any other nul bytes. /// nul byte, and does not contains any other nul bytes.
bool isCString() const; bool isCString() const;
/// getAsString - If this array is isString(), then this method returns the /// getAsString - If this array is isString(), then this method returns the
/// array as a StringRef. Otherwise, it asserts out. /// array as a StringRef. Otherwise, it asserts out.
/// ///
@ -609,7 +609,7 @@ public:
assert(isString() && "Not a string"); assert(isString() && "Not a string");
return getRawDataValues(); return getRawDataValues();
} }
/// getAsCString - If this array is isCString(), then this method returns the /// getAsCString - If this array is isCString(), then this method returns the
/// array (without the trailing null byte) as a StringRef. Otherwise, it /// array (without the trailing null byte) as a StringRef. Otherwise, it
/// asserts out. /// asserts out.
@ -619,14 +619,14 @@ public:
StringRef Str = getAsString(); StringRef Str = getAsString();
return Str.substr(0, Str.size()-1); return Str.substr(0, Str.size()-1);
} }
/// getRawDataValues - Return the raw, underlying, bytes of this data. Note /// getRawDataValues - Return the raw, underlying, bytes of this data. Note
/// that this is an extremely tricky thing to work with, as it exposes the /// that this is an extremely tricky thing to work with, as it exposes the
/// host endianness of the data elements. /// host endianness of the data elements.
StringRef getRawDataValues() const; StringRef getRawDataValues() const;
virtual void destroyConstant(); virtual void destroyConstant();
/// Methods for support type inquiry through isa, cast, and dyn_cast: /// Methods for support type inquiry through isa, cast, and dyn_cast:
/// ///
static bool classof(const Value *V) { static bool classof(const Value *V) {
@ -656,7 +656,7 @@ protected:
return User::operator new(s, 0); return User::operator new(s, 0);
} }
public: public:
/// get() constructors - Return a constant with array type with an element /// get() constructors - Return a constant with array type with an element
/// count and element type matching the ArrayRef passed in. Note that this /// count and element type matching the ArrayRef passed in. Note that this
/// can return a ConstantAggregateZero object. /// can return a ConstantAggregateZero object.
@ -666,7 +666,7 @@ public:
static Constant *get(LLVMContext &Context, ArrayRef<uint64_t> Elts); static Constant *get(LLVMContext &Context, ArrayRef<uint64_t> Elts);
static Constant *get(LLVMContext &Context, ArrayRef<float> Elts); static Constant *get(LLVMContext &Context, ArrayRef<float> Elts);
static Constant *get(LLVMContext &Context, ArrayRef<double> Elts); static Constant *get(LLVMContext &Context, ArrayRef<double> Elts);
/// getString - This method constructs a CDS and initializes it with a text /// getString - This method constructs a CDS and initializes it with a text
/// string. The default behavior (AddNull==true) causes a null terminator to /// string. The default behavior (AddNull==true) causes a null terminator to
/// be placed at the end of the array (increasing the length of the string by /// be placed at the end of the array (increasing the length of the string by
@ -681,14 +681,14 @@ public:
inline ArrayType *getType() const { inline ArrayType *getType() const {
return reinterpret_cast<ArrayType*>(Value::getType()); return reinterpret_cast<ArrayType*>(Value::getType());
} }
/// Methods for support type inquiry through isa, cast, and dyn_cast: /// Methods for support type inquiry through isa, cast, and dyn_cast:
/// ///
static bool classof(const Value *V) { static bool classof(const Value *V) {
return V->getValueID() == ConstantDataArrayVal; return V->getValueID() == ConstantDataArrayVal;
} }
}; };
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
/// ConstantDataVector - A vector constant whose element type is a simple /// ConstantDataVector - A vector constant whose element type is a simple
/// 1/2/4/8-byte integer or float/double, and whose elements are just simple /// 1/2/4/8-byte integer or float/double, and whose elements are just simple
@ -708,7 +708,7 @@ protected:
return User::operator new(s, 0); return User::operator new(s, 0);
} }
public: public:
/// get() constructors - Return a constant with vector type with an element /// get() constructors - Return a constant with vector type with an element
/// count and element type matching the ArrayRef passed in. Note that this /// count and element type matching the ArrayRef passed in. Note that this
/// can return a ConstantAggregateZero object. /// can return a ConstantAggregateZero object.
@ -718,7 +718,7 @@ public:
static Constant *get(LLVMContext &Context, ArrayRef<uint64_t> Elts); static Constant *get(LLVMContext &Context, ArrayRef<uint64_t> Elts);
static Constant *get(LLVMContext &Context, ArrayRef<float> Elts); static Constant *get(LLVMContext &Context, ArrayRef<float> Elts);
static Constant *get(LLVMContext &Context, ArrayRef<double> Elts); static Constant *get(LLVMContext &Context, ArrayRef<double> Elts);
/// getSplat - Return a ConstantVector with the specified constant in each /// getSplat - Return a ConstantVector with the specified constant in each
/// element. The specified constant has to be a of a compatible type (i8/i16/ /// element. The specified constant has to be a of a compatible type (i8/i16/
/// i32/i64/float/double) and must be a ConstantFP or ConstantInt. /// i32/i64/float/double) and must be a ConstantFP or ConstantInt.
@ -727,14 +727,14 @@ public:
/// getSplatValue - If this is a splat constant, meaning that all of the /// getSplatValue - If this is a splat constant, meaning that all of the
/// elements have the same value, return that value. Otherwise return NULL. /// elements have the same value, return that value. Otherwise return NULL.
Constant *getSplatValue() const; Constant *getSplatValue() const;
/// getType - Specialize the getType() method to always return a VectorType, /// getType - Specialize the getType() method to always return a VectorType,
/// which reduces the amount of casting needed in parts of the compiler. /// which reduces the amount of casting needed in parts of the compiler.
/// ///
inline VectorType *getType() const { inline VectorType *getType() const {
return reinterpret_cast<VectorType*>(Value::getType()); return reinterpret_cast<VectorType*>(Value::getType());
} }
/// Methods for support type inquiry through isa, cast, and dyn_cast: /// Methods for support type inquiry through isa, cast, and dyn_cast:
/// ///
static bool classof(const Value *V) { static bool classof(const Value *V) {
@ -753,20 +753,20 @@ class BlockAddress : public Constant {
public: public:
/// get - Return a BlockAddress for the specified function and basic block. /// get - Return a BlockAddress for the specified function and basic block.
static BlockAddress *get(Function *F, BasicBlock *BB); static BlockAddress *get(Function *F, BasicBlock *BB);
/// get - Return a BlockAddress for the specified basic block. The basic /// get - Return a BlockAddress for the specified basic block. The basic
/// block must be embedded into a function. /// block must be embedded into a function.
static BlockAddress *get(BasicBlock *BB); static BlockAddress *get(BasicBlock *BB);
/// Transparently provide more efficient getOperand methods. /// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
Function *getFunction() const { return (Function*)Op<0>().get(); } Function *getFunction() const { return (Function*)Op<0>().get(); }
BasicBlock *getBasicBlock() const { return (BasicBlock*)Op<1>().get(); } BasicBlock *getBasicBlock() const { return (BasicBlock*)Op<1>().get(); }
virtual void destroyConstant(); virtual void destroyConstant();
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U);
/// Methods for support type inquiry through isa, cast, and dyn_cast: /// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const Value *V) { static inline bool classof(const Value *V) {
return V->getValueID() == BlockAddressVal; return V->getValueID() == BlockAddressVal;
@ -779,7 +779,7 @@ struct OperandTraits<BlockAddress> :
}; };
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BlockAddress, Value) DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BlockAddress, Value)
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
/// ConstantExpr - a constant value that is initialized with an expression using /// ConstantExpr - a constant value that is initialized with an expression using
@ -809,14 +809,14 @@ public:
/// getAlignOf constant expr - computes the alignment of a type in a target /// getAlignOf constant expr - computes the alignment of a type in a target
/// independent way (Note: the return type is an i64). /// independent way (Note: the return type is an i64).
static Constant *getAlignOf(Type *Ty); static Constant *getAlignOf(Type *Ty);
/// getSizeOf constant expr - computes the (alloc) size of a type (in /// getSizeOf constant expr - computes the (alloc) size of a type (in
/// address-units, not bits) in a target independent way (Note: the return /// address-units, not bits) in a target independent way (Note: the return
/// type is an i64). /// type is an i64).
/// ///
static Constant *getSizeOf(Type *Ty); static Constant *getSizeOf(Type *Ty);
/// getOffsetOf constant expr - computes the offset of a struct field in a /// getOffsetOf constant expr - computes the offset of a struct field in a
/// target independent way (Note: the return type is an i64). /// target independent way (Note: the return type is an i64).
/// ///
static Constant *getOffsetOf(StructType *STy, unsigned FieldNo); static Constant *getOffsetOf(StructType *STy, unsigned FieldNo);
@ -825,7 +825,7 @@ public:
/// which supports any aggregate type, and any Constant index. /// which supports any aggregate type, and any Constant index.
/// ///
static Constant *getOffsetOf(Type *Ty, Constant *FieldNo); static Constant *getOffsetOf(Type *Ty, Constant *FieldNo);
static Constant *getNeg(Constant *C, bool HasNUW = false, bool HasNSW =false); static Constant *getNeg(Constant *C, bool HasNUW = false, bool HasNSW =false);
static Constant *getFNeg(Constant *C); static Constant *getFNeg(Constant *C);
static Constant *getNot(Constant *C); static Constant *getNot(Constant *C);
@ -931,7 +931,7 @@ public:
Type *Ty ///< The type to zext or bitcast C to Type *Ty ///< The type to zext or bitcast C to
); );
// @brief Create a SExt or BitCast cast constant expression // @brief Create a SExt or BitCast cast constant expression
static Constant *getSExtOrBitCast( static Constant *getSExtOrBitCast(
Constant *C, ///< The constant to sext or bitcast Constant *C, ///< The constant to sext or bitcast
Type *Ty ///< The type to sext or bitcast C to Type *Ty ///< The type to sext or bitcast C to
@ -951,14 +951,14 @@ public:
/// @brief Create a ZExt, Bitcast or Trunc for integer -> integer casts /// @brief Create a ZExt, Bitcast or Trunc for integer -> integer casts
static Constant *getIntegerCast( static Constant *getIntegerCast(
Constant *C, ///< The integer constant to be casted Constant *C, ///< The integer constant to be casted
Type *Ty, ///< The integer type to cast to Type *Ty, ///< The integer type to cast to
bool isSigned ///< Whether C should be treated as signed or not bool isSigned ///< Whether C should be treated as signed or not
); );
/// @brief Create a FPExt, Bitcast or FPTrunc for fp -> fp casts /// @brief Create a FPExt, Bitcast or FPTrunc for fp -> fp casts
static Constant *getFPCast( static Constant *getFPCast(
Constant *C, ///< The integer constant to be casted Constant *C, ///< The integer constant to be casted
Type *Ty ///< The integer type to cast to Type *Ty ///< The integer type to cast to
); );
@ -1062,7 +1062,7 @@ public:
/// getWithOperandReplaced - Return a constant expression identical to this /// getWithOperandReplaced - Return a constant expression identical to this
/// one, but with the specified operand set to the specified value. /// one, but with the specified operand set to the specified value.
Constant *getWithOperandReplaced(unsigned OpNo, Constant *Op) const; Constant *getWithOperandReplaced(unsigned OpNo, Constant *Op) const;
/// getWithOperands - This returns the current constant expression with the /// getWithOperands - This returns the current constant expression with the
/// operands replaced with the specified values. The specified array must /// operands replaced with the specified values. The specified array must
/// have the same number of operands as our current one. /// have the same number of operands as our current one.
@ -1083,7 +1083,7 @@ public:
static inline bool classof(const Value *V) { static inline bool classof(const Value *V) {
return V->getValueID() == ConstantExprVal; return V->getValueID() == ConstantExprVal;
} }
private: private:
// Shadow Value::setValueSubclassData with a private forwarding method so that // Shadow Value::setValueSubclassData with a private forwarding method so that
// subclasses cannot accidentally use it. // subclasses cannot accidentally use it.
@ -1128,11 +1128,11 @@ public:
/// getSequentialElement - If this Undef has array or vector type, return a /// getSequentialElement - If this Undef has array or vector type, return a
/// undef with the right element type. /// undef with the right element type.
UndefValue *getSequentialElement() const; UndefValue *getSequentialElement() const;
/// getStructElement - If this undef has struct type, return a undef with the /// getStructElement - If this undef has struct type, return a undef with the
/// right element type for the specified element. /// right element type for the specified element.
UndefValue *getStructElement(unsigned Elt) const; UndefValue *getStructElement(unsigned Elt) const;
/// getElementValue - Return an undef of the right value for the specified GEP /// getElementValue - Return an undef of the right value for the specified GEP
/// index. /// index.
UndefValue *getElementValue(Constant *C) const; UndefValue *getElementValue(Constant *C) const;