libmicroemu 0.2.0
ARM Microcontroller Emulator Library
Loading...
Searching...
No Matches
mnemonic_builder_binary_loadstore_instr_with_imm.h
1#pragma once
2
3#include "libmicroemu/internal/trace/instr/generic/relative_adr_builder.h"
4
6#include "libmicroemu/types.h"
7
8namespace libmicroemu::internal {
9
13template <typename TContext> class MnemonicBuilderBinaryLoadStoreInstrWithImm {
14public:
15 using It = typename TContext::It;
16 using Reg = typename TContext::Reg;
17 using SReg = typename TContext::SReg;
18
19 template <typename TTgt, typename TArg0>
20 static void Build(const char *instr_spec, TContext &mctx, const MnemonicBuilderFlagsSet &bflags,
21 const InstrFlagsSet &iflags, const TTgt &rt, const TArg0 &rn,
22 const u32 &imm32) {
23 static_cast<void>(bflags);
24 const bool is_wback = (iflags & static_cast<InstrFlagsSet>(InstrFlags::kWBack)) != 0U;
25 const bool is_index = (iflags & static_cast<InstrFlagsSet>(InstrFlags::kIndex)) != 0U;
26 const bool is_add = (iflags & static_cast<InstrFlagsSet>(InstrFlags::kAdd)) != 0U;
27
28 mctx.builder.AddString(instr_spec)
29 .AddString(It::GetConditionAsStr(mctx.cpua))
30 .AddChar(' ')
31 .AddString(Reg::GetRegisterName(rt.Get()))
32 .AddString(", ");
33
34 RelativeAdrBuilder::Build<decltype(mctx.builder), Reg>(mctx.builder, is_add, is_index, is_wback,
35 rn, imm32);
36 mctx.builder.Terminate();
37 }
38
39private:
43 MnemonicBuilderBinaryLoadStoreInstrWithImm() = delete;
44
48 ~MnemonicBuilderBinaryLoadStoreInstrWithImm() = delete;
49
54 MnemonicBuilderBinaryLoadStoreInstrWithImm(
55 const MnemonicBuilderBinaryLoadStoreInstrWithImm &r_src) = default;
56
61 MnemonicBuilderBinaryLoadStoreInstrWithImm &
62 operator=(const MnemonicBuilderBinaryLoadStoreInstrWithImm &r_src) = delete;
63
68 MnemonicBuilderBinaryLoadStoreInstrWithImm(MnemonicBuilderBinaryLoadStoreInstrWithImm &&r_src) =
69 delete;
70
75 MnemonicBuilderBinaryLoadStoreInstrWithImm &
76 operator=(MnemonicBuilderBinaryLoadStoreInstrWithImm &&r_src) = delete;
77};
78
79}
static void Build(TMnemonicBuilder &builder, const bool &is_add, const bool &is_index, const bool &is_wback, const TArg0 &rn, const u32 &imm)
Uses the given str builder to build a string representing the different addressing modes of instructi...
Definition relative_adr_builder.h:23
The libmicroemu::internal namespace contains all classes and functions of libmicroemu which are priva...
Definition bkpt_flags.h:6
Contains the Result class which is used to return the result of a function.