libmicroemu 0.2.0
ARM Microcontroller Emulator Library
Loading...
Searching...
No Matches
mnemonic_builder_ternary_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 MnemonicBuilderTernaryLoadStoreInstrWithImm {
14public:
15 using It = typename TContext::It;
16 using Reg = typename TContext::Reg;
17 using SReg = typename TContext::SReg;
18
19 template <typename TDest, typename TTgt, typename TArg0>
20 static void Build(const char *instr_spec, TContext &mctx, const MnemonicBuilderFlagsSet &bflags,
21 const InstrFlagsSet &iflags, const TDest &rd, 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(rd.Get()))
32 .AddString(", ")
33 .AddString(Reg::GetRegisterName(rt.Get()))
34 .AddString(", ");
35
36 RelativeAdrBuilder::Build<decltype(mctx.builder), Reg>(mctx.builder, is_add, is_index, is_wback,
37 rn, imm32);
38 mctx.builder.Terminate();
39 }
40
41private:
45 MnemonicBuilderTernaryLoadStoreInstrWithImm() = delete;
46
50 ~MnemonicBuilderTernaryLoadStoreInstrWithImm() = delete;
51
56 MnemonicBuilderTernaryLoadStoreInstrWithImm(
57 const MnemonicBuilderTernaryLoadStoreInstrWithImm &r_src) = default;
58
63 MnemonicBuilderTernaryLoadStoreInstrWithImm &
64 operator=(const MnemonicBuilderTernaryLoadStoreInstrWithImm &r_src) = delete;
65
70 MnemonicBuilderTernaryLoadStoreInstrWithImm(MnemonicBuilderTernaryLoadStoreInstrWithImm &&r_src) =
71 delete;
72
77 MnemonicBuilderTernaryLoadStoreInstrWithImm &
78 operator=(MnemonicBuilderTernaryLoadStoreInstrWithImm &&r_src) = delete;
79};
80
81} // namespace libmicroemu::internal
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.