mini-llvm 0.1.0
Loading...
Searching...
No Matches
BinaryIntegerArithmeticOperator.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2
3#pragma once
4
5#include <memory>
6#include <utility>
7
9#include "mini-llvm/ir/Type.h"
10#include "mini-llvm/ir/Value.h"
12
13namespace mini_llvm::ir {
14
16public:
17 std::unique_ptr<Type> type() const override {
18 return lhs()->type();
19 }
20
21 // x op y == y op x
22 virtual bool isCommutative() const = 0;
23
24 // (x op y) op z == x op (y op z)
25 virtual bool isAssociative() const = 0;
26
27 bool isWellFormed() const override;
28
29protected:
30 BinaryIntegerArithmeticOperator(std::shared_ptr<Value> lhs, std::shared_ptr<Value> rhs)
31 : BinaryIntegerOperator(std::move(lhs), std::move(rhs)) {}
32};
33
34} // namespace mini_llvm::ir
#define MINI_LLVM_EXPORT
Definition Compiler.h:17
std::unique_ptr< Type > type() const override
Definition BinaryIntegerArithmeticOperator.h:17
BinaryIntegerArithmeticOperator(std::shared_ptr< Value > lhs, std::shared_ptr< Value > rhs)
Definition BinaryIntegerArithmeticOperator.h:30
auto & lhs(this Self &&self)
Definition BinaryIntegerOperator.h:19
BinaryIntegerOperator(std::shared_ptr< Value > lhs, std::shared_ptr< Value > rhs)
Definition BinaryIntegerOperator.h:36
auto & rhs(this Self &&self)
Definition BinaryIntegerOperator.h:24
Definition Argument.h:13