mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
don't repeat names in documentation comments; NFC
llvm-svn: 258820
This commit is contained in:
parent
75511fc092
commit
f17d5e0627
@ -48,42 +48,41 @@ protected:
|
|||||||
: User(ty, vty, Ops, NumOps) {}
|
: User(ty, vty, Ops, NumOps) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// isNullValue - Return true if this is the value that would be returned by
|
/// Return true if this is the value that would be returned by getNullValue.
|
||||||
/// getNullValue.
|
|
||||||
bool isNullValue() const;
|
bool isNullValue() const;
|
||||||
|
|
||||||
/// \brief Returns true if the value is one.
|
/// Returns true if the value is one.
|
||||||
bool isOneValue() const;
|
bool isOneValue() const;
|
||||||
|
|
||||||
/// isAllOnesValue - Return true if this is the value that would be returned by
|
/// Return true if this is the value that would be returned by
|
||||||
/// getAllOnesValue.
|
/// getAllOnesValue.
|
||||||
bool isAllOnesValue() const;
|
bool isAllOnesValue() const;
|
||||||
|
|
||||||
/// isNegativeZeroValue - Return true if the value is what would be returned
|
/// Return true if the value is what would be returned by
|
||||||
/// by getZeroValueForNegation.
|
/// getZeroValueForNegation.
|
||||||
bool isNegativeZeroValue() const;
|
bool isNegativeZeroValue() const;
|
||||||
|
|
||||||
/// Return true if the value is negative zero or null value.
|
/// Return true if the value is negative zero or null value.
|
||||||
bool isZeroValue() const;
|
bool isZeroValue() const;
|
||||||
|
|
||||||
/// \brief Return true if the value is not the smallest signed value.
|
/// Return true if the value is not the smallest signed value.
|
||||||
bool isNotMinSignedValue() const;
|
bool isNotMinSignedValue() const;
|
||||||
|
|
||||||
/// \brief Return true if the value is the smallest signed value.
|
/// Return true if the value is the smallest signed value.
|
||||||
bool isMinSignedValue() const;
|
bool isMinSignedValue() const;
|
||||||
|
|
||||||
/// canTrap - Return true if evaluation of this constant could trap. This is
|
/// Return true if evaluation of this constant could trap. This is true for
|
||||||
/// true for things like constant expressions that could divide by zero.
|
/// things like constant expressions that could divide by zero.
|
||||||
bool canTrap() const;
|
bool canTrap() const;
|
||||||
|
|
||||||
/// isThreadDependent - Return true if the value can vary between threads.
|
/// Return true if the value can vary between threads.
|
||||||
bool isThreadDependent() const;
|
bool isThreadDependent() const;
|
||||||
|
|
||||||
/// Return true if the value is dependent on a dllimport variable.
|
/// Return true if the value is dependent on a dllimport variable.
|
||||||
bool isDLLImportDependent() const;
|
bool isDLLImportDependent() const;
|
||||||
|
|
||||||
/// isConstantUsed - Return true if the constant has users other than constant
|
/// Return true if the constant has users other than constant expressions and
|
||||||
/// exprs and other dangling things.
|
/// other dangling things.
|
||||||
bool isConstantUsed() const;
|
bool isConstantUsed() const;
|
||||||
|
|
||||||
/// This method classifies the entry according to whether or not it may
|
/// This method classifies the entry according to whether or not it may
|
||||||
@ -93,15 +92,14 @@ public:
|
|||||||
/// FIXME: This really should not be in IR.
|
/// FIXME: This really should not be in IR.
|
||||||
bool needsRelocation() const;
|
bool needsRelocation() const;
|
||||||
|
|
||||||
/// getAggregateElement - For aggregates (struct/array/vector) return the
|
/// For aggregates (struct/array/vector) return the constant that corresponds
|
||||||
/// constant that corresponds to the specified element if possible, or null if
|
/// to the specified element if possible, or null if not. This can return null
|
||||||
/// not. This can return null if the element index is a ConstantExpr, or if
|
/// if the element index is a ConstantExpr, or if 'this' is a constant expr.
|
||||||
/// 'this' is a constant expr.
|
|
||||||
Constant *getAggregateElement(unsigned Elt) const;
|
Constant *getAggregateElement(unsigned Elt) const;
|
||||||
Constant *getAggregateElement(Constant *Elt) const;
|
Constant *getAggregateElement(Constant *Elt) const;
|
||||||
|
|
||||||
/// getSplatValue - If this is a splat vector constant, meaning that all of
|
/// If this is a splat vector constant, meaning that all of the elements have
|
||||||
/// the elements have the same value, return that value. Otherwise return 0.
|
/// the same value, return that value. Otherwise return 0.
|
||||||
Constant *getSplatValue() const;
|
Constant *getSplatValue() const;
|
||||||
|
|
||||||
/// If C is a constant integer then return its value, otherwise C must be a
|
/// If C is a constant integer then return its value, otherwise C must be a
|
||||||
@ -142,14 +140,14 @@ public:
|
|||||||
/// @brief Get the all ones value
|
/// @brief Get the all ones value
|
||||||
static Constant *getAllOnesValue(Type* Ty);
|
static Constant *getAllOnesValue(Type* Ty);
|
||||||
|
|
||||||
/// getIntegerValue - Return the value for an integer or pointer constant,
|
/// Return the value for an integer or pointer constant, or a vector thereof,
|
||||||
/// or a vector thereof, with the given scalar value.
|
/// with the given scalar value.
|
||||||
static Constant *getIntegerValue(Type *Ty, const APInt &V);
|
static Constant *getIntegerValue(Type *Ty, const APInt &V);
|
||||||
|
|
||||||
/// removeDeadConstantUsers - If there are any dead constant users dangling
|
/// If there are any dead constant users dangling off of this constant, remove
|
||||||
/// off of this constant, remove them. This method is useful for clients
|
/// them. This method is useful for clients that want to check to see if a
|
||||||
/// that want to check to see if a global is unused, but don't want to deal
|
/// global is unused, but don't want to deal with potentially dead constants
|
||||||
/// with potentially dead constants hanging off of the globals.
|
/// hanging off of the globals.
|
||||||
void removeDeadConstantUsers() const;
|
void removeDeadConstantUsers() const;
|
||||||
|
|
||||||
Constant *stripPointerCasts() {
|
Constant *stripPointerCasts() {
|
||||||
|
@ -254,10 +254,10 @@ public:
|
|||||||
/// 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
|
/// This returns a ConstantFP, or a vector containing a splat of a ConstantFP,
|
||||||
/// ConstantFP, for the specified value in the specified type. This should
|
/// for the specified value in the specified type. This should only be used
|
||||||
/// only be used for simple constant values like 2.0/1.0 etc, that are
|
/// for simple constant values like 2.0/1.0 etc, that are known-valid both as
|
||||||
/// known-valid both as host double and as the target format.
|
/// host double and as the target format.
|
||||||
static Constant *get(Type* Ty, double V);
|
static Constant *get(Type* Ty, double V);
|
||||||
static Constant *get(Type* Ty, StringRef Str);
|
static Constant *get(Type* Ty, StringRef Str);
|
||||||
static ConstantFP *get(LLVMContext &Context, const APFloat &V);
|
static ConstantFP *get(LLVMContext &Context, const APFloat &V);
|
||||||
@ -265,24 +265,24 @@ public:
|
|||||||
static Constant *getNegativeZero(Type *Ty);
|
static Constant *getNegativeZero(Type *Ty);
|
||||||
static Constant *getInfinity(Type *Ty, bool Negative = false);
|
static Constant *getInfinity(Type *Ty, bool Negative = false);
|
||||||
|
|
||||||
/// isValueValidForType - return true if Ty is big enough to represent V.
|
/// 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; }
|
||||||
|
|
||||||
/// isZero - Return true if the value is positive or negative zero.
|
/// Return true if the value is positive or negative zero.
|
||||||
bool isZero() const { return Val.isZero(); }
|
bool isZero() const { return Val.isZero(); }
|
||||||
|
|
||||||
/// isNegative - Return true if the sign bit is set.
|
/// Return true if the sign bit is set.
|
||||||
bool isNegative() const { return Val.isNegative(); }
|
bool isNegative() const { return Val.isNegative(); }
|
||||||
|
|
||||||
/// isInfinity - Return true if the value is infinity
|
/// Return true if the value is infinity
|
||||||
bool isInfinity() const { return Val.isInfinity(); }
|
bool isInfinity() const { return Val.isInfinity(); }
|
||||||
|
|
||||||
/// isNaN - Return true if the value is a NaN.
|
/// Return true if the value is a NaN.
|
||||||
bool isNaN() const { return Val.isNaN(); }
|
bool isNaN() const { return Val.isNaN(); }
|
||||||
|
|
||||||
/// isExactlyValue - We don't rely on operator== working on double values, as
|
/// We don't rely on operator== working on double values, as it returns true
|
||||||
/// it returns true for things that are clearly not equal, like -0.0 and 0.0.
|
/// for things that are clearly not equal, like -0.0 and 0.0.
|
||||||
/// As such, this method can be used to do an exact bit-for-bit comparison of
|
/// As such, this method can be used to do an exact bit-for-bit comparison of
|
||||||
/// two floating point values. The version with a double operand is retained
|
/// two floating point values. The version with a double operand is retained
|
||||||
/// because it's so convenient to write isExactlyValue(2.0), but please use
|
/// because it's so convenient to write isExactlyValue(2.0), but please use
|
||||||
@ -302,7 +302,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
/// ConstantAggregateZero - All zero aggregate value
|
/// All zero aggregate value
|
||||||
///
|
///
|
||||||
class ConstantAggregateZero : public Constant {
|
class ConstantAggregateZero : public Constant {
|
||||||
void *operator new(size_t, unsigned) = delete;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
@ -323,23 +323,21 @@ protected:
|
|||||||
public:
|
public:
|
||||||
static ConstantAggregateZero *get(Type *Ty);
|
static ConstantAggregateZero *get(Type *Ty);
|
||||||
|
|
||||||
/// getSequentialElement - If this CAZ has array or vector type, return a zero
|
/// If this CAZ has array or vector type, return a zero with the right element
|
||||||
/// with the right element type.
|
/// type.
|
||||||
Constant *getSequentialElement() const;
|
Constant *getSequentialElement() const;
|
||||||
|
|
||||||
/// getStructElement - If this CAZ has struct type, return a zero with the
|
/// If this CAZ has struct type, return a zero with the right element type for
|
||||||
/// right element type for the specified element.
|
/// the specified element.
|
||||||
Constant *getStructElement(unsigned Elt) const;
|
Constant *getStructElement(unsigned Elt) const;
|
||||||
|
|
||||||
/// getElementValue - Return a zero of the right value for the specified GEP
|
/// Return a zero of the right value for the specified GEP index.
|
||||||
/// index.
|
|
||||||
Constant *getElementValue(Constant *C) const;
|
Constant *getElementValue(Constant *C) const;
|
||||||
|
|
||||||
/// getElementValue - Return a zero of the right value for the specified GEP
|
/// Return a zero of the right value for the specified GEP index.
|
||||||
/// index.
|
|
||||||
Constant *getElementValue(unsigned Idx) const;
|
Constant *getElementValue(unsigned Idx) const;
|
||||||
|
|
||||||
/// \brief Return the number of elements in the array, vector, or struct.
|
/// Return the number of elements in the array, vector, or struct.
|
||||||
unsigned getNumElements() const;
|
unsigned getNumElements() const;
|
||||||
|
|
||||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
@ -374,9 +372,8 @@ public:
|
|||||||
/// Transparently provide more efficient getOperand methods.
|
/// Transparently provide more efficient getOperand methods.
|
||||||
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
|
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
|
||||||
|
|
||||||
/// getType - Specialize the getType() method to always return an ArrayType,
|
/// Specialize the getType() method to always return an ArrayType,
|
||||||
/// 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 ArrayType *getType() const {
|
inline ArrayType *getType() const {
|
||||||
return cast<ArrayType>(Value::getType());
|
return cast<ArrayType>(Value::getType());
|
||||||
}
|
}
|
||||||
@ -395,7 +392,7 @@ struct OperandTraits<ConstantArray> :
|
|||||||
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ConstantArray, Constant)
|
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ConstantArray, Constant)
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// ConstantStruct - Constant Struct Declarations
|
// Constant Struct Declarations
|
||||||
//
|
//
|
||||||
class ConstantStruct : public Constant {
|
class ConstantStruct : public Constant {
|
||||||
friend struct ConstantAggrKeyType<ConstantStruct>;
|
friend struct ConstantAggrKeyType<ConstantStruct>;
|
||||||
@ -412,9 +409,8 @@ public:
|
|||||||
static Constant *get(StructType *T, ArrayRef<Constant*> V);
|
static Constant *get(StructType *T, ArrayRef<Constant*> V);
|
||||||
static Constant *get(StructType *T, ...) LLVM_END_WITH_NULL;
|
static Constant *get(StructType *T, ...) LLVM_END_WITH_NULL;
|
||||||
|
|
||||||
/// getAnon - Return an anonymous struct that has the specified
|
/// Return an anonymous struct that has the specified elements.
|
||||||
/// elements. If the struct is possibly empty, then you must specify a
|
/// If the struct is possibly empty, then you must specify a context.
|
||||||
/// context.
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
@ -423,11 +419,11 @@ public:
|
|||||||
return get(getTypeForElements(Ctx, V, Packed), V);
|
return get(getTypeForElements(Ctx, V, Packed), V);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getTypeForElements - Return an anonymous struct type to use for a constant
|
/// Return an anonymous struct type to use for a constant with the specified
|
||||||
/// with the specified set of elements. The list must not be empty.
|
/// set of elements. The list must not be empty.
|
||||||
static StructType *getTypeForElements(ArrayRef<Constant*> V,
|
static StructType *getTypeForElements(ArrayRef<Constant*> V,
|
||||||
bool Packed = false);
|
bool Packed = false);
|
||||||
/// getTypeForElements - This version of the method allows an empty list.
|
/// This version of the method allows an empty list.
|
||||||
static StructType *getTypeForElements(LLVMContext &Ctx,
|
static StructType *getTypeForElements(LLVMContext &Ctx,
|
||||||
ArrayRef<Constant*> V,
|
ArrayRef<Constant*> V,
|
||||||
bool Packed = false);
|
bool Packed = false);
|
||||||
@ -435,8 +431,7 @@ public:
|
|||||||
/// Transparently provide more efficient getOperand methods.
|
/// Transparently provide more efficient getOperand methods.
|
||||||
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
|
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
|
||||||
|
|
||||||
/// getType() specialization - Reduce amount of casting...
|
/// Specialization - reduce amount of casting.
|
||||||
///
|
|
||||||
inline StructType *getType() const {
|
inline StructType *getType() const {
|
||||||
return cast<StructType>(Value::getType());
|
return cast<StructType>(Value::getType());
|
||||||
}
|
}
|
||||||
@ -456,7 +451,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ConstantStruct, Constant)
|
|||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
/// ConstantVector - Constant Vector Declarations
|
/// Constant Vector Declarations
|
||||||
///
|
///
|
||||||
class ConstantVector : public Constant {
|
class ConstantVector : public Constant {
|
||||||
friend struct ConstantAggrKeyType<ConstantVector>;
|
friend struct ConstantAggrKeyType<ConstantVector>;
|
||||||
@ -476,22 +471,20 @@ private:
|
|||||||
static Constant *getImpl(ArrayRef<Constant *> V);
|
static Constant *getImpl(ArrayRef<Constant *> V);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// getSplat - Return a ConstantVector with the specified constant in each
|
/// 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);
|
||||||
|
|
||||||
/// getType - Specialize the getType() method to always return a VectorType,
|
/// 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 cast<VectorType>(Value::getType());
|
return cast<VectorType>(Value::getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getSplatValue - If this is a splat constant, meaning that all of the
|
/// If this is a splat constant, meaning that all of the elements have the
|
||||||
/// elements have the same value, return that value. Otherwise return NULL.
|
/// same value, return that value. Otherwise return NULL.
|
||||||
Constant *getSplatValue() const;
|
Constant *getSplatValue() const;
|
||||||
|
|
||||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
@ -508,7 +501,7 @@ struct OperandTraits<ConstantVector> :
|
|||||||
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ConstantVector, Constant)
|
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ConstantVector, Constant)
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
/// ConstantPointerNull - a constant pointer value that points to null
|
/// A constant pointer value that points to null
|
||||||
///
|
///
|
||||||
class ConstantPointerNull : public Constant {
|
class ConstantPointerNull : public Constant {
|
||||||
void *operator new(size_t, unsigned) = delete;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
@ -529,12 +522,11 @@ protected:
|
|||||||
return User::operator new(s, 0);
|
return User::operator new(s, 0);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
/// get() - Static factory methods - Return objects of the specified value
|
/// Static factory methods - Return objects of the specified value
|
||||||
static ConstantPointerNull *get(PointerType *T);
|
static ConstantPointerNull *get(PointerType *T);
|
||||||
|
|
||||||
/// getType - Specialize the getType() method to always return an PointerType,
|
/// Specialize the getType() method to always return an PointerType,
|
||||||
/// 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 PointerType *getType() const {
|
inline PointerType *getType() const {
|
||||||
return cast<PointerType>(Value::getType());
|
return cast<PointerType>(Value::getType());
|
||||||
}
|
}
|
||||||
@ -556,11 +548,11 @@ public:
|
|||||||
///
|
///
|
||||||
class ConstantDataSequential : public Constant {
|
class ConstantDataSequential : public Constant {
|
||||||
friend class LLVMContextImpl;
|
friend class LLVMContextImpl;
|
||||||
/// DataElements - A pointer to the bytes underlying this constant (which is
|
/// A pointer to the bytes underlying this constant (which is owned by the
|
||||||
/// owned by the uniquing StringMap).
|
/// uniquing StringMap).
|
||||||
const char *DataElements;
|
const char *DataElements;
|
||||||
|
|
||||||
/// Next - This forms a link list of ConstantDataSequential nodes that have
|
/// 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
|
||||||
/// the same StringMap bucket, linked up.
|
/// the same StringMap bucket, linked up.
|
||||||
@ -580,90 +572,84 @@ protected:
|
|||||||
static Constant *getImpl(StringRef Bytes, Type *Ty);
|
static Constant *getImpl(StringRef Bytes, Type *Ty);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// allocate space for exactly zero operands.
|
// Allocate space for exactly zero operands.
|
||||||
void *operator new(size_t s) {
|
void *operator new(size_t s) {
|
||||||
return User::operator new(s, 0);
|
return User::operator new(s, 0);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// isElementTypeCompatible - Return true if a ConstantDataSequential can be
|
/// Return true if a ConstantDataSequential can be formed with a vector or
|
||||||
/// formed with a vector or array of the specified element type.
|
/// 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(Type *Ty);
|
static bool isElementTypeCompatible(Type *Ty);
|
||||||
|
|
||||||
/// getElementAsInteger - If this is a sequential container of integers (of
|
/// If this is a sequential container of integers (of any size), return the
|
||||||
/// any size), return the specified element in the low bits of a uint64_t.
|
/// specified element in the low bits of a uint64_t.
|
||||||
uint64_t getElementAsInteger(unsigned i) const;
|
uint64_t getElementAsInteger(unsigned i) const;
|
||||||
|
|
||||||
/// getElementAsAPFloat - If this is a sequential container of floating point
|
/// If this is a sequential container of floating point type, return the
|
||||||
/// type, return the specified element as an APFloat.
|
/// specified element as an APFloat.
|
||||||
APFloat getElementAsAPFloat(unsigned i) const;
|
APFloat getElementAsAPFloat(unsigned i) const;
|
||||||
|
|
||||||
/// getElementAsFloat - If this is an sequential container of floats, return
|
/// If this is an sequential container of floats, return the specified element
|
||||||
/// the specified element as a float.
|
/// as a float.
|
||||||
float getElementAsFloat(unsigned i) const;
|
float getElementAsFloat(unsigned i) const;
|
||||||
|
|
||||||
/// getElementAsDouble - If this is an sequential container of doubles, return
|
/// If this is an sequential container of doubles, return the specified
|
||||||
/// the specified element as a double.
|
/// element as a double.
|
||||||
double getElementAsDouble(unsigned i) const;
|
double getElementAsDouble(unsigned i) const;
|
||||||
|
|
||||||
/// getElementAsConstant - Return a Constant for a specified index's element.
|
/// 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
|
/// Specialize the getType() method to always return a SequentialType, which
|
||||||
/// SequentialType, which reduces the amount of casting needed in parts of the
|
/// reduces the amount of casting needed in parts of the compiler.
|
||||||
/// compiler.
|
|
||||||
inline SequentialType *getType() const {
|
inline SequentialType *getType() const {
|
||||||
return cast<SequentialType>(Value::getType());
|
return cast<SequentialType>(Value::getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getElementType - Return the element type of the array/vector.
|
/// 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.
|
/// Return the number of elements in the array or vector.
|
||||||
unsigned getNumElements() const;
|
unsigned getNumElements() const;
|
||||||
|
|
||||||
/// getElementByteSize - Return the size (in bytes) of each element in the
|
/// Return the size (in bytes) of each element in the array/vector.
|
||||||
/// array/vector. The size of the elements is known to be a multiple of one
|
/// The size of the elements is known to be a multiple of one byte.
|
||||||
/// byte.
|
|
||||||
uint64_t getElementByteSize() const;
|
uint64_t getElementByteSize() const;
|
||||||
|
|
||||||
|
|
||||||
/// isString - This method returns true if this is an array of i8.
|
/// 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
|
/// This method returns true if the array "isString", ends with a null byte,
|
||||||
/// nul byte, and does not contains any other nul bytes.
|
/// and does not contains any other null bytes.
|
||||||
bool isCString() const;
|
bool isCString() const;
|
||||||
|
|
||||||
/// getAsString - If this array is isString(), then this method returns the
|
/// If this array is isString(), then this method returns the array as a
|
||||||
/// array as a StringRef. Otherwise, it asserts out.
|
/// StringRef. Otherwise, it asserts out.
|
||||||
///
|
|
||||||
StringRef getAsString() const {
|
StringRef getAsString() const {
|
||||||
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
|
/// If this array is isCString(), then this method returns the array (without
|
||||||
/// array (without the trailing null byte) as a StringRef. Otherwise, it
|
/// the trailing null byte) as a StringRef. Otherwise, it asserts out.
|
||||||
/// asserts out.
|
|
||||||
///
|
|
||||||
StringRef getAsCString() const {
|
StringRef getAsCString() const {
|
||||||
assert(isCString() && "Isn't a C string");
|
assert(isCString() && "Isn't a C string");
|
||||||
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
|
/// Return the raw, underlying, bytes of this data. Note that this is an
|
||||||
/// that this is an extremely tricky thing to work with, as it exposes the
|
/// extremely tricky thing to work with, as it exposes the host endianness of
|
||||||
/// host endianness of the data elements.
|
/// the data elements.
|
||||||
StringRef getRawDataValues() const;
|
StringRef getRawDataValues() const;
|
||||||
|
|
||||||
/// 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 ||
|
||||||
V->getValueID() == ConstantDataVectorVal;
|
V->getValueID() == ConstantDataVectorVal;
|
||||||
@ -673,11 +659,11 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
/// ConstantDataArray - An array constant whose element type is a simple
|
/// An array constant whose element type is a simple 1/2/4/8-byte integer or
|
||||||
/// 1/2/4/8-byte integer or float/double, and whose elements are just simple
|
/// float/double, and whose elements are just simple data values
|
||||||
/// data values (i.e. ConstantInt/ConstantFP). This Constant node has no
|
/// (i.e. ConstantInt/ConstantFP). This Constant node has no operands because it
|
||||||
/// operands because it stores all of the elements of the constant as densely
|
/// stores all of the elements of the constant as densely packed data, instead
|
||||||
/// packed data, instead of as Value*'s.
|
/// of as Value*'s.
|
||||||
class ConstantDataArray : public ConstantDataSequential {
|
class ConstantDataArray : public ConstantDataSequential {
|
||||||
void *operator new(size_t, unsigned) = delete;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
ConstantDataArray(const ConstantDataArray &) = delete;
|
ConstantDataArray(const ConstantDataArray &) = delete;
|
||||||
@ -686,7 +672,7 @@ class ConstantDataArray : public ConstantDataSequential {
|
|||||||
explicit ConstantDataArray(Type *ty, const char *Data)
|
explicit ConstantDataArray(Type *ty, const char *Data)
|
||||||
: ConstantDataSequential(ty, ConstantDataArrayVal, Data) {}
|
: ConstantDataSequential(ty, ConstantDataArrayVal, Data) {}
|
||||||
protected:
|
protected:
|
||||||
// allocate space for exactly zero operands.
|
/// Allocate space for exactly zero operands.
|
||||||
void *operator new(size_t s) {
|
void *operator new(size_t s) {
|
||||||
return User::operator new(s, 0);
|
return User::operator new(s, 0);
|
||||||
}
|
}
|
||||||
@ -711,34 +697,32 @@ public:
|
|||||||
static Constant *getFP(LLVMContext &Context, ArrayRef<uint32_t> Elts);
|
static Constant *getFP(LLVMContext &Context, ArrayRef<uint32_t> Elts);
|
||||||
static Constant *getFP(LLVMContext &Context, ArrayRef<uint64_t> Elts);
|
static Constant *getFP(LLVMContext &Context, ArrayRef<uint64_t> Elts);
|
||||||
|
|
||||||
/// getString - This method constructs a CDS and initializes it with a text
|
/// This method constructs a CDS and initializes it with a text string.
|
||||||
/// string. The default behavior (AddNull==true) causes a null terminator to
|
/// 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
|
||||||
/// one more than the StringRef would normally indicate. Pass AddNull=false
|
/// one more than the StringRef would normally indicate. Pass AddNull=false
|
||||||
/// to disable this behavior.
|
/// to disable this behavior.
|
||||||
static Constant *getString(LLVMContext &Context, StringRef Initializer,
|
static Constant *getString(LLVMContext &Context, StringRef Initializer,
|
||||||
bool AddNull = true);
|
bool AddNull = true);
|
||||||
|
|
||||||
/// getType - Specialize the getType() method to always return an ArrayType,
|
/// Specialize the getType() method to always return an ArrayType,
|
||||||
/// 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 ArrayType *getType() const {
|
inline ArrayType *getType() const {
|
||||||
return cast<ArrayType>(Value::getType());
|
return 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
|
/// A vector constant whose element type is a simple 1/2/4/8-byte integer or
|
||||||
/// 1/2/4/8-byte integer or float/double, and whose elements are just simple
|
/// float/double, and whose elements are just simple data values
|
||||||
/// data values (i.e. ConstantInt/ConstantFP). This Constant node has no
|
/// (i.e. ConstantInt/ConstantFP). This Constant node has no operands because it
|
||||||
/// operands because it stores all of the elements of the constant as densely
|
/// stores all of the elements of the constant as densely packed data, instead
|
||||||
/// packed data, instead of as Value*'s.
|
/// of as Value*'s.
|
||||||
class ConstantDataVector : public ConstantDataSequential {
|
class ConstantDataVector : public ConstantDataSequential {
|
||||||
void *operator new(size_t, unsigned) = delete;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
ConstantDataVector(const ConstantDataVector &) = delete;
|
ConstantDataVector(const ConstantDataVector &) = delete;
|
||||||
@ -772,31 +756,29 @@ public:
|
|||||||
static Constant *getFP(LLVMContext &Context, ArrayRef<uint32_t> Elts);
|
static Constant *getFP(LLVMContext &Context, ArrayRef<uint32_t> Elts);
|
||||||
static Constant *getFP(LLVMContext &Context, ArrayRef<uint64_t> Elts);
|
static Constant *getFP(LLVMContext &Context, ArrayRef<uint64_t> Elts);
|
||||||
|
|
||||||
/// getSplat - Return a ConstantVector with the specified constant in each
|
/// Return a ConstantVector with the specified constant in each element.
|
||||||
/// element. The specified constant has to be a of a compatible type (i8/i16/
|
/// 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.
|
||||||
static Constant *getSplat(unsigned NumElts, Constant *Elt);
|
static Constant *getSplat(unsigned NumElts, Constant *Elt);
|
||||||
|
|
||||||
/// getSplatValue - If this is a splat constant, meaning that all of the
|
/// If this is a splat constant, meaning that all of the elements have the
|
||||||
/// elements have the same value, return that value. Otherwise return NULL.
|
/// same value, return that value. Otherwise return NULL.
|
||||||
Constant *getSplatValue() const;
|
Constant *getSplatValue() const;
|
||||||
|
|
||||||
/// getType - Specialize the getType() method to always return a VectorType,
|
/// 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 cast<VectorType>(Value::getType());
|
return 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) {
|
||||||
return V->getValueID() == ConstantDataVectorVal;
|
return V->getValueID() == ConstantDataVectorVal;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
/// ConstantTokenNone - a constant token which is empty
|
/// A constant token which is empty
|
||||||
///
|
///
|
||||||
class ConstantTokenNone : public Constant {
|
class ConstantTokenNone : public Constant {
|
||||||
void *operator new(size_t, unsigned) = delete;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
@ -822,7 +804,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// BlockAddress - The address of a basic block.
|
/// The address of a basic block.
|
||||||
///
|
///
|
||||||
class BlockAddress : public Constant {
|
class BlockAddress : public Constant {
|
||||||
void *operator new(size_t, unsigned) = delete;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
@ -834,15 +816,14 @@ class BlockAddress : public Constant {
|
|||||||
Value *handleOperandChangeImpl(Value *From, Value *To, Use *U);
|
Value *handleOperandChangeImpl(Value *From, Value *To, Use *U);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// get - Return a BlockAddress for the specified function and basic block.
|
/// 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
|
/// 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);
|
||||||
|
|
||||||
/// \brief Lookup an existing \c BlockAddress constant for the given
|
/// Lookup an existing \c BlockAddress constant for the given BasicBlock.
|
||||||
/// BasicBlock.
|
|
||||||
///
|
///
|
||||||
/// \returns 0 if \c !BB->hasAddressTaken(), otherwise the \c BlockAddress.
|
/// \returns 0 if \c !BB->hasAddressTaken(), otherwise the \c BlockAddress.
|
||||||
static BlockAddress *lookup(const BasicBlock *BB);
|
static BlockAddress *lookup(const BasicBlock *BB);
|
||||||
@ -868,7 +849,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BlockAddress, Value)
|
|||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
/// ConstantExpr - a constant value that is initialized with an expression using
|
/// A constant value that is initialized with an expression using
|
||||||
/// other constant values.
|
/// other constant values.
|
||||||
///
|
///
|
||||||
/// This class uses the standard Instruction opcodes to define the various
|
/// This class uses the standard Instruction opcodes to define the various
|
||||||
@ -998,12 +979,12 @@ public:
|
|||||||
return getLShr(C1, C2, true);
|
return getLShr(C1, C2, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getBinOpIdentity - Return the identity for the given binary operation,
|
/// Return the identity for the given binary operation,
|
||||||
/// i.e. a constant C such that X op C = X and C op X = X for every X. It
|
/// i.e. a constant C such that X op C = X and C op X = X for every X. It
|
||||||
/// returns null if the operator doesn't have an identity.
|
/// returns null if the operator doesn't have an identity.
|
||||||
static Constant *getBinOpIdentity(unsigned Opcode, Type *Ty);
|
static Constant *getBinOpIdentity(unsigned Opcode, Type *Ty);
|
||||||
|
|
||||||
/// getBinOpAbsorber - Return the absorbing element for the given binary
|
/// Return the absorbing element for the given binary
|
||||||
/// operation, i.e. a constant C such that X op C = C and C op X = C for
|
/// operation, i.e. a constant C such that X op C = C and C op X = C for
|
||||||
/// every X. For example, this returns zero for integer multiplication.
|
/// every X. For example, this returns zero for integer multiplication.
|
||||||
/// It returns null if the operator doesn't have an absorbing element.
|
/// It returns null if the operator doesn't have an absorbing element.
|
||||||
@ -1165,32 +1146,32 @@ public:
|
|||||||
ArrayRef<unsigned> Idxs,
|
ArrayRef<unsigned> Idxs,
|
||||||
Type *OnlyIfReducedTy = nullptr);
|
Type *OnlyIfReducedTy = nullptr);
|
||||||
|
|
||||||
/// getOpcode - Return the opcode at the root of this constant expression
|
/// Return the opcode at the root of this constant expression
|
||||||
unsigned getOpcode() const { return getSubclassDataFromValue(); }
|
unsigned getOpcode() const { return getSubclassDataFromValue(); }
|
||||||
|
|
||||||
/// getPredicate - Return the ICMP or FCMP predicate value. Assert if this is
|
/// Return the ICMP or FCMP predicate value. Assert if this is not an ICMP or
|
||||||
/// not an ICMP or FCMP constant expression.
|
/// FCMP constant expression.
|
||||||
unsigned getPredicate() const;
|
unsigned getPredicate() const;
|
||||||
|
|
||||||
/// getIndices - Assert that this is an insertvalue or exactvalue
|
/// Assert that this is an insertvalue or exactvalue
|
||||||
/// expression and return the list of indices.
|
/// expression and return the list of indices.
|
||||||
ArrayRef<unsigned> getIndices() const;
|
ArrayRef<unsigned> getIndices() const;
|
||||||
|
|
||||||
/// getOpcodeName - Return a string representation for an opcode.
|
/// Return a string representation for an opcode.
|
||||||
const char *getOpcodeName() const;
|
const char *getOpcodeName() const;
|
||||||
|
|
||||||
/// getWithOperandReplaced - Return a constant expression identical to this
|
/// Return a constant expression identical to this one, but with the specified
|
||||||
/// one, but with the specified operand set to the specified value.
|
/// 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
|
/// This returns the current constant expression with the operands replaced
|
||||||
/// operands replaced with the specified values. The specified array must
|
/// with the specified values. The specified array must have the same number
|
||||||
/// have the same number of operands as our current one.
|
/// of operands as our current one.
|
||||||
Constant *getWithOperands(ArrayRef<Constant*> Ops) const {
|
Constant *getWithOperands(ArrayRef<Constant*> Ops) const {
|
||||||
return getWithOperands(Ops, getType());
|
return getWithOperands(Ops, getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Get the current expression with the operands replaced.
|
/// Get the current expression with the operands replaced.
|
||||||
///
|
///
|
||||||
/// Return the current constant expression with the operands replaced with \c
|
/// Return the current constant expression with the operands replaced with \c
|
||||||
/// Ops and the type with \c Ty. The new operands must have the same number
|
/// Ops and the type with \c Ty. The new operands must have the same number
|
||||||
@ -1203,9 +1184,8 @@ public:
|
|||||||
bool OnlyIfReduced = false,
|
bool OnlyIfReduced = false,
|
||||||
Type *SrcTy = nullptr) const;
|
Type *SrcTy = nullptr) const;
|
||||||
|
|
||||||
/// getAsInstruction - Returns an Instruction which implements the same
|
/// Returns an Instruction which implements the same operation as this
|
||||||
/// operation as this ConstantExpr. The instruction is not linked to any basic
|
/// ConstantExpr. The instruction is not linked to any basic block.
|
||||||
/// block.
|
|
||||||
///
|
///
|
||||||
/// A better approach to this could be to have a constructor for Instruction
|
/// A better approach to this could be to have a constructor for Instruction
|
||||||
/// which would take a ConstantExpr parameter, but that would have spread
|
/// which would take a ConstantExpr parameter, but that would have spread
|
||||||
@ -1234,7 +1214,7 @@ struct OperandTraits<ConstantExpr> :
|
|||||||
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ConstantExpr, Constant)
|
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ConstantExpr, Constant)
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
/// UndefValue - 'undef' values are things that do not have specified contents.
|
/// 'undef' values are things that do not have specified contents.
|
||||||
/// These are used for a variety of purposes, including global variable
|
/// These are used for a variety of purposes, including global variable
|
||||||
/// initializers and operands to instructions. 'undef' values can occur with
|
/// initializers and operands to instructions. 'undef' values can occur with
|
||||||
/// any first-class type.
|
/// any first-class type.
|
||||||
@ -1259,28 +1239,24 @@ protected:
|
|||||||
return User::operator new(s, 0);
|
return User::operator new(s, 0);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
/// get() - Static factory methods - Return an 'undef' object of the specified
|
/// Static factory methods - Return an 'undef' object of the specified type.
|
||||||
/// type.
|
|
||||||
///
|
|
||||||
static UndefValue *get(Type *T);
|
static UndefValue *get(Type *T);
|
||||||
|
|
||||||
/// getSequentialElement - If this Undef has array or vector type, return a
|
/// If this Undef has array or vector type, return a undef with the right
|
||||||
/// undef with the right element type.
|
/// element type.
|
||||||
UndefValue *getSequentialElement() const;
|
UndefValue *getSequentialElement() const;
|
||||||
|
|
||||||
/// getStructElement - If this undef has struct type, return a undef with the
|
/// If this undef has struct type, return a undef with the right element type
|
||||||
/// right element type for the specified element.
|
/// 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
|
/// Return an undef of the right value for the specified GEP index.
|
||||||
/// index.
|
|
||||||
UndefValue *getElementValue(Constant *C) const;
|
UndefValue *getElementValue(Constant *C) const;
|
||||||
|
|
||||||
/// getElementValue - Return an undef of the right value for the specified GEP
|
/// Return an undef of the right value for the specified GEP index.
|
||||||
/// index.
|
|
||||||
UndefValue *getElementValue(unsigned Idx) const;
|
UndefValue *getElementValue(unsigned Idx) const;
|
||||||
|
|
||||||
/// \brief Return the number of elements in the array, vector, or struct.
|
/// Return the number of elements in the array, vector, or struct.
|
||||||
unsigned getNumElements() const;
|
unsigned getNumElements() const;
|
||||||
|
|
||||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
|
Loading…
Reference in New Issue
Block a user