PPCRec: Use IMLReg type in FPR RA

This commit is contained in:
Exzap 2023-01-30 06:01:39 +01:00
parent b3676896a9
commit 0577effe41
3 changed files with 2 additions and 68 deletions

View File

@ -261,7 +261,7 @@ bool PPCRecompiler_ApplyIMLPasses(ppcImlGenContext_t& ppcImlGenContext)
for (sint32 i = 0; i < segIt->imlList.size(); i++)
{
segIt->imlList[i].CheckRegisterUsage(&registersUsed);
sint32 accessedTempReg[5];
IMLReg accessedTempReg[5];
// intermediate FPRs
accessedTempReg[0] = registersUsed.readFPR1;
accessedTempReg[1] = registersUsed.readFPR2;
@ -270,7 +270,7 @@ bool PPCRecompiler_ApplyIMLPasses(ppcImlGenContext_t& ppcImlGenContext)
accessedTempReg[4] = registersUsed.writtenFPR1;
for (sint32 f = 0; f < 5; f++)
{
if (accessedTempReg[f] == -1)
if (accessedTempReg[f] == IMLREG_INVALID)
continue;
uint32 regName = ppcImlGenContext.mappedFPRRegister[accessedTempReg[f]];
if (regName >= PPCREC_NAME_FPR0 && regName < PPCREC_NAME_FPR0 + 32)

View File

@ -101,6 +101,5 @@ bool PPCRecompilerImlGen_PS_CMPU1(ppcImlGenContext_t* ppcImlGenContext, uint32 o
// IML general
void PPCRecompilerIML_linkSegments(ppcImlGenContext_t* ppcImlGenContext);
void PPCRecompilerIML_isolateEnterableSegments(ppcImlGenContext_t* ppcImlGenContext);

View File

@ -1,71 +1,6 @@
#include "PPCRecompiler.h"
#include "PPCRecompilerIml.h"
IMLSegment* PPCRecompiler_getSegmentByPPCJumpAddress(ppcImlGenContext_t* ppcImlGenContext, uint32 ppcOffset)
{
__debugbreak();
return nullptr;
//for(IMLSegment* segIt : ppcImlGenContext->segmentList2)
//{
// if(segIt->isJumpDestination && segIt->jumpDestinationPPCAddress == ppcOffset )
// {
// return segIt;
// }
//}
//debug_printf("PPCRecompiler_getSegmentByPPCJumpAddress(): Unable to find segment (ppcOffset 0x%08x)\n", ppcOffset);
//return nullptr;
}
void PPCRecompilerIML_linkSegments(ppcImlGenContext_t* ppcImlGenContext)
{
__debugbreak(); // outdated
//size_t segCount = ppcImlGenContext->segmentList2.size();
//for(size_t s=0; s<segCount; s++)
//{
// IMLSegment* imlSegment = ppcImlGenContext->segmentList2[s];
// bool isLastSegment = (s+1)>=ppcImlGenContext->segmentList2.size();
// IMLSegment* nextSegment = isLastSegment?nullptr:ppcImlGenContext->segmentList2[s+1];
// // handle empty segment
// if( imlSegment->imlList.empty())
// {
// if (isLastSegment == false)
// IMLSegment_SetLinkBranchNotTaken(imlSegment, ppcImlGenContext->segmentList2[s+1]); // continue execution to next segment
// else
// imlSegment->nextSegmentIsUncertain = true;
// continue;
// }
// // check last instruction of segment
// IMLInstruction* imlInstruction = imlSegment->imlList.data() + (imlSegment->imlList.size() - 1);
// if( imlInstruction->type == PPCREC_IML_TYPE_CJUMP || imlInstruction->type == PPCREC_IML_TYPE_CJUMP_CYCLE_CHECK )
// {
// // find destination segment by ppc jump address
// IMLSegment* jumpDestSegment = PPCRecompiler_getSegmentByPPCJumpAddress(ppcImlGenContext, imlInstruction->op_conditionalJump.jumpmarkAddress);
// if( jumpDestSegment )
// {
// if (imlInstruction->op_conditionalJump.condition != PPCREC_JUMP_CONDITION_NONE)
// IMLSegment_SetLinkBranchNotTaken(imlSegment, nextSegment);
// IMLSegment_SetLinkBranchTaken(imlSegment, jumpDestSegment);
// }
// else
// {
// imlSegment->nextSegmentIsUncertain = true;
// }
// }
// else if( imlInstruction->type == PPCREC_IML_TYPE_MACRO )
// {
// // currently we assume that the next segment is unknown for all macros
// imlSegment->nextSegmentIsUncertain = true;
// }
// else
// {
// // all other instruction types do not branch
// IMLSegment_SetLinkBranchNotTaken(imlSegment, nextSegment);
// }
//}
}
void PPCRecompilerIML_isolateEnterableSegments(ppcImlGenContext_t* ppcImlGenContext)
{
size_t initialSegmentCount = ppcImlGenContext->segmentList2.size();