mini-llvm 0.1.0
Loading...
Searching...
No Matches
BinaryFloatingOperator.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2
3#pragma once
4
5#include <memory>
6#include <unordered_set>
7#include <utility>
8
10#include "mini-llvm/ir/Use.h"
11#include "mini-llvm/ir/Value.h"
13
14namespace mini_llvm::ir {
15
17public:
18 template <typename Self>
19 auto &lhs(this Self &&self) {
20 return self.lhs_;
21 }
22
23 template <typename Self>
24 auto &rhs(this Self &&self) {
25 return self.rhs_;
26 }
27
28 std::unordered_set<const UseBase *> operands() const override {
29 return {&lhs(), &rhs()};
30 }
31
32 bool isFoldable() const override;
33 bool isWellFormed() const override;
34
35protected:
36 BinaryFloatingOperator(std::shared_ptr<Value> lhs, std::shared_ptr<Value> rhs)
37 : lhs_(this, std::move(lhs)), rhs_(this, std::move(rhs)) {}
38
39private:
40 Use<Value> lhs_, rhs_;
41};
42
43} // namespace mini_llvm::ir
#define MINI_LLVM_EXPORT
Definition Compiler.h:17
bool isWellFormed() const override
auto & rhs(this Self &&self)
Definition BinaryFloatingOperator.h:24
auto & lhs(this Self &&self)
Definition BinaryFloatingOperator.h:19
BinaryFloatingOperator(std::shared_ptr< Value > lhs, std::shared_ptr< Value > rhs)
Definition BinaryFloatingOperator.h:36
std::unordered_set< const UseBase * > operands() const override
Definition BinaryFloatingOperator.h:28
Definition Instruction.h:22
Definition Use.h:44
Definition Argument.h:13