shader_jit_x64: Separate initialization and code generation for readability.
This commit is contained in:
parent
6e0319eec9
commit
1d45b57939
|
@ -810,7 +810,15 @@ void JitCompiler::FindReturnOffsets() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitCompiler::Compile() {
|
void JitCompiler::Compile() {
|
||||||
|
// Reset flow control state
|
||||||
program = (CompiledShader*)GetCodePtr();
|
program = (CompiledShader*)GetCodePtr();
|
||||||
|
program_counter = 0;
|
||||||
|
looping = false;
|
||||||
|
code_ptr.fill(nullptr);
|
||||||
|
fixup_branches.clear();
|
||||||
|
|
||||||
|
// Find all `CALL` instructions and identify return locations
|
||||||
|
FindReturnOffsets();
|
||||||
|
|
||||||
// The stack pointer is 8 modulo 16 at the entry of a procedure
|
// The stack pointer is 8 modulo 16 at the entry of a procedure
|
||||||
ABI_PushRegistersAndAdjustStack(ABI_ALL_CALLEE_SAVED, 8);
|
ABI_PushRegistersAndAdjustStack(ABI_ALL_CALLEE_SAVED, 8);
|
||||||
|
@ -833,15 +841,6 @@ void JitCompiler::Compile() {
|
||||||
MOV(PTRBITS, R(RAX), ImmPtr(&neg));
|
MOV(PTRBITS, R(RAX), ImmPtr(&neg));
|
||||||
MOVAPS(NEGBIT, MatR(RAX));
|
MOVAPS(NEGBIT, MatR(RAX));
|
||||||
|
|
||||||
// Find all `CALL` instructions and identify return locations
|
|
||||||
FindReturnOffsets();
|
|
||||||
|
|
||||||
// Reset flow control state
|
|
||||||
program_counter = 0;
|
|
||||||
looping = false;
|
|
||||||
code_ptr.fill(nullptr);
|
|
||||||
fixup_branches.clear();
|
|
||||||
|
|
||||||
// Jump to start of the shader program
|
// Jump to start of the shader program
|
||||||
JMPptr(R(ABI_PARAM2));
|
JMPptr(R(ABI_PARAM2));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue