X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;ds=sidebyside;f=include%2Fllvm%2FIR%2FConstants.h;h=ed7a70f773ea1f1cc8385e7fa3e4c11656aac8c7;hb=36b699f2b139a30a2dfa4448223d6985b55daa8a;hp=3aedb00cf6f70cb11134d5e4d32a932feb537c7e;hpb=974a445bd90795248274493eda5cdbf6721910f7;p=oota-llvm.git diff --git a/include/llvm/IR/Constants.h b/include/llvm/IR/Constants.h index 3aedb00cf6f..ed7a70f773e 100644 --- a/include/llvm/IR/Constants.h +++ b/include/llvm/IR/Constants.h @@ -49,7 +49,7 @@ struct ConvertConstantType; /// represents both boolean and integral constants. /// @brief Class for constant integers. class ConstantInt : public Constant { - virtual void anchor(); + void anchor() override; void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; ConstantInt(const ConstantInt &) LLVM_DELETED_FUNCTION; ConstantInt(IntegerType *Ty, const APInt& V); @@ -231,7 +231,7 @@ public: /// class ConstantFP : public Constant { APFloat Val; - virtual void anchor(); + void anchor() override; void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; ConstantFP(const ConstantFP &) LLVM_DELETED_FUNCTION; friend class LLVMContextImpl; @@ -255,8 +255,8 @@ public: static Constant *get(Type* Ty, double V); static Constant *get(Type* Ty, StringRef Str); static ConstantFP *get(LLVMContext &Context, const APFloat &V); - static ConstantFP *getNegativeZero(Type* Ty); - static ConstantFP *getInfinity(Type *Ty, bool Negative = false); + static Constant *getNegativeZero(Type *Ty); + static Constant *getInfinity(Type *Ty, bool Negative = false); /// isValueValidForType - return true if Ty is big enough to represent V. static bool isValueValidForType(Type *Ty, const APFloat &V); @@ -308,7 +308,7 @@ protected: public: static ConstantAggregateZero *get(Type *Ty); - virtual void destroyConstant(); + void destroyConstant() override; /// getSequentialElement - If this CAZ has array or vector type, return a zero /// with the right element type. @@ -356,8 +356,8 @@ public: return cast(Value::getType()); } - virtual void destroyConstant(); - virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); + void destroyConstant() override; + void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) override; /// Methods for support type inquiry through isa, cast, and dyn_cast: static bool classof(const Value *V) { @@ -414,8 +414,8 @@ public: return cast(Value::getType()); } - virtual void destroyConstant(); - virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); + void destroyConstant() override; + void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) override; /// Methods for support type inquiry through isa, cast, and dyn_cast: static bool classof(const Value *V) { @@ -461,8 +461,8 @@ public: /// elements have the same value, return that value. Otherwise return NULL. Constant *getSplatValue() const; - virtual void destroyConstant(); - virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); + void destroyConstant() override; + void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) override; /// Methods for support type inquiry through isa, cast, and dyn_cast: static bool classof(const Value *V) { @@ -497,7 +497,7 @@ public: /// get() - Static factory methods - Return objects of the specified value static ConstantPointerNull *get(PointerType *T); - virtual void destroyConstant(); + void destroyConstant() override; /// getType - Specialize the getType() method to always return an PointerType, /// which reduces the amount of casting needed in parts of the compiler. @@ -624,7 +624,7 @@ public: /// host endianness of the data elements. StringRef getRawDataValues() const; - virtual void destroyConstant(); + void destroyConstant() override; /// Methods for support type inquiry through isa, cast, and dyn_cast: /// @@ -645,7 +645,7 @@ private: class ConstantDataArray : public ConstantDataSequential { void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; ConstantDataArray(const ConstantDataArray &) LLVM_DELETED_FUNCTION; - virtual void anchor(); + void anchor() override; friend class ConstantDataSequential; explicit ConstantDataArray(Type *ty, const char *Data) : ConstantDataSequential(ty, ConstantDataArrayVal, Data) {} @@ -697,7 +697,7 @@ public: class ConstantDataVector : public ConstantDataSequential { void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION; ConstantDataVector(const ConstantDataVector &) LLVM_DELETED_FUNCTION; - virtual void anchor(); + void anchor() override; friend class ConstantDataSequential; explicit ConstantDataVector(Type *ty, const char *Data) : ConstantDataSequential(ty, ConstantDataVectorVal, Data) {} @@ -757,14 +757,20 @@ public: /// block must be embedded into a function. static BlockAddress *get(BasicBlock *BB); + /// \brief Lookup an existing \c BlockAddress constant for the given + /// BasicBlock. + /// + /// \returns 0 if \c !BB->hasAddressTaken(), otherwise the \c BlockAddress. + static BlockAddress *lookup(const BasicBlock *BB); + /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); Function *getFunction() const { return (Function*)Op<0>().get(); } BasicBlock *getBasicBlock() const { return (BasicBlock*)Op<1>().get(); } - virtual void destroyConstant(); - virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); + void destroyConstant() override; + void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) override; /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const Value *V) { @@ -1093,8 +1099,8 @@ public: /// would make it harder to remove ConstantExprs altogether. Instruction *getAsInstruction(); - virtual void destroyConstant(); - virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); + void destroyConstant() override; + void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) override; /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const Value *V) { @@ -1158,7 +1164,7 @@ public: /// index. UndefValue *getElementValue(unsigned Idx) const; - virtual void destroyConstant(); + void destroyConstant() override; /// Methods for support type inquiry through isa, cast, and dyn_cast: static bool classof(const Value *V) {