mini-llvm 0.1.0
Loading...
Searching...
No Matches
I1.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2
3#pragma once
4
5#include <cstdint>
6#include <cstdlib>
7#include <memory>
8#include <string>
9#include <typeinfo>
10
12#include "mini-llvm/ir/Type.h"
16
17namespace mini_llvm::ir {
18
19class MINI_LLVM_EXPORT I1 final : public IntegerType {
20public:
21 int size() const override {
22 return 1;
23 }
24
25 int alignment() const override {
26 return 1;
27 }
28
29 int bitSize() const override {
30 return 1;
31 }
32
33 int bitAlignment() const override {
34 return 1;
35 }
36
37 std::unique_ptr<Constant> zeroValue() const override;
38 std::unique_ptr<Constant> constant(int64_t value) const override;
39
40 std::unique_ptr<Type> promoted() const override {
41 abort();
42 }
43
44 std::unique_ptr<Type> demoted() const override {
45 abort();
46 }
47
48 std::string format() const override {
49 return "i1";
50 }
51
52 std::unique_ptr<Type> clone() const override {
53 return std::make_unique<I1>();
54 }
55
56 void accept(TypeVisitor &visitor) override {
57 visitor.visitI1(*this);
58 }
59
60 void accept(TypeVisitor &visitor) const override {
61 visitor.visitI1(*this);
62 }
63
64protected:
65 bool equals(const Type &other) const override {
66 return typeid(*this) == typeid(other);
67 }
68};
69
70} // namespace mini_llvm::ir
#define MINI_LLVM_EXPORT
Definition Compiler.h:17
Definition I1.h:19
std::unique_ptr< Constant > constant(int64_t value) const override
std::unique_ptr< Type > demoted() const override
Definition I1.h:44
std::unique_ptr< Type > clone() const override
Definition I1.h:52
int alignment() const override
Definition I1.h:25
std::string format() const override
Definition I1.h:48
void accept(TypeVisitor &visitor) const override
Definition I1.h:60
bool equals(const Type &other) const override
Definition I1.h:65
int bitSize() const override
Definition I1.h:29
int bitAlignment() const override
Definition I1.h:33
int size() const override
Definition I1.h:21
void accept(TypeVisitor &visitor) override
Definition I1.h:56
std::unique_ptr< Type > promoted() const override
Definition I1.h:40
std::unique_ptr< Constant > zeroValue() const override
Definition IntegerType.h:10
Definition TypeVisitor.h:25
virtual void visitI1(I1 &type)
Definition TypeVisitor.h:42
Definition Type.h:18
Definition Argument.h:13