mini-llvm
0.1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
I64Constant.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
3
#pragma once
4
5
#include <cstdint>
6
#include <format>
7
#include <string>
8
9
#include "
mini-llvm/mir/Constant.h
"
10
#include "
mini-llvm/mir/ConstantVisitor.h
"
11
12
namespace
mini_llvm::mir
{
13
14
class
I64Constant
final :
public
Constant
{
15
public
:
16
explicit
I64Constant
(int64_t
value
) : value_(
value
) {}
17
18
int64_t
value
()
const
{
19
return
value_;
20
}
21
22
void
setValue
(int64_t
value
) {
23
value_ =
value
;
24
}
25
26
int
size
()
const override
{
27
return
4;
28
}
29
30
std::string
format
()
const override
{
31
return
std::format(
"i64 {}"
,
value
());
32
}
33
34
void
accept
(
ConstantVisitor
&visitor)
override
{
35
visitor.
visitI64Constant
(*
this
);
36
}
37
38
void
accept
(
ConstantVisitor
&visitor)
const override
{
39
visitor.
visitI64Constant
(*
this
);
40
}
41
42
private
:
43
int64_t value_;
44
};
45
46
}
// namespace mini_llvm::mir
mini_llvm::mir::ConstantVisitor
Definition
ConstantVisitor.h:24
mini_llvm::mir::ConstantVisitor::visitI64Constant
virtual void visitI64Constant(I64Constant &C)
Definition
ConstantVisitor.h:41
mini_llvm::mir::Constant::Constant
Constant()=default
mini_llvm::mir::I64Constant::size
int size() const override
Definition
I64Constant.h:26
mini_llvm::mir::I64Constant::format
std::string format() const override
Definition
I64Constant.h:30
mini_llvm::mir::I64Constant::accept
void accept(ConstantVisitor &visitor) const override
Definition
I64Constant.h:38
mini_llvm::mir::I64Constant::value
int64_t value() const
Definition
I64Constant.h:18
mini_llvm::mir::I64Constant::I64Constant
I64Constant(int64_t value)
Definition
I64Constant.h:16
mini_llvm::mir::I64Constant::setValue
void setValue(int64_t value)
Definition
I64Constant.h:22
mini_llvm::mir::I64Constant::accept
void accept(ConstantVisitor &visitor) override
Definition
I64Constant.h:34
ConstantVisitor.h
Constant.h
mini_llvm::mir
Definition
BasicBlock.h:22
include
mini-llvm
mir
Constant
I64Constant.h
Generated by
1.17.0