X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FConstants.h;h=a9a18d7930f3481bbc4e45268d86929ed36cc0e0;hb=b834a7b73ce0dcf8fbf8d8b0d62f69e4b78059ad;hp=12777025c6db66e5183bc988eaa65589069b8e1c;hpb=23c8046a84af0cef7bdeeb2af3313821d274b974;p=oota-llvm.git diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index 12777025c6d..a9a18d7930f 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -50,6 +50,7 @@ class ConstantInt : public Constant { ConstantInt(const ConstantInt &); // DO NOT IMPLEMENT ConstantInt(const IntegerType *Ty, const APInt& V); APInt Val; + friend class LLVMContextImpl; protected: // allocate space for exactly zero operands void *operator new(size_t s) { @@ -92,20 +93,6 @@ public: 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); - } - - /// 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. - static ConstantInt *get(const APInt &V); - /// getType - Specialize the getType() method to always return an IntegerType, /// which reduces the amount of casting needed in parts of the compiler. /// @@ -203,9 +190,6 @@ public: static bool classof(const Value *V) { return V->getValueID() == ConstantIntVal; } - static void ResetTrueFalse() { TheTrueVal = TheFalseVal = 0; } -private: - static ConstantInt *CreateTrueFalseVals(bool WhichOne); }; @@ -216,6 +200,7 @@ class ConstantFP : public Constant { 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: @@ -224,9 +209,6 @@ 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; } @@ -282,10 +264,6 @@ protected: 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; } @@ -308,17 +286,10 @@ class ConstantArray : public Constant { friend struct ConstantCreator >; ConstantArray(const ConstantArray &); // DO NOT IMPLEMENT + friend class LLVMContextImpl; protected: ConstantArray(const ArrayType *T, const std::vector &Val); public: - /// get() - Static factory methods - Return objects of the specified value - static Constant *get(const ArrayType *T, const std::vector &); - static Constant *get(const ArrayType *T, - Constant*const*Vals, unsigned NumVals) { - // FIXME: make this the primary ctor method. - return get(T, std::vector(Vals, Vals+NumVals)); - } - /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant); @@ -424,11 +395,6 @@ protected: public: /// get() - Static factory methods - Return objects of the specified value static Constant *get(const VectorType *T, const std::vector &); - static Constant *get(const std::vector &V); - static Constant *get(Constant*const* Vals, unsigned NumVals) { - // FIXME: make this the primary ctor method. - return get(std::vector(Vals, Vals+NumVals)); - } /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant); @@ -749,62 +715,6 @@ public: 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