mini-llvm
0.1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Marker.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
3
#pragma once
4
5
#include <format>
6
#include <memory>
7
#include <string>
8
#include <unordered_set>
9
10
#include "
mini-llvm/mir/ImmediateOperand.h
"
11
#include "
mini-llvm/mir/Instruction.h
"
12
#include "
mini-llvm/mir/InstructionVisitor.h
"
13
#include "
mini-llvm/mir/MemoryOperand.h
"
14
#include "
mini-llvm/mir/RegisterOperand.h
"
15
#include "
mini-llvm/utils/Compiler.h
"
16
17
namespace
mini_llvm::mir
{
18
19
class
MINI_LLVM_EXPORT
Marker
:
public
Instruction
{
20
public
:
21
explicit
Marker
(
int
id
) : id_(
id
) {}
22
23
int
id
()
const
{
24
return
id_;
25
}
26
27
std::unordered_set<const RegisterOperand *>
regOps
()
const override
{
28
return
{};
29
}
30
31
std::unordered_set<const RegisterOperand *>
dsts
()
const override
{
32
return
{};
33
}
34
35
std::unordered_set<const RegisterOperand *>
srcs
()
const override
{
36
return
{};
37
}
38
39
std::unordered_set<const ImmediateOperand *>
immOps
()
const override
{
40
return
{};
41
}
42
43
std::unordered_set<const MemoryOperand *>
memOps
()
const override
{
44
return
{};
45
}
46
47
bool
hasSideEffects
()
const override
{
48
return
true
;
49
}
50
51
std::string
format
()
const override
{
52
return
std::format(
"MARKER {}"
,
id
());
53
}
54
55
std::unique_ptr<Instruction>
clone
()
const override
{
56
return
std::make_unique<Marker>(
id
());
57
}
58
59
void
accept
(
InstructionVisitor
&visitor)
override
{
60
visitor.
visitMarker
(*
this
);
61
}
62
63
void
accept
(
InstructionVisitor
&visitor)
const override
{
64
visitor.
visitMarker
(*
this
);
65
}
66
67
private
:
68
int
id_;
69
};
70
71
}
// namespace mini_llvm::mir
Compiler.h
MINI_LLVM_EXPORT
#define MINI_LLVM_EXPORT
Definition
Compiler.h:17
ImmediateOperand.h
MemoryOperand.h
RegisterOperand.h
mini_llvm::mir::InstructionVisitor
Definition
InstructionVisitor.h:70
mini_llvm::mir::InstructionVisitor::visitMarker
virtual void visitMarker(Marker &I)
Definition
InstructionVisitor.h:116
mini_llvm::mir::Instruction::Instruction
Instruction()=default
mini_llvm::mir::Marker::srcs
std::unordered_set< const RegisterOperand * > srcs() const override
Definition
Marker.h:35
mini_llvm::mir::Marker::hasSideEffects
bool hasSideEffects() const override
Definition
Marker.h:47
mini_llvm::mir::Marker::format
std::string format() const override
Definition
Marker.h:51
mini_llvm::mir::Marker::id
int id() const
Definition
Marker.h:23
mini_llvm::mir::Marker::Marker
Marker(int id)
Definition
Marker.h:21
mini_llvm::mir::Marker::dsts
std::unordered_set< const RegisterOperand * > dsts() const override
Definition
Marker.h:31
mini_llvm::mir::Marker::accept
void accept(InstructionVisitor &visitor) override
Definition
Marker.h:59
mini_llvm::mir::Marker::memOps
std::unordered_set< const MemoryOperand * > memOps() const override
Definition
Marker.h:43
mini_llvm::mir::Marker::clone
std::unique_ptr< Instruction > clone() const override
Definition
Marker.h:55
mini_llvm::mir::Marker::immOps
std::unordered_set< const ImmediateOperand * > immOps() const override
Definition
Marker.h:39
mini_llvm::mir::Marker::accept
void accept(InstructionVisitor &visitor) const override
Definition
Marker.h:63
mini_llvm::mir::Marker::regOps
std::unordered_set< const RegisterOperand * > regOps() const override
Definition
Marker.h:27
InstructionVisitor.h
Instruction.h
mini_llvm::mir
Definition
BasicBlock.h:22
include
mini-llvm
mir
Instruction
Marker.h
Generated by
1.17.0