UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VVMBytecodeInline.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#if WITH_VERSE_VM || defined(__INTELLISENSE__)
6
8
10
11namespace Verse
12{
13template <typename FunctionType>
14void FOp::ForEachReg(VProcedure& Procedure, FunctionType&& Function)
15{
16 switch (Opcode)
17 {
18#define VISIT_OP(Name) \
19 case EOpcode::Name: \
20 { \
21 FOp##Name* DerivedOp = static_cast<FOp##Name*>(this); \
22 DerivedOp->ForEachOperand([&](EOperandRole Role, auto& Operand, const TCHAR* Name) { \
23 ForEachRegImpl(Procedure, Operand, [&](FRegisterIndex& Register) { \
24 Function(Role, Register); \
25 }); \
26 }); \
27 break; \
28 }
29
31#undef VISIT_OP
32 }
33}
34
35template <typename FunctionType>
36void FOp::ForEachRegImpl(VProcedure&, FRegisterIndex& Register, FunctionType&& Function)
37{
38 if (Register.Index != FRegisterIndex::UNINITIALIZED)
39 {
41 }
42}
43
44template <typename FunctionType>
45void FOp::ForEachRegImpl(VProcedure&, FValueOperand& Operand, FunctionType&& Function)
46{
47 if (Operand.IsRegister() && Operand.AsRegister().Index != FRegisterIndex::UNINITIALIZED)
48 {
49 Function(Operand.AsRegister());
50 }
51}
52
53template <typename CellType, typename FunctionType>
54void FOp::ForEachRegImpl(VProcedure&, TWriteBarrier<CellType>&, FunctionType&&)
55{
56}
57
58template <typename FunctionType>
59void FOp::ForEachRegImpl(VProcedure& Procedure, TOperandRange<FValueOperand> ValueOperands, FunctionType&& Function)
60{
61 for (uint32 Index = 0; Index < ValueOperands.Num; ++Index)
62 {
63 FValueOperand& Operand = Procedure.GetOperandsBegin()[ValueOperands.Index + Index];
64 if (Operand.IsRegister() && Operand.AsRegister().Index != FRegisterIndex::UNINITIALIZED)
65 {
66 Function(Operand.AsRegister());
67 }
68 }
69}
70
71template <typename CellType, typename FunctionType>
72void FOp::ForEachRegImpl(VProcedure&, TOperandRange<TWriteBarrier<CellType>>, FunctionType&&)
73{
74}
75
76template <typename FunctionType>
77void FOp::ForEachJump(VProcedure& Procedure, FunctionType&& Function)
78{
79 switch (Opcode)
80 {
81#define VISIT_OP(Name) \
82 case EOpcode::Name: \
83 { \
84 static_cast<FOp##Name*>(this)->ForEachJump([&](auto& Label, const TCHAR* Name) { \
85 ForEachJumpImpl(Procedure, Label, Name, Forward<FunctionType>(Function)); \
86 }); \
87 break; \
88 }
89
91#undef VISIT_OP
92
93 default:
94 V_DIE("Invalid opcode encountered: %u", static_cast<FOpcodeInt>(Opcode));
95 break;
96 }
97}
98
99template <typename FunctionType>
100void FOp::ForEachJumpImpl(VProcedure& Procedure, TOperandRange<FLabelOffset> LabelOffsets, const TCHAR* Name, FunctionType&& Function)
101{
102 for (uint32 I = 0; I < LabelOffsets.Num; ++I)
103 {
104 Function(Procedure.GetLabelsBegin()[LabelOffsets.Index + I], Name);
105 }
106}
107
108template <typename FunctionType>
109void FOp::ForEachJumpImpl(VProcedure&, FLabelOffset& Label, const TCHAR* Name, FunctionType&& Function)
110{
111 Function(Label, Name);
112}
113
114} // namespace Verse
115#endif // WITH_VERSE_VM
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Archive.h:36
U16 Index
Definition radfft.cpp:71