arm64/emit_context: Add deferred_emits
This commit is contained in:
parent
ac0a20795a
commit
d6b58b268b
2 changed files with 21 additions and 1 deletions
|
@ -180,7 +180,7 @@ EmittedBlockInfo EmitArm64(oaknut::CodeGenerator& code, IR::Block block, const E
|
||||||
|
|
||||||
FpsrManager fpsr_manager{code, conf.state_fpsr_offset};
|
FpsrManager fpsr_manager{code, conf.state_fpsr_offset};
|
||||||
RegAlloc reg_alloc{code, fpsr_manager, GPR_ORDER, FPR_ORDER};
|
RegAlloc reg_alloc{code, fpsr_manager, GPR_ORDER, FPR_ORDER};
|
||||||
EmitContext ctx{block, reg_alloc, conf, ebi, fpsr_manager};
|
EmitContext ctx{block, reg_alloc, conf, ebi, fpsr_manager, {}};
|
||||||
|
|
||||||
ebi.entry_point = code.ptr<CodePtr>();
|
ebi.entry_point = code.ptr<CodePtr>();
|
||||||
|
|
||||||
|
@ -232,6 +232,12 @@ EmittedBlockInfo EmitArm64(oaknut::CodeGenerator& code, IR::Block block, const E
|
||||||
|
|
||||||
EmitAddCycles(code, ctx, block.CycleCount());
|
EmitAddCycles(code, ctx, block.CycleCount());
|
||||||
conf.emit_terminal(code, ctx);
|
conf.emit_terminal(code, ctx);
|
||||||
|
code.BRK(0);
|
||||||
|
|
||||||
|
for (const auto& deferred_emit : ctx.deferred_emits) {
|
||||||
|
deferred_emit();
|
||||||
|
}
|
||||||
|
code.BRK(0);
|
||||||
|
|
||||||
ebi.size = code.ptr<CodePtr>() - ebi.entry_point;
|
ebi.size = code.ptr<CodePtr>() - ebi.entry_point;
|
||||||
return ebi;
|
return ebi;
|
||||||
|
|
|
@ -5,6 +5,12 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <oaknut/oaknut.hpp>
|
||||||
|
|
||||||
#include "dynarmic/backend/arm64/emit_arm64.h"
|
#include "dynarmic/backend/arm64/emit_arm64.h"
|
||||||
#include "dynarmic/backend/arm64/reg_alloc.h"
|
#include "dynarmic/backend/arm64/reg_alloc.h"
|
||||||
#include "dynarmic/common/fp/fpcr.h"
|
#include "dynarmic/common/fp/fpcr.h"
|
||||||
|
@ -19,6 +25,12 @@ namespace Dynarmic::Backend::Arm64 {
|
||||||
struct EmitConfig;
|
struct EmitConfig;
|
||||||
class FpsrManager;
|
class FpsrManager;
|
||||||
|
|
||||||
|
using SharedLabel = std::shared_ptr<oaknut::Label>;
|
||||||
|
|
||||||
|
inline SharedLabel GenSharedLabel() {
|
||||||
|
return std::make_shared<oaknut::Label>();
|
||||||
|
}
|
||||||
|
|
||||||
struct EmitContext {
|
struct EmitContext {
|
||||||
IR::Block& block;
|
IR::Block& block;
|
||||||
RegAlloc& reg_alloc;
|
RegAlloc& reg_alloc;
|
||||||
|
@ -26,6 +38,8 @@ struct EmitContext {
|
||||||
EmittedBlockInfo& ebi;
|
EmittedBlockInfo& ebi;
|
||||||
FpsrManager& fpsr;
|
FpsrManager& fpsr;
|
||||||
|
|
||||||
|
std::vector<std::function<void()>> deferred_emits;
|
||||||
|
|
||||||
FP::FPCR FPCR(bool fpcr_controlled = true) const {
|
FP::FPCR FPCR(bool fpcr_controlled = true) const {
|
||||||
const FP::FPCR fpcr = conf.descriptor_to_fpcr(block.Location());
|
const FP::FPCR fpcr = conf.descriptor_to_fpcr(block.Location());
|
||||||
return fpcr_controlled ? fpcr : fpcr.ASIMDStandardValue();
|
return fpcr_controlled ? fpcr : fpcr.ASIMDStandardValue();
|
||||||
|
|
Loading…
Reference in a new issue