mini-llvm
0.1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Neg.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
3
#pragma once
4
5
#include <memory>
6
#include <utility>
7
8
#include "
mini-llvm/common/ExtensionMode.h
"
9
#include "
mini-llvm/mir/Instruction.h
"
10
#include "
mini-llvm/mir/Instruction/UnaryOperator.h
"
11
#include "
mini-llvm/mir/InstructionVisitor.h
"
12
#include "
mini-llvm/mir/Register.h
"
13
#include "
mini-llvm/utils/Compiler.h
"
14
#include "
mini-llvm/utils/Memory.h
"
15
16
namespace
mini_llvm::mir
{
17
18
class
MINI_LLVM_EXPORT
Neg
:
public
UnaryOperator
{
19
public
:
20
Neg
(
int
width
,
21
std::shared_ptr<Register>
dst
,
22
std::shared_ptr<Register>
src
,
23
ExtensionMode
extMode
=
ExtensionMode::kNo
)
24
:
UnaryOperator
(
width
, std::move(
dst
), std::move(
src
),
extMode
) {}
25
26
bool
hasSideEffects
()
const override
{
27
return
false
;
28
}
29
30
std::unique_ptr<Instruction>
clone
()
const override
{
31
return
std::make_unique<Neg>(
32
width
(),
share
(*
dst
()),
share
(*
src
()),
extMode
());
33
}
34
35
void
accept
(
InstructionVisitor
&visitor)
override
{
36
visitor.
visitNeg
(*
this
);
37
}
38
39
void
accept
(
InstructionVisitor
&visitor)
const override
{
40
visitor.
visitNeg
(*
this
);
41
}
42
43
protected
:
44
const
char
*
mnemonic
()
const override
{
45
return
"NEG"
;
46
}
47
};
48
49
}
// namespace mini_llvm::mir
Compiler.h
MINI_LLVM_EXPORT
#define MINI_LLVM_EXPORT
Definition
Compiler.h:17
ExtensionMode.h
Memory.h
Register.h
UnaryOperator.h
mini_llvm::mir::InstructionVisitor
Definition
InstructionVisitor.h:70
mini_llvm::mir::InstructionVisitor::visitNeg
virtual void visitNeg(Neg &I)
Definition
InstructionVisitor.h:119
mini_llvm::mir::Neg::accept
void accept(InstructionVisitor &visitor) override
Definition
Neg.h:35
mini_llvm::mir::Neg::clone
std::unique_ptr< Instruction > clone() const override
Definition
Neg.h:30
mini_llvm::mir::Neg::accept
void accept(InstructionVisitor &visitor) const override
Definition
Neg.h:39
mini_llvm::mir::Neg::Neg
Neg(int width, std::shared_ptr< Register > dst, std::shared_ptr< Register > src, ExtensionMode extMode=ExtensionMode::kNo)
Definition
Neg.h:20
mini_llvm::mir::Neg::mnemonic
const char * mnemonic() const override
Definition
Neg.h:44
mini_llvm::mir::Neg::hasSideEffects
bool hasSideEffects() const override
Definition
Neg.h:26
mini_llvm::mir::UnaryOperator::extMode
ExtensionMode extMode() const
Definition
UnaryOperator.h:37
mini_llvm::mir::UnaryOperator::src
auto & src(this Self &&self)
Definition
UnaryOperator.h:33
mini_llvm::mir::UnaryOperator::UnaryOperator
UnaryOperator(int width, std::shared_ptr< Register > dst, std::shared_ptr< Register > src, ExtensionMode extMode)
Definition
UnaryOperator.h:64
mini_llvm::mir::UnaryOperator::width
int width() const
Definition
UnaryOperator.h:23
mini_llvm::mir::UnaryOperator::dst
auto & dst(this Self &&self)
Definition
UnaryOperator.h:28
InstructionVisitor.h
Instruction.h
mini_llvm::mir
Definition
BasicBlock.h:22
mini_llvm::ExtensionMode
ExtensionMode
Definition
ExtensionMode.h:7
mini_llvm::ExtensionMode::kNo
@ kNo
Definition
ExtensionMode.h:8
mini_llvm::share
std::shared_ptr< T > share(T &value)
Definition
Memory.h:25
include
mini-llvm
mir
Instruction
Neg.h
Generated by
1.17.0