mini-llvm 0.1.0
Loading...
Searching...
No Matches
I8.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 I8 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 std::unique_ptr<Constant> zeroValue() const override;
30 std::unique_ptr<Constant> constant(int64_t value) const override;
31
32 std::unique_ptr<Type> promoted() const override;
33
34 std::unique_ptr<Type> demoted() const override {
35 abort();
36 }
37
38 std::string format() const override {
39 return "i8";
40 }
41
42 std::unique_ptr<Type> clone() const override {
43 return std::make_unique<I8>();
44 }
45
46 void accept(TypeVisitor &visitor) override {
47 visitor.visitI8(*this);
48 }
49
50 void accept(TypeVisitor &visitor) const override {
51 visitor.visitI8(*this);
52 }
53
54protected:
55 bool equals(const Type &other) const override {
56 return typeid(*this) == typeid(other);
57 }
58};
59
60} // namespace mini_llvm::ir
#define MINI_LLVM_EXPORT
Definition Compiler.h:17
Definition I8.h:19
std::unique_ptr< Type > clone() const override
Definition I8.h:42
bool equals(const Type &other) const override
Definition I8.h:55
std::string format() const override
Definition I8.h:38
std::unique_ptr< Constant > zeroValue() const override
int size() const override
Definition I8.h:21
std::unique_ptr< Type > promoted() const override
std::unique_ptr< Type > demoted() const override
Definition I8.h:34
void accept(TypeVisitor &visitor) const override
Definition I8.h:50
void accept(TypeVisitor &visitor) override
Definition I8.h:46
std::unique_ptr< Constant > constant(int64_t value) const override
int alignment() const override
Definition I8.h:25
Definition IntegerType.h:10
Definition TypeVisitor.h:25
virtual void visitI8(I8 &type)
Definition TypeVisitor.h:46
Definition Type.h:18
Definition Argument.h:13