diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/libs/llvm12/include/llvm/IR/Constants.h | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/include/llvm/IR/Constants.h')
-rw-r--r-- | contrib/libs/llvm12/include/llvm/IR/Constants.h | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/contrib/libs/llvm12/include/llvm/IR/Constants.h b/contrib/libs/llvm12/include/llvm/IR/Constants.h index 284e4320cd..33bc771f8e 100644 --- a/contrib/libs/llvm12/include/llvm/IR/Constants.h +++ b/contrib/libs/llvm12/include/llvm/IR/Constants.h @@ -95,10 +95,10 @@ public: static ConstantInt *getTrue(LLVMContext &Context); static ConstantInt *getFalse(LLVMContext &Context); - static ConstantInt *getBool(LLVMContext &Context, bool V); + static ConstantInt *getBool(LLVMContext &Context, bool V); static Constant *getTrue(Type *Ty); static Constant *getFalse(Type *Ty); - static Constant *getBool(Type *Ty, bool V); + static Constant *getBool(Type *Ty, bool V); /// If Ty is a vector type, return a Constant with a splat of the given /// value. Otherwise return a ConstantInt for the given value. @@ -601,13 +601,13 @@ class ConstantDataSequential : public ConstantData { /// 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 /// the same StringMap bucket, linked up. - std::unique_ptr<ConstantDataSequential> Next; + std::unique_ptr<ConstantDataSequential> Next; void destroyConstantImpl(); protected: explicit ConstantDataSequential(Type *ty, ValueTy VT, const char *Data) - : ConstantData(ty, VT), DataElements(Data) {} + : ConstantData(ty, VT), DataElements(Data) {} static Constant *getImpl(StringRef Bytes, Type *Ty); @@ -897,42 +897,42 @@ struct OperandTraits<BlockAddress> : DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BlockAddress, Value) -/// Wrapper for a function that represents a value that -/// functionally represents the original function. This can be a function, -/// global alias to a function, or an ifunc. -class DSOLocalEquivalent final : public Constant { - friend class Constant; - - DSOLocalEquivalent(GlobalValue *GV); - - void *operator new(size_t s) { return User::operator new(s, 1); } - - void destroyConstantImpl(); - Value *handleOperandChangeImpl(Value *From, Value *To); - -public: - /// Return a DSOLocalEquivalent for the specified global value. - static DSOLocalEquivalent *get(GlobalValue *GV); - - /// Transparently provide more efficient getOperand methods. - DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); - - GlobalValue *getGlobalValue() const { - return cast<GlobalValue>(Op<0>().get()); - } - - /// Methods for support type inquiry through isa, cast, and dyn_cast: - static bool classof(const Value *V) { - return V->getValueID() == DSOLocalEquivalentVal; - } -}; - -template <> -struct OperandTraits<DSOLocalEquivalent> - : public FixedNumOperandTraits<DSOLocalEquivalent, 1> {}; - -DEFINE_TRANSPARENT_OPERAND_ACCESSORS(DSOLocalEquivalent, Value) - +/// Wrapper for a function that represents a value that +/// functionally represents the original function. This can be a function, +/// global alias to a function, or an ifunc. +class DSOLocalEquivalent final : public Constant { + friend class Constant; + + DSOLocalEquivalent(GlobalValue *GV); + + void *operator new(size_t s) { return User::operator new(s, 1); } + + void destroyConstantImpl(); + Value *handleOperandChangeImpl(Value *From, Value *To); + +public: + /// Return a DSOLocalEquivalent for the specified global value. + static DSOLocalEquivalent *get(GlobalValue *GV); + + /// Transparently provide more efficient getOperand methods. + DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); + + GlobalValue *getGlobalValue() const { + return cast<GlobalValue>(Op<0>().get()); + } + + /// Methods for support type inquiry through isa, cast, and dyn_cast: + static bool classof(const Value *V) { + return V->getValueID() == DSOLocalEquivalentVal; + } +}; + +template <> +struct OperandTraits<DSOLocalEquivalent> + : public FixedNumOperandTraits<DSOLocalEquivalent, 1> {}; + +DEFINE_TRANSPARENT_OPERAND_ACCESSORS(DSOLocalEquivalent, Value) + //===----------------------------------------------------------------------===// /// A constant value that is initialized with an expression using /// other constant values. @@ -1003,7 +1003,7 @@ public: static Constant *getAnd(Constant *C1, Constant *C2); static Constant *getOr(Constant *C1, Constant *C2); static Constant *getXor(Constant *C1, Constant *C2); - static Constant *getUMin(Constant *C1, Constant *C2); + static Constant *getUMin(Constant *C1, Constant *C2); static Constant *getShl(Constant *C1, Constant *C2, bool HasNUW = false, bool HasNSW = false); static Constant *getLShr(Constant *C1, Constant *C2, bool isExact = false); @@ -1079,12 +1079,12 @@ public: return getLShr(C1, C2, true); } - /// If C is a scalar/fixed width vector of known powers of 2, then this - /// function returns a new scalar/fixed width vector obtained from logBase2 - /// of C. Undef vector elements are set to zero. - /// Return a null pointer otherwise. - static Constant *getExactLogBase2(Constant *C); - + /// If C is a scalar/fixed width vector of known powers of 2, then this + /// function returns a new scalar/fixed width vector obtained from logBase2 + /// of C. Undef vector elements are set to zero. + /// Return a null pointer otherwise. + static Constant *getExactLogBase2(Constant *C); + /// Return the identity constant for a binary opcode. /// The identity constant C is defined as X op C = X and C op X = X for every /// X when the binary operation is commutative. If the binop is not @@ -1357,16 +1357,16 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ConstantExpr, Constant) /// can appear to have different bit patterns at each use. See /// LangRef.html#undefvalues for details. /// -class UndefValue : public ConstantData { +class UndefValue : public ConstantData { friend class Constant; explicit UndefValue(Type *T) : ConstantData(T, UndefValueVal) {} void destroyConstantImpl(); -protected: - explicit UndefValue(Type *T, ValueTy vty) : ConstantData(T, vty) {} - +protected: + explicit UndefValue(Type *T, ValueTy vty) : ConstantData(T, vty) {} + public: UndefValue(const UndefValue &) = delete; @@ -1393,52 +1393,52 @@ public: /// Methods for support type inquiry through isa, cast, and dyn_cast: static bool classof(const Value *V) { - return V->getValueID() == UndefValueVal || - V->getValueID() == PoisonValueVal; - } -}; - -//===----------------------------------------------------------------------===// -/// In order to facilitate speculative execution, many instructions do not -/// invoke immediate undefined behavior when provided with illegal operands, -/// and return a poison value instead. -/// -/// see LangRef.html#poisonvalues for details. -/// -class PoisonValue final : public UndefValue { - friend class Constant; - - explicit PoisonValue(Type *T) : UndefValue(T, PoisonValueVal) {} - - void destroyConstantImpl(); - -public: - PoisonValue(const PoisonValue &) = delete; - - /// Static factory methods - Return an 'poison' object of the specified type. - static PoisonValue *get(Type *T); - - /// If this poison has array or vector type, return a poison with the right - /// element type. - PoisonValue *getSequentialElement() const; - - /// If this poison has struct type, return a poison with the right element - /// type for the specified element. - PoisonValue *getStructElement(unsigned Elt) const; - - /// Return an poison of the right value for the specified GEP index if we can, - /// otherwise return null (e.g. if C is a ConstantExpr). - PoisonValue *getElementValue(Constant *C) const; - - /// Return an poison of the right value for the specified GEP index. - PoisonValue *getElementValue(unsigned Idx) const; - - /// Methods for support type inquiry through isa, cast, and dyn_cast: - static bool classof(const Value *V) { - return V->getValueID() == PoisonValueVal; + return V->getValueID() == UndefValueVal || + V->getValueID() == PoisonValueVal; } }; +//===----------------------------------------------------------------------===// +/// In order to facilitate speculative execution, many instructions do not +/// invoke immediate undefined behavior when provided with illegal operands, +/// and return a poison value instead. +/// +/// see LangRef.html#poisonvalues for details. +/// +class PoisonValue final : public UndefValue { + friend class Constant; + + explicit PoisonValue(Type *T) : UndefValue(T, PoisonValueVal) {} + + void destroyConstantImpl(); + +public: + PoisonValue(const PoisonValue &) = delete; + + /// Static factory methods - Return an 'poison' object of the specified type. + static PoisonValue *get(Type *T); + + /// If this poison has array or vector type, return a poison with the right + /// element type. + PoisonValue *getSequentialElement() const; + + /// If this poison has struct type, return a poison with the right element + /// type for the specified element. + PoisonValue *getStructElement(unsigned Elt) const; + + /// Return an poison of the right value for the specified GEP index if we can, + /// otherwise return null (e.g. if C is a ConstantExpr). + PoisonValue *getElementValue(Constant *C) const; + + /// Return an poison of the right value for the specified GEP index. + PoisonValue *getElementValue(unsigned Idx) const; + + /// Methods for support type inquiry through isa, cast, and dyn_cast: + static bool classof(const Value *V) { + return V->getValueID() == PoisonValueVal; + } +}; + } // end namespace llvm #endif // LLVM_IR_CONSTANTS_H |