-
Notifications
You must be signed in to change notification settings - Fork 5
/
EmitMisc.h
64 lines (50 loc) · 1.93 KB
/
EmitMisc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef EMITMISC_H
#define EMITMISC_H
#include "basetypes.h"
#include "X86EmitTypes.h"
#include "InstructionDependencies.h"
class MPE;
struct InstructionEntry;
struct Nuance;
class NativeCodeCache;
struct EmitterVariables
{
MPE *mpe;
InstructionEntry *pInstructionEntry;
uint32 scalarRegDep;
uint32 miscRegDep;
uint32 scalarRegOutDep;
uint32 miscRegOutDep;
bool bCheckECUSkipCounter;
};
inline x86BaseReg GetScalarRegReadBaseReg(const EmitterVariables* const vars, const uint32 regIndex)
{
return (vars->scalarRegDep & SCALAR_REG_DEPENDENCY_MASK(regIndex)) ? x86BaseReg::x86BaseReg_edi : x86BaseReg::x86BaseReg_esi;
}
inline x86BaseReg GetScalarRegWriteBaseReg(const EmitterVariables* const vars, const uint32 regIndex)
{
return x86BaseReg::x86BaseReg_esi;
}
inline x86BaseReg GetMiscRegReadBaseReg(const EmitterVariables * const vars, const uint32 regIndex)
{
const uint32 mask = !regIndex ? DEPENDENCY_FLAG_ALLFLAGS : MISC_REG_DEPENDENCY_MASK(regIndex - 1);
return (vars->miscRegDep & mask) ? x86BaseReg::x86BaseReg_edi : x86BaseReg::x86BaseReg_esi;
}
inline x86BaseReg GetMiscRegWriteBaseReg(const EmitterVariables * const vars, const uint32 regIndex)
{
return x86BaseReg::x86BaseReg_esi;
}
inline int32 GetMiscRegEmitDisp(const EmitterVariables * const vars, const uint32 regIndex)
{
return regIndex*sizeof(uint32);
}
inline int32 GetScalarRegEmitDisp(const EmitterVariables * const vars, const uint32 regIndex)
{
return -((32 - (int32)regIndex) * ((int32)sizeof(uint32)));
}
void Emit_ExitBlock(const EmitterVariables * const vars);
void Emit_NOP(EmitterVariables * const vars, const Nuance &nuance);
void Emit_SaveRegs(EmitterVariables * const vars, const Nuance &nuance);
void Emit_StoreMiscRegisterConstant(EmitterVariables * const vars, const Nuance &nuance);
void Emit_StoreScalarRegisterConstant(EmitterVariables * const vars, const Nuance &nuance);
#endif