mini-llvm
0.1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Operand.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
3
#pragma once
4
5
#include <concepts>
6
#include <format>
7
#include <string>
8
9
#include "
mini-llvm/utils/Compiler.h
"
10
11
namespace
mini_llvm::mc
{
12
13
class
MINI_LLVM_EXPORT
Operand
{
14
public
:
15
virtual
~Operand
() =
default
;
16
17
Operand
() =
default
;
18
19
Operand
(
const
Operand
&) =
delete
;
20
Operand
&
operator=
(
const
Operand
&) =
delete
;
21
22
Operand
(
Operand
&&) =
delete
;
23
Operand
&
operator=
(
Operand
&&) =
delete
;
24
25
virtual
std::string
format
()
const
= 0;
26
};
27
28
}
// namespace mini_llvm::mc
29
30
template
<
typename
OperandT>
31
requires
std::derived_from<OperandT, mini_llvm::mc::Operand>
32
struct
std::formatter<OperandT> {
33
constexpr
auto
parse
(std::format_parse_context &ctx) {
34
return
ctx.begin();
35
}
36
37
template
<
typename
FormatContext>
38
auto
format
(
const
OperandT &operand, FormatContext &ctx)
const
{
39
return
std::format_to(ctx.out(),
"{}"
, operand.format());
40
}
41
};
Compiler.h
MINI_LLVM_EXPORT
#define MINI_LLVM_EXPORT
Definition
Compiler.h:17
mini_llvm::mc::Operand::Operand
Operand()=default
mini_llvm::mc::Operand::operator=
Operand & operator=(Operand &&)=delete
mini_llvm::mc::Operand::format
virtual std::string format() const =0
mini_llvm::mc::Operand::operator=
Operand & operator=(const Operand &)=delete
mini_llvm::mc::Operand::Operand
Operand(const Operand &)=delete
mini_llvm::mc::Operand::Operand
Operand(Operand &&)=delete
mini_llvm::mc::Operand::~Operand
virtual ~Operand()=default
mini_llvm::mc
Definition
Directive.h:8
std::formatter< OperandT >::format
auto format(const OperandT &operand, FormatContext &ctx) const
Definition
Operand.h:38
std::formatter< OperandT >::parse
constexpr auto parse(std::format_parse_context &ctx)
Definition
Operand.h:33
include
mini-llvm
mc
Operand.h
Generated by
1.17.0