mini-llvm
0.1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
RISCVMemoryOperand.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/mc/Operand.h
"
10
#include "
mini-llvm/targets/riscv/mc/RISCVRegister.h
"
11
12
namespace
mini_llvm::mc
{
13
14
class
RISCVMemoryOperand
final :
public
Operand
{
15
public
:
16
RISCVMemoryOperand
(
int
idx
, int64_t
offset
) : idx_(
idx
), offset_(
offset
) {}
17
18
int
idx
()
const
{
19
return
idx_;
20
}
21
22
void
setIdx
(
int
idx
) {
23
idx_ =
idx
;
24
}
25
26
int64_t
offset
()
const
{
27
return
offset_;
28
}
29
30
void
setOffset
(int64_t
offset
) {
31
offset_ =
offset
;
32
}
33
34
std::string
format
()
const override
{
35
return
std::format(
"{}({})"
,
offset
(),
name
(
static_cast<
RISCVRegister
>
(
idx
())));
36
}
37
38
private
:
39
int
idx_;
40
int64_t offset_;
41
};
42
43
}
// namespace mini_llvm::mc
Operand.h
mini_llvm::mc::Operand::Operand
Operand()=default
mini_llvm::mc::RISCVMemoryOperand::setIdx
void setIdx(int idx)
Definition
RISCVMemoryOperand.h:22
mini_llvm::mc::RISCVMemoryOperand::idx
int idx() const
Definition
RISCVMemoryOperand.h:18
mini_llvm::mc::RISCVMemoryOperand::setOffset
void setOffset(int64_t offset)
Definition
RISCVMemoryOperand.h:30
mini_llvm::mc::RISCVMemoryOperand::RISCVMemoryOperand
RISCVMemoryOperand(int idx, int64_t offset)
Definition
RISCVMemoryOperand.h:16
mini_llvm::mc::RISCVMemoryOperand::offset
int64_t offset() const
Definition
RISCVMemoryOperand.h:26
mini_llvm::mc::RISCVMemoryOperand::format
std::string format() const override
Definition
RISCVMemoryOperand.h:34
RISCVRegister.h
mini_llvm::mc
Definition
Directive.h:8
mini_llvm::mc::RISCVRegister
RISCVRegister
Definition
RISCVRegister.h:9
mini_llvm::mc::name
constexpr const char * name(RISCVRegister reg)
Definition
RISCVRegister.h:17
include
mini-llvm
targets
riscv
mc
RISCVMemoryOperand.h
Generated by
1.17.0