+ /// isLogicalShift - Return true if this is a logical shift left or a logical
+ /// shift right.
+ inline bool isArithmeticShift() const {
+ return getOpcode() == AShr;
+ }
+
+ /// @brief Determine if the OpCode is one of the CastInst instructions.
+ static inline bool isCast(unsigned OpCode) {
+ return OpCode >= CastOpsBegin && OpCode < CastOpsEnd;
+ }
+
+ /// isAssociative - Return true if the instruction is associative:
+ ///
+ /// Associative operators satisfy: x op (y op z) === (x op y) op z
+ ///
+ /// In LLVM, the Add, Mul, And, Or, and Xor operators are associative, when
+ /// not applied to floating point types.
+ ///
+ bool isAssociative() const { return isAssociative(getOpcode(), getType()); }
+ static bool isAssociative(unsigned op, const Type *Ty);
+
+ /// isCommutative - Return true if the instruction is commutative:
+ ///
+ /// Commutative operators satisfy: (x op y) === (y op x)
+ ///
+ /// In LLVM, these are the associative operators, plus SetEQ and SetNE, when
+ /// applied to any type.
+ ///
+ bool isCommutative() const { return isCommutative(getOpcode()); }
+ static bool isCommutative(unsigned op);
+
+ /// isTrappingInstruction - Return true if the instruction may trap.
+ ///
+ bool isTrapping() const {
+ return isTrapping(getOpcode());
+ }
+ static bool isTrapping(unsigned op);
+
+ virtual void print(std::ostream &OS) const { print(OS, 0); }
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
+ void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const;
+
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const Instruction *) { return true; }
+ static inline bool classof(const Value *V) {
+ return V->getValueID() >= Value::InstructionVal;
+ }