LLVM 20.0.0git
Operator.h
Go to the documentation of this file.
1//===- Operator.h -----------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_SANDBOXIR_OPERATOR_H
10#define LLVM_SANDBOXIR_OPERATOR_H
11
12#include "llvm/IR/Operator.h"
14#include "llvm/SandboxIR/User.h"
15
16namespace llvm::sandboxir {
17
18class Operator : public User {
19public:
20 // The Operator class is intended to be used as a utility, and is never itself
21 // instantiated.
22 Operator() = delete;
23 void *operator new(size_t s) = delete;
24
25 static bool classof(const Instruction *) { return true; }
26 static bool classof(const ConstantExpr *) { return true; }
27 static bool classof(const Value *From) {
28 return llvm::Operator::classof(From->Val);
29 }
31 return cast<llvm::Operator>(Val)->hasPoisonGeneratingFlags();
32 }
33};
34
36public:
37 bool hasNoUnsignedWrap() const {
38 return cast<llvm::OverflowingBinaryOperator>(Val)->hasNoUnsignedWrap();
39 }
40 bool hasNoSignedWrap() const {
41 return cast<llvm::OverflowingBinaryOperator>(Val)->hasNoSignedWrap();
42 }
43 unsigned getNoWrapKind() const {
44 return cast<llvm::OverflowingBinaryOperator>(Val)->getNoWrapKind();
45 }
46 static bool classof(const Instruction *From) {
48 cast<llvm::Instruction>(From->Val));
49 }
50 static bool classof(const ConstantExpr *From) {
52 cast<llvm::ConstantExpr>(From->Val));
53 }
54 static bool classof(const Value *From) {
56 }
57};
58
59class FPMathOperator : public Operator {
60public:
61 bool isFast() const { return cast<llvm::FPMathOperator>(Val)->isFast(); }
62 bool hasAllowReassoc() const {
63 return cast<llvm::FPMathOperator>(Val)->hasAllowReassoc();
64 }
65 bool hasNoNaNs() const {
66 return cast<llvm::FPMathOperator>(Val)->hasNoNaNs();
67 }
68 bool hasNoInfs() const {
69 return cast<llvm::FPMathOperator>(Val)->hasNoInfs();
70 }
71 bool hasNoSignedZeros() const {
72 return cast<llvm::FPMathOperator>(Val)->hasNoSignedZeros();
73 }
74 bool hasAllowReciprocal() const {
75 return cast<llvm::FPMathOperator>(Val)->hasAllowReciprocal();
76 }
77 bool hasAllowContract() const {
78 return cast<llvm::FPMathOperator>(Val)->hasAllowContract();
79 }
80 bool hasApproxFunc() const {
81 return cast<llvm::FPMathOperator>(Val)->hasApproxFunc();
82 }
84 return cast<llvm::FPMathOperator>(Val)->getFastMathFlags();
85 }
86 float getFPAccuracy() const {
87 return cast<llvm::FPMathOperator>(Val)->getFPAccuracy();
88 }
91 }
92 static bool classof(const Value *V) {
93 return llvm::FPMathOperator::classof(V->Val);
94 }
95};
96
97} // namespace llvm::sandboxir
98
99#endif // LLVM_SANDBOXIR_OPERATOR_H
BlockVerifier::State From
static bool classof(const Value *V)
Definition: Operator.h:354
static bool isSupportedFloatingPointType(Type *Ty)
Returns true if Ty is a supported floating-point type for phi, select, or call FPMathOperators.
Definition: Operator.h:349
Convenience struct for specifying and reasoning about fast-math flags.
Definition: FMF.h:20
static bool classof(const Instruction *)
Definition: Operator.h:58
static bool classof(const Instruction *I)
Definition: Operator.h:129
FastMathFlags getFastMathFlags() const
Definition: Operator.h:83
bool hasAllowReciprocal() const
Definition: Operator.h:74
static bool isSupportedFloatingPointType(Type *Ty)
Definition: Operator.h:89
static bool classof(const Value *V)
Definition: Operator.h:92
A sandboxir::User with operands, opcode and linked with previous/next instructions in an instruction ...
Definition: Instruction.h:42
bool hasPoisonGeneratingFlags() const
Definition: Operator.h:30
static bool classof(const Value *From)
Definition: Operator.h:27
static bool classof(const Instruction *)
Definition: Operator.h:25
static bool classof(const ConstantExpr *)
Definition: Operator.h:26
static bool classof(const ConstantExpr *From)
Definition: Operator.h:50
static bool classof(const Value *From)
Definition: Operator.h:54
static bool classof(const Instruction *From)
Definition: Operator.h:46
Just like llvm::Type these are immutable, unique, never get freed and can only be created via static ...
Definition: Type.h:43
llvm::Type * LLVMTy
Definition: Type.h:45
A sandboxir::User has operands.
Definition: User.h:58
A SandboxIR Value has users. This is the base class.
Definition: Value.h:63
llvm::Value * Val
The LLVM Value that corresponds to this SandboxIR Value.
Definition: Value.h:103