diff options
Diffstat (limited to 'llvm/include/llvm/IR/PatternMatch.h')
-rw-r--r-- | llvm/include/llvm/IR/PatternMatch.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/include/llvm/IR/PatternMatch.h b/llvm/include/llvm/IR/PatternMatch.h index 3072bb5a240..bb225443848 100644 --- a/llvm/include/llvm/IR/PatternMatch.h +++ b/llvm/include/llvm/IR/PatternMatch.h @@ -339,6 +339,14 @@ template <typename Predicate> struct api_pred_ty : public Predicate { } }; +struct is_negative { + bool isValue(const APInt &C) { return C.isNegative(); } +}; + +/// \brief Match an integer or vector of negative values. +inline cst_pred_ty<is_negative> m_Negative() { return cst_pred_ty<is_negative>(); } +inline api_pred_ty<is_negative> m_Negative(const APInt *&V) { return V; } + struct is_power2 { bool isValue(const APInt &C) { return C.isPowerOf2(); } }; |