diff --git a/Core/MIPS/ARM64/Arm64IRJit.cpp b/Core/MIPS/ARM64/Arm64IRJit.cpp index ee3661e341..4e4b6c24cb 100644 --- a/Core/MIPS/ARM64/Arm64IRJit.cpp +++ b/Core/MIPS/ARM64/Arm64IRJit.cpp @@ -70,7 +70,7 @@ bool Arm64JitBackend::CompileBlock(IRBlockCache *irBlockCache, int block_num, bo return false; IRBlock *block = irBlockCache->GetBlock(block_num); - BeginWrite(std::min(GetSpaceLeft(), (size_t)block->GetNumInstructions() * 32)); + BeginWrite(std::min(GetSpaceLeft(), (size_t)block->GetNumIRInstructions() * 32)); u32 startPC = block->GetOriginalStart(); bool wroteCheckedOffset = false; @@ -96,9 +96,9 @@ bool Arm64JitBackend::CompileBlock(IRBlockCache *irBlockCache, int block_num, bo regs_.Start(irBlockCache, block_num); std::vector addresses; - addresses.reserve(block->GetNumInstructions()); + addresses.reserve(block->GetNumIRInstructions()); const IRInst *instructions = irBlockCache->GetBlockInstructionPtr(*block); - for (int i = 0; i < block->GetNumInstructions(); ++i) { + for (int i = 0; i < block->GetNumIRInstructions(); ++i) { const IRInst &inst = instructions[i]; regs_.SetIRIndex(i); addresses.push_back(GetCodePtr()); diff --git a/Core/MIPS/IR/IRJit.cpp b/Core/MIPS/IR/IRJit.cpp index 0be3701a50..8549a81daa 100644 --- a/Core/MIPS/IR/IRJit.cpp +++ b/Core/MIPS/IR/IRJit.cpp @@ -121,7 +121,7 @@ void IRJit::Compile(u32 em_address) { block->Finalize(cookie); if (block->IsValid()) { // Success, we're done. - FinalizeTargetBlock(&blocks_, block_num); + FinalizeNativeBlock(&blocks_, block_num); return; } } @@ -165,12 +165,12 @@ bool IRJit::CompileBlock(u32 em_address, std::vector &instructions, u32 // TODO: Should we always hash? Then we can reuse blocks. b->UpdateHash(); } - if (!CompileTargetBlock(&blocks_, block_num, preload)) + if (!CompileNativeBlock(&blocks_, block_num, preload)) return false; // Overwrites the first instruction, and also updates stats. blocks_.FinalizeBlock(block_num, preload); if (!preload) - FinalizeTargetBlock(&blocks_, block_num); + FinalizeNativeBlock(&blocks_, block_num); return true; } @@ -303,7 +303,7 @@ void IRJit::RunLoopUntil(u64 globalticks) { } bool IRJit::DescribeCodePtr(const u8 *ptr, std::string &name) { - // Used in target disassembly viewer. + // Used in native disassembly viewer. return false; } @@ -445,7 +445,7 @@ void IRBlockCache::RemoveBlock(int blockIndex) { // Additionally, we zap the block in the IR arena. IRInst bad{ IROp::Bad }; - for (int off = block.GetIRArenaOffset(); off < block.GetIRArenaOffset() + block.GetNumInstructions(); off++) { + for (int off = block.GetIRArenaOffset(); off < block.GetIRArenaOffset() + block.GetNumIRInstructions(); off++) { arena_[off] = bad; } } @@ -477,7 +477,7 @@ int IRBlockCache::FindByCookie(int cookie) { if (blocks_.empty()) return -1; - // TODO: Maybe a flag to determine target offset mode? + // TODO: Maybe a flag to determine native offset mode? if (!compileToNative_) { return GetBlockNumFromIRArenaOffset(cookie); } @@ -539,9 +539,9 @@ JitBlockDebugInfo IRBlockCache::GetBlockDebugInfo(int blockNum) const { debugInfo.origDisasm.push_back(mipsDis); } - debugInfo.irDisasm.reserve(ir.GetNumInstructions()); + debugInfo.irDisasm.reserve(ir.GetNumIRInstructions()); const IRInst *instructions = GetBlockInstructionPtr(ir); - for (int i = 0; i < ir.GetNumInstructions(); i++) { + for (int i = 0; i < ir.GetNumIRInstructions(); i++) { IRInst inst = instructions[i]; char buffer[256]; DisassembleIR(buffer, sizeof(buffer), inst); @@ -555,7 +555,7 @@ void IRBlockCache::ComputeStats(BlockCacheStats &bcStats) const { double maxBloat = 0.0; double minBloat = 1000000000.0; for (const auto &b : blocks_) { - double codeSize = (double)b.GetNumInstructions() * 4; // We count bloat in instructions, not bytes. sizeof(IRInst); + double codeSize = (double)b.GetNumIRInstructions() * 4; // We count bloat in instructions, not bytes. sizeof(IRInst); if (codeSize == 0) continue; u32 origAddr, mipsBytes; diff --git a/Core/MIPS/IR/IRJit.h b/Core/MIPS/IR/IRJit.h index 6608710ddc..762ce78179 100644 --- a/Core/MIPS/IR/IRJit.h +++ b/Core/MIPS/IR/IRJit.h @@ -50,7 +50,7 @@ class IRBlock { public: IRBlock() {} IRBlock(u32 emAddr, u32 origSize, int instOffset, u32 numInstructions) - : origAddr_(emAddr), origSize_(origSize), arenaOffset_(instOffset), numInstructions_(numInstructions) {} + : origAddr_(emAddr), origSize_(origSize), arenaOffset_(instOffset), numIRInstructions_(numInstructions) {} IRBlock(IRBlock &&b) { arenaOffset_ = b.arenaOffset_; hash_ = b.hash_; @@ -58,14 +58,14 @@ public: origSize_ = b.origSize_; origFirstOpcode_ = b.origFirstOpcode_; nativeOffset_ = b.nativeOffset_; - numInstructions_ = b.numInstructions_; + numIRInstructions_ = b.numIRInstructions_; b.arenaOffset_ = 0xFFFFFFFF; } ~IRBlock() {} u32 GetIRArenaOffset() const { return arenaOffset_; } - int GetNumInstructions() const { return numInstructions_; } + int GetNumIRInstructions() const { return numIRInstructions_; } MIPSOpcode GetOriginalFirstOp() const { return origFirstOpcode_; } bool HasOriginalFirstOp() const; bool RestoreOriginalFirstOp(int number); @@ -110,7 +110,7 @@ private: u32 origAddr_ = 0; u32 origSize_ = 0; MIPSOpcode origFirstOpcode_ = MIPSOpcode(0x68FFFFFF); - u32 numInstructions_ = 0; + u32 numIRInstructions_ = 0; }; class IRBlockCache : public JitBlockCacheDebugInterface { @@ -236,8 +236,8 @@ public: protected: bool CompileBlock(u32 em_address, std::vector &instructions, u32 &mipsBytes, bool preload); - virtual bool CompileTargetBlock(IRBlockCache *irBlockCache, int block_num, bool preload) { return true; } - virtual void FinalizeTargetBlock(IRBlockCache *irBlockCache, int block_num) {} + virtual bool CompileNativeBlock(IRBlockCache *irBlockCache, int block_num, bool preload) { return true; } + virtual void FinalizeNativeBlock(IRBlockCache *irBlockCache, int block_num) {} bool compileToNative_; diff --git a/Core/MIPS/IR/IRNativeCommon.cpp b/Core/MIPS/IR/IRNativeCommon.cpp index f4246db1c4..83eccea97a 100644 --- a/Core/MIPS/IR/IRNativeCommon.cpp +++ b/Core/MIPS/IR/IRNativeCommon.cpp @@ -507,11 +507,11 @@ void IRNativeJit::Init(IRNativeBackend &backend) { } } -bool IRNativeJit::CompileTargetBlock(IRBlockCache *irblockCache, int block_num, bool preload) { +bool IRNativeJit::CompileNativeBlock(IRBlockCache *irblockCache, int block_num, bool preload) { return backend_->CompileBlock(irblockCache, block_num, preload); } -void IRNativeJit::FinalizeTargetBlock(IRBlockCache *irblockCache, int block_num) { +void IRNativeJit::FinalizeNativeBlock(IRBlockCache *irblockCache, int block_num) { backend_->FinalizeBlock(irblockCache, block_num, jo); } diff --git a/Core/MIPS/IR/IRNativeCommon.h b/Core/MIPS/IR/IRNativeCommon.h index c36754ae51..a49ab07343 100644 --- a/Core/MIPS/IR/IRNativeCommon.h +++ b/Core/MIPS/IR/IRNativeCommon.h @@ -198,8 +198,8 @@ public: protected: void Init(IRNativeBackend &backend); - bool CompileTargetBlock(IRBlockCache *irBlockCache, int block_num, bool preload) override; - void FinalizeTargetBlock(IRBlockCache *irBlockCache, int block_num) override; + bool CompileNativeBlock(IRBlockCache *irBlockCache, int block_num, bool preload) override; + void FinalizeNativeBlock(IRBlockCache *irBlockCache, int block_num) override; IRNativeBackend *backend_ = nullptr; IRNativeHooks hooks_; diff --git a/Core/MIPS/IR/IRRegCache.cpp b/Core/MIPS/IR/IRRegCache.cpp index e2cb9ac6eb..0b6b316821 100644 --- a/Core/MIPS/IR/IRRegCache.cpp +++ b/Core/MIPS/IR/IRRegCache.cpp @@ -126,7 +126,7 @@ void IRNativeRegCacheBase::Start(MIPSComp::IRBlockCache *irBlockCache, int block mr[statics[i].mr].nReg = statics[i].nr; mr[statics[i].mr].isStatic = true; // Lock it until the very end. - mr[statics[i].mr].spillLockIRIndex = irBlock_->GetNumInstructions(); + mr[statics[i].mr].spillLockIRIndex = irBlock_->GetNumIRInstructions(); } irBlockNum_ = blockNum; @@ -434,7 +434,7 @@ bool IRNativeRegCacheBase::IsRegClobbered(MIPSLoc type, IRReg r) const { // We look starting one ahead, unlike spilling. We want to know if it clobbers later. info.currentIndex = irIndex_ + 1; info.instructions = irBlockCache_->GetBlockInstructionPtr(irBlockNum_); - info.numInstructions = irBlock_->GetNumInstructions(); + info.numInstructions = irBlock_->GetNumIRInstructions(); // Make sure we're on the first one if this is multi-lane. IRReg first = r; @@ -461,7 +461,7 @@ bool IRNativeRegCacheBase::IsRegRead(MIPSLoc type, IRReg first) const { // We look starting one ahead, unlike spilling. info.currentIndex = irIndex_ + 1; info.instructions = irBlockCache_->GetBlockInstructionPtr(irBlockNum_); - info.numInstructions = irBlock_->GetNumInstructions(); + info.numInstructions = irBlock_->GetNumIRInstructions(); // Note: this intentionally doesn't look at the full reg, only the lane. IRUsage usage = GetNextRegUsage(info, type, first); @@ -478,7 +478,7 @@ IRNativeReg IRNativeRegCacheBase::FindBestToSpill(MIPSLoc type, MIPSMap flags, b info.lookaheadCount = UNUSED_LOOKAHEAD_OPS; info.currentIndex = irIndex_; info.instructions = irBlockCache_->GetBlockInstructionPtr(irBlockNum_); - info.numInstructions = irBlock_->GetNumInstructions(); + info.numInstructions = irBlock_->GetNumIRInstructions(); *clobbered = false; for (int i = 0; i < allocCount; i++) { @@ -1031,7 +1031,7 @@ void IRNativeRegCacheBase::MapNativeReg(MIPSLoc type, IRNativeReg nreg, IRReg fi info.lookaheadCount = 16; info.currentIndex = irIndex_; info.instructions = irBlockCache_->GetBlockInstructionPtr(irBlockNum_); - info.numInstructions = irBlock_->GetNumInstructions(); + info.numInstructions = irBlock_->GetNumIRInstructions(); IRReg basefpr = first - oldlane - 32; clobbered = true; diff --git a/Core/MIPS/RiscV/RiscVJit.cpp b/Core/MIPS/RiscV/RiscVJit.cpp index 1e01e677ac..87b1a14dcc 100644 --- a/Core/MIPS/RiscV/RiscVJit.cpp +++ b/Core/MIPS/RiscV/RiscVJit.cpp @@ -61,7 +61,7 @@ bool RiscVJitBackend::CompileBlock(IRBlockCache *irBlockCache, int block_num, bo return false; IRBlock *block = irBlockCache->GetBlock(block_num); - BeginWrite(std::min(GetSpaceLeft(), (size_t)block->GetNumInstructions() * 32)); + BeginWrite(std::min(GetSpaceLeft(), (size_t)block->GetNumIRInstructions() * 32)); u32 startPC = block->GetOriginalStart(); bool wroteCheckedOffset = false; @@ -86,7 +86,7 @@ bool RiscVJitBackend::CompileBlock(IRBlockCache *irBlockCache, int block_num, bo std::vector addresses; const IRInst *instructions = irBlockCache->GetBlockInstructionPtr(*block); - for (int i = 0; i < block->GetNumInstructions(); ++i) { + for (int i = 0; i < block->GetNumIRInstructions(); ++i) { const IRInst &inst = instructions[i]; regs_.SetIRIndex(i); addresses.push_back(GetCodePtr()); diff --git a/Core/MIPS/x86/X64IRJit.cpp b/Core/MIPS/x86/X64IRJit.cpp index 748e0e0e21..5bb0e011b3 100644 --- a/Core/MIPS/x86/X64IRJit.cpp +++ b/Core/MIPS/x86/X64IRJit.cpp @@ -89,9 +89,9 @@ bool X64JitBackend::CompileBlock(IRBlockCache *irBlockCache, int block_num, bool regs_.Start(irBlockCache, block_num); std::vector addresses; - addresses.reserve(block->GetNumInstructions()); + addresses.reserve(block->GetNumIRInstructions()); const IRInst *instructions = irBlockCache->GetBlockInstructionPtr(*block); - for (int i = 0; i < block->GetNumInstructions(); ++i) { + for (int i = 0; i < block->GetNumIRInstructions(); ++i) { const IRInst &inst = instructions[i]; regs_.SetIRIndex(i); addresses.push_back(GetCodePtr());