return Val == V;
}
- /// getTrue/getFalse - Return the singleton true/false values.
- static inline ConstantInt *getTrue() {
- if (TheTrueVal) return TheTrueVal;
- return CreateTrueFalseVals(true);
- }
- static inline ConstantInt *getFalse() {
- if (TheFalseVal) return TheFalseVal;
- return CreateTrueFalseVals(false);
- }
-
/// getType - Specialize the getType() method to always return an IntegerType,
/// which reduces the amount of casting needed in parts of the compiler.
///
static bool classof(const Value *V) {
return V->getValueID() == ConstantIntVal;
}
- static void ResetTrueFalse() { TheTrueVal = TheFalseVal = 0; }
-private:
- static ConstantInt *CreateTrueFalseVals(bool WhichOne);
};
APFloat Val;
void *operator new(size_t, unsigned);// DO NOT IMPLEMENT
ConstantFP(const ConstantFP &); // DO NOT IMPLEMENT
+ friend class LLVMContextImpl;
protected:
ConstantFP(const Type *Ty, const APFloat& V);
protected:
return User::operator new(s, 0);
}
public:
- /// get() - Static factory methods - Return objects of the specified value
- static ConstantFP *get(const APFloat &V);
-
/// isValueValidForType - return true if Ty is big enough to represent V.
static bool isValueValidForType(const Type *Ty, const APFloat& V);
inline const APFloat& getValueAPF() const { return Val; }
return User::operator new(s, 0);
}
public:
- /// get() - static factory method for creating a null aggregate. It is
- /// illegal to call this method with a non-aggregate type.
- static ConstantAggregateZero *get(const Type *Ty);
-
/// isNullValue - Return true if this is the value that would be returned by
/// getNullValue.
virtual bool isNullValue() const { return true; }
friend struct ConstantCreator<ConstantArray, ArrayType,
std::vector<Constant*> >;
ConstantArray(const ConstantArray &); // DO NOT IMPLEMENT
+ friend class LLVMContextImpl;
protected:
ConstantArray(const ArrayType *T, const std::vector<Constant*> &Val);
public:
- /// get() - Static factory methods - Return objects of the specified value
- static Constant *get(const ArrayType *T, const std::vector<Constant*> &);
-
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
return V->getValueID() == UndefValueVal;
}
};
-
-//===----------------------------------------------------------------------===//
-/// MDString - a single uniqued string.
-/// These are used to efficiently contain a byte sequence for metadata.
-///
-class MDString : public Constant {
- MDString(const MDString &); // DO NOT IMPLEMENT
- void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
- MDString(const char *begin, const char *end);
-
- const char *StrBegin, *StrEnd;
-protected:
- // allocate space for exactly zero operands
- void *operator new(size_t s) {
- return User::operator new(s, 0);
- }
-public:
- /// get() - Static factory methods - Return objects of the specified value.
- ///
- static MDString *get(const char *StrBegin, const char *StrEnd);
- static MDString *get(const std::string &Str);
-
- /// size() - The length of this string.
- ///
- intptr_t size() const { return StrEnd - StrBegin; }
-
- /// begin() - Pointer to the first byte of the string.
- ///
- const char *begin() const { return StrBegin; }
-
- /// end() - Pointer to one byte past the end of the string.
- ///
- const char *end() const { return StrEnd; }
-
- /// getType() specialization - Type is always MetadataTy.
- ///
- inline const Type *getType() const {
- return Type::MetadataTy;
- }
-
- /// isNullValue - Return true if this is the value that would be returned by
- /// getNullValue. This always returns false because getNullValue will never
- /// produce metadata.
- virtual bool isNullValue() const {
- return false;
- }
-
- virtual void destroyConstant();
-
- /// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const MDString *) { return true; }
- static bool classof(const Value *V) {
- return V->getValueID() == MDStringVal;
- }
-};
-
} // End llvm namespace
#endif