mini-llvm
0.1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
I16.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
3
#pragma once
4
5
#include <cstdint>
6
#include <memory>
7
#include <string>
8
#include <typeinfo>
9
10
#include "
mini-llvm/ir/Constant.h
"
11
#include "
mini-llvm/ir/Type.h
"
12
#include "
mini-llvm/ir/Type/IntegerType.h
"
13
#include "
mini-llvm/ir/TypeVisitor.h
"
14
#include "
mini-llvm/utils/Compiler.h
"
15
16
namespace
mini_llvm::ir
{
17
18
class
MINI_LLVM_EXPORT
I16
final :
public
IntegerType
{
19
public
:
20
int
size
()
const override
{
21
return
2;
22
}
23
24
int
alignment
()
const override
{
25
return
2;
26
}
27
28
std::unique_ptr<Constant>
zeroValue
()
const override
;
29
std::unique_ptr<Constant>
constant
(int64_t value)
const override
;
30
31
std::unique_ptr<Type>
promoted
()
const override
;
32
std::unique_ptr<Type>
demoted
()
const override
;
33
34
std::string
format
()
const override
{
35
return
"i16"
;
36
}
37
38
std::unique_ptr<Type>
clone
()
const override
{
39
return
std::make_unique<I16>();
40
}
41
42
void
accept
(
TypeVisitor
&visitor)
override
{
43
visitor.
visitI16
(*
this
);
44
}
45
46
void
accept
(
TypeVisitor
&visitor)
const override
{
47
visitor.
visitI16
(*
this
);
48
}
49
50
protected
:
51
bool
equals
(
const
Type
&other)
const override
{
52
return
typeid
(*this) ==
typeid
(other);
53
}
54
};
55
56
}
// namespace mini_llvm::ir
Compiler.h
MINI_LLVM_EXPORT
#define MINI_LLVM_EXPORT
Definition
Compiler.h:17
IntegerType.h
TypeVisitor.h
Type.h
mini_llvm::ir::I16
Definition
I16.h:18
mini_llvm::ir::I16::equals
bool equals(const Type &other) const override
Definition
I16.h:51
mini_llvm::ir::I16::size
int size() const override
Definition
I16.h:20
mini_llvm::ir::I16::accept
void accept(TypeVisitor &visitor) override
Definition
I16.h:42
mini_llvm::ir::I16::promoted
std::unique_ptr< Type > promoted() const override
mini_llvm::ir::I16::format
std::string format() const override
Definition
I16.h:34
mini_llvm::ir::I16::alignment
int alignment() const override
Definition
I16.h:24
mini_llvm::ir::I16::demoted
std::unique_ptr< Type > demoted() const override
mini_llvm::ir::I16::accept
void accept(TypeVisitor &visitor) const override
Definition
I16.h:46
mini_llvm::ir::I16::zeroValue
std::unique_ptr< Constant > zeroValue() const override
mini_llvm::ir::I16::constant
std::unique_ptr< Constant > constant(int64_t value) const override
mini_llvm::ir::I16::clone
std::unique_ptr< Type > clone() const override
Definition
I16.h:38
mini_llvm::ir::IntegerType
Definition
IntegerType.h:10
mini_llvm::ir::TypeVisitor
Definition
TypeVisitor.h:25
mini_llvm::ir::TypeVisitor::visitI16
virtual void visitI16(I16 &type)
Definition
TypeVisitor.h:43
mini_llvm::ir::Type
Definition
Type.h:18
Constant.h
mini_llvm::ir
Definition
Argument.h:13
include
mini-llvm
ir
Type
I16.h
Generated by
1.17.0