mini-llvm 0.1.0
Loading...
Searching...
No Matches
FloatingToIntegerCastingOperator.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/Type.h"
12#include "mini-llvm/ir/Use.h"
13#include "mini-llvm/ir/Value.h"
15
16namespace mini_llvm::ir {
17
19public:
20 template <typename Self>
21 auto &value(this Self &&self) {
22 return self.value_;
23 }
24
25 std::unique_ptr<Type> type() const override {
26 return type_->clone();
27 }
28
29 std::unordered_set<const UseBase *> operands() const override {
30 return {&value()};
31 }
32
33 bool isFoldable() const override;
34 bool isWellFormed() const override;
35
36protected:
37 FloatingToIntegerCastingOperator(std::shared_ptr<Value> value, std::unique_ptr<IntegerType> type)
38 : value_(this, std::move(value)), type_(std::move(type)) {}
39
40private:
41 Use<Value> value_;
42 std::unique_ptr<IntegerType> type_;
43};
44
45} // namespace mini_llvm::ir
#define MINI_LLVM_EXPORT
Definition Compiler.h:17
std::unordered_set< const UseBase * > operands() const override
Definition FloatingToIntegerCastingOperator.h:29
FloatingToIntegerCastingOperator(std::shared_ptr< Value > value, std::unique_ptr< IntegerType > type)
Definition FloatingToIntegerCastingOperator.h:37
std::unique_ptr< Type > type() const override
Definition FloatingToIntegerCastingOperator.h:25
auto & value(this Self &&self)
Definition FloatingToIntegerCastingOperator.h:21
Definition Instruction.h:22
Definition Use.h:44
Definition Argument.h:13