aboutsummaryrefslogtreecommitdiff
path: root/llvm/include/llvm/IR/Constants.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include/llvm/IR/Constants.h')
-rw-r--r--llvm/include/llvm/IR/Constants.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/llvm/include/llvm/IR/Constants.h b/llvm/include/llvm/IR/Constants.h
index b5dcc7f..c0ac9a4 100644
--- a/llvm/include/llvm/IR/Constants.h
+++ b/llvm/include/llvm/IR/Constants.h
@@ -78,13 +78,20 @@ public:
/// Class for constant integers.
class ConstantInt final : public ConstantData {
friend class Constant;
+ friend class ConstantVector;
APInt Val;
- ConstantInt(IntegerType *Ty, const APInt &V);
+ ConstantInt(Type *Ty, const APInt &V);
void destroyConstantImpl();
+ /// Return a ConstantInt with the specified value and an implied Type. The
+ /// type is the vector type whose integer element type corresponds to the bit
+ /// width of the value.
+ static ConstantInt *get(LLVMContext &Context, ElementCount EC,
+ const APInt &V);
+
public:
ConstantInt(const ConstantInt &) = delete;
@@ -136,7 +143,7 @@ public:
/// Return the constant's value.
inline const APInt &getValue() const { return Val; }
- /// getBitWidth - Return the bitwidth of this constant.
+ /// getBitWidth - Return the scalar bitwidth of this constant.
unsigned getBitWidth() const { return Val.getBitWidth(); }
/// Return the constant as a 64-bit unsigned integer value after it
@@ -259,6 +266,7 @@ public:
///
class ConstantFP final : public ConstantData {
friend class Constant;
+ friend class ConstantVector;
APFloat Val;
@@ -266,6 +274,12 @@ class ConstantFP final : public ConstantData {
void destroyConstantImpl();
+ /// Return a ConstantFP with the specified value and an implied Type. The
+ /// type is the vector type whose element type has the same floating point
+ /// semantics as the value.
+ static ConstantFP *get(LLVMContext &Context, ElementCount EC,
+ const APFloat &V);
+
public:
ConstantFP(const ConstantFP &) = delete;