Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:26

0001 //===- Operator.h -----------------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_SANDBOXIR_OPERATOR_H
0010 #define LLVM_SANDBOXIR_OPERATOR_H
0011 
0012 #include "llvm/IR/Operator.h"
0013 #include "llvm/SandboxIR/Instruction.h"
0014 #include "llvm/SandboxIR/User.h"
0015 
0016 namespace llvm::sandboxir {
0017 
0018 class Operator : public User {
0019 public:
0020   // The Operator class is intended to be used as a utility, and is never itself
0021   // instantiated.
0022   Operator() = delete;
0023   void *operator new(size_t s) = delete;
0024 
0025   static bool classof(const Instruction *) { return true; }
0026   static bool classof(const ConstantExpr *) { return true; }
0027   static bool classof(const Value *From) {
0028     return llvm::Operator::classof(From->Val);
0029   }
0030   bool hasPoisonGeneratingFlags() const {
0031     return cast<llvm::Operator>(Val)->hasPoisonGeneratingFlags();
0032   }
0033 };
0034 
0035 class OverflowingBinaryOperator : public Operator {
0036 public:
0037   bool hasNoUnsignedWrap() const {
0038     return cast<llvm::OverflowingBinaryOperator>(Val)->hasNoUnsignedWrap();
0039   }
0040   bool hasNoSignedWrap() const {
0041     return cast<llvm::OverflowingBinaryOperator>(Val)->hasNoSignedWrap();
0042   }
0043   unsigned getNoWrapKind() const {
0044     return cast<llvm::OverflowingBinaryOperator>(Val)->getNoWrapKind();
0045   }
0046   static bool classof(const Instruction *From) {
0047     return llvm::OverflowingBinaryOperator::classof(
0048         cast<llvm::Instruction>(From->Val));
0049   }
0050   static bool classof(const ConstantExpr *From) {
0051     return llvm::OverflowingBinaryOperator::classof(
0052         cast<llvm::ConstantExpr>(From->Val));
0053   }
0054   static bool classof(const Value *From) {
0055     return llvm::OverflowingBinaryOperator::classof(From->Val);
0056   }
0057 };
0058 
0059 class FPMathOperator : public Operator {
0060 public:
0061   bool isFast() const { return cast<llvm::FPMathOperator>(Val)->isFast(); }
0062   bool hasAllowReassoc() const {
0063     return cast<llvm::FPMathOperator>(Val)->hasAllowReassoc();
0064   }
0065   bool hasNoNaNs() const {
0066     return cast<llvm::FPMathOperator>(Val)->hasNoNaNs();
0067   }
0068   bool hasNoInfs() const {
0069     return cast<llvm::FPMathOperator>(Val)->hasNoInfs();
0070   }
0071   bool hasNoSignedZeros() const {
0072     return cast<llvm::FPMathOperator>(Val)->hasNoSignedZeros();
0073   }
0074   bool hasAllowReciprocal() const {
0075     return cast<llvm::FPMathOperator>(Val)->hasAllowReciprocal();
0076   }
0077   bool hasAllowContract() const {
0078     return cast<llvm::FPMathOperator>(Val)->hasAllowContract();
0079   }
0080   bool hasApproxFunc() const {
0081     return cast<llvm::FPMathOperator>(Val)->hasApproxFunc();
0082   }
0083   FastMathFlags getFastMathFlags() const {
0084     return cast<llvm::FPMathOperator>(Val)->getFastMathFlags();
0085   }
0086   float getFPAccuracy() const {
0087     return cast<llvm::FPMathOperator>(Val)->getFPAccuracy();
0088   }
0089   static bool isSupportedFloatingPointType(Type *Ty) {
0090     return llvm::FPMathOperator::isSupportedFloatingPointType(Ty->LLVMTy);
0091   }
0092   static bool classof(const Value *V) {
0093     return llvm::FPMathOperator::classof(V->Val);
0094   }
0095 };
0096 
0097 } // namespace llvm::sandboxir
0098 
0099 #endif // LLVM_SANDBOXIR_OPERATOR_H