mini-llvm 0.1.0
Loading...
Searching...
No Matches
And.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2
3#pragma once
4
5#include <memory>
6#include <string>
7#include <utility>
8
12#include "mini-llvm/ir/Value.h"
14
15namespace mini_llvm::ir {
16
18public:
19 And(std::shared_ptr<Value> lhs, std::shared_ptr<Value> rhs)
20 : BinaryIntegerArithmeticOperator(std::move(lhs), std::move(rhs)) {}
21
22 bool isCommutative() const override {
23 return true;
24 }
25
26 bool isAssociative() const override {
27 return true;
28 }
29
30 std::shared_ptr<Constant> fold() const override;
31
32 void accept(InstructionVisitor &visitor) override {
33 visitor.visitAnd(*this);
34 }
35
36 void accept(InstructionVisitor &visitor) const override {
37 visitor.visitAnd(*this);
38 }
39
40 std::string format() const override;
41 std::unique_ptr<Value> clone() const override;
42};
43
44} // namespace mini_llvm::ir
#define MINI_LLVM_EXPORT
Definition Compiler.h:17
std::shared_ptr< Constant > fold() const override
bool isCommutative() const override
Definition And.h:22
std::string format() const override
std::unique_ptr< Value > clone() const override
void accept(InstructionVisitor &visitor) const override
Definition And.h:36
void accept(InstructionVisitor &visitor) override
Definition And.h:32
And(std::shared_ptr< Value > lhs, std::shared_ptr< Value > rhs)
Definition And.h:19
bool isAssociative() const override
Definition And.h:26
BinaryIntegerArithmeticOperator(std::shared_ptr< Value > lhs, std::shared_ptr< Value > rhs)
Definition BinaryIntegerArithmeticOperator.h:30
auto & lhs(this Self &&self)
Definition BinaryIntegerOperator.h:19
auto & rhs(this Self &&self)
Definition BinaryIntegerOperator.h:24
Definition InstructionVisitor.h:58
virtual void visitAnd(And &I)
Definition InstructionVisitor.h:72
Definition Argument.h:13