Fix register load/store bypass when register result still needed
This commit is contained in:
parent
fc2095301d
commit
2acca6d7b1
|
@ -110,12 +110,12 @@ float atan2(float p, float q)
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define F_EXP_0 1.0000003
|
#define F_EXP_0 1.0
|
||||||
#define F_EXP_1 0.693147059
|
#define F_EXP_1 0.69315668
|
||||||
#define F_EXP_2 0.240173099
|
#define F_EXP_2 0.240132068
|
||||||
#define F_EXP_3 0.055816392
|
#define F_EXP_3 0.055876024
|
||||||
#define F_EXP_4 0.008965036
|
#define F_EXP_4 0.008940801
|
||||||
#define F_EXP_5 0.001898429
|
#define F_EXP_5 0.001894414
|
||||||
|
|
||||||
float exp(float f)
|
float exp(float f)
|
||||||
{
|
{
|
||||||
|
@ -143,12 +143,12 @@ float exp(float f)
|
||||||
return s * x.f;
|
return s * x.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define F_LOG_0 -3.78712618
|
#define F_LOG_0 -3.78717706
|
||||||
#define F_LOG_1 10.0957081
|
#define F_LOG_1 10.0960498
|
||||||
#define F_LOG_2 -13.9747486
|
#define F_LOG_2 -13.975654
|
||||||
#define F_LOG_3 12.7568806
|
#define F_LOG_3 12.7580616
|
||||||
#define F_LOG_4 -6.48114552
|
#define F_LOG_4 -6.48190725
|
||||||
#define F_LOG_5 1.39045416
|
#define F_LOG_5 1.39064767
|
||||||
|
|
||||||
float log(float f)
|
float log(float f)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5617,7 +5617,9 @@ void InterOperand::Disassemble(FILE* file, InterCodeProcedure* proc)
|
||||||
}
|
}
|
||||||
else if (mType == IT_FLOAT)
|
else if (mType == IT_FLOAT)
|
||||||
{
|
{
|
||||||
fprintf(file, "C%c:%f", typechars[mType], mFloatConst);
|
union { float f; uint32 u; } u;
|
||||||
|
u.f = (float)mFloatConst;
|
||||||
|
fprintf(file, "C%c:%f (%08x)", typechars[mType], mFloatConst, u.u);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#define JUMP_TO_BRANCH 1
|
#define JUMP_TO_BRANCH 1
|
||||||
#define CHECK_NULLPTR 0
|
#define CHECK_NULLPTR 0
|
||||||
#define REYCLE_JUMPS 1
|
#define REYCLE_JUMPS 1
|
||||||
|
#define DISASSEMBLE_OPT 0
|
||||||
|
|
||||||
static bool CheckFunc;
|
static bool CheckFunc;
|
||||||
static bool CheckCase;
|
static bool CheckCase;
|
||||||
|
@ -47657,7 +47658,7 @@ bool NativeCodeBasicBlock::PeepHoleOptimizerIterate4(int i, int pass)
|
||||||
mIns[i + 0].mType == ASMIT_STA &&
|
mIns[i + 0].mType == ASMIT_STA &&
|
||||||
mIns[i + 1].mType == ASMIT_LDA && HasAsmInstructionMode(ASMIT_LDX, mIns[i + 1].mMode) &&
|
mIns[i + 1].mType == ASMIT_LDA && HasAsmInstructionMode(ASMIT_LDX, mIns[i + 1].mMode) &&
|
||||||
mIns[i + 2].mType == ASMIT_STA && HasAsmInstructionMode(ASMIT_STX, mIns[i + 2].mMode) &&
|
mIns[i + 2].mType == ASMIT_STA && HasAsmInstructionMode(ASMIT_STX, mIns[i + 2].mMode) &&
|
||||||
mIns[i + 3].mType == ASMIT_LDX && mIns[i + 3].SameEffectiveAddress(mIns[i + 0]))
|
mIns[i + 3].mType == ASMIT_LDX && mIns[i + 3].SameEffectiveAddress(mIns[i + 0]) && !(mIns[i + 3].mLive & LIVE_CPU_REG_A))
|
||||||
{
|
{
|
||||||
mIns[i + 0].mLive |= LIVE_CPU_REG_A;
|
mIns[i + 0].mLive |= LIVE_CPU_REG_A;
|
||||||
mIns[i + 1].mType = ASMIT_LDX; mIns[i + 1].mLive |= LIVE_CPU_REG_X;
|
mIns[i + 1].mType = ASMIT_LDX; mIns[i + 1].mLive |= LIVE_CPU_REG_X;
|
||||||
|
@ -47670,7 +47671,7 @@ bool NativeCodeBasicBlock::PeepHoleOptimizerIterate4(int i, int pass)
|
||||||
mIns[i + 0].mType == ASMIT_STA &&
|
mIns[i + 0].mType == ASMIT_STA &&
|
||||||
mIns[i + 1].mType == ASMIT_LDA && HasAsmInstructionMode(ASMIT_LDY, mIns[i + 1].mMode) &&
|
mIns[i + 1].mType == ASMIT_LDA && HasAsmInstructionMode(ASMIT_LDY, mIns[i + 1].mMode) &&
|
||||||
mIns[i + 2].mType == ASMIT_STA && HasAsmInstructionMode(ASMIT_STY, mIns[i + 2].mMode) &&
|
mIns[i + 2].mType == ASMIT_STA && HasAsmInstructionMode(ASMIT_STY, mIns[i + 2].mMode) &&
|
||||||
mIns[i + 3].mType == ASMIT_LDY && mIns[i + 3].SameEffectiveAddress(mIns[i + 0]))
|
mIns[i + 3].mType == ASMIT_LDY && mIns[i + 3].SameEffectiveAddress(mIns[i + 0]) && !(mIns[i + 3].mLive & LIVE_CPU_REG_A))
|
||||||
{
|
{
|
||||||
mIns[i + 0].mLive |= LIVE_CPU_REG_A;
|
mIns[i + 0].mLive |= LIVE_CPU_REG_A;
|
||||||
mIns[i + 1].mType = ASMIT_LDY; mIns[i + 1].mLive |= LIVE_CPU_REG_Y;
|
mIns[i + 1].mType = ASMIT_LDY; mIns[i + 1].mLive |= LIVE_CPU_REG_Y;
|
||||||
|
@ -53044,7 +53045,7 @@ NativeCodeProcedure::~NativeCodeProcedure(void)
|
||||||
|
|
||||||
void NativeCodeProcedure::DisassembleDebug(const char* name)
|
void NativeCodeProcedure::DisassembleDebug(const char* name)
|
||||||
{
|
{
|
||||||
#if 0
|
#if DISASSEMBLE_OPT
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
FILE* file;
|
FILE* file;
|
||||||
static bool initial = true;
|
static bool initial = true;
|
||||||
|
@ -53296,7 +53297,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
|
||||||
|
|
||||||
mInterProc->mLinkerObject->mNativeProc = this;
|
mInterProc->mLinkerObject->mNativeProc = this;
|
||||||
|
|
||||||
CheckFunc = !strcmp(mIdent->mString, "putpch");
|
CheckFunc = !strcmp(mIdent->mString, "isinf");
|
||||||
|
|
||||||
int nblocks = proc->mBlocks.Size();
|
int nblocks = proc->mBlocks.Size();
|
||||||
tblocks = new NativeCodeBasicBlock * [nblocks];
|
tblocks = new NativeCodeBasicBlock * [nblocks];
|
||||||
|
@ -54075,6 +54076,10 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
|
|
||||||
CheckCase = false;
|
CheckCase = false;
|
||||||
|
|
||||||
|
#if DISASSEMBLE_OPT
|
||||||
|
DisassembleDebug("Preoptimize");
|
||||||
|
#endif
|
||||||
|
|
||||||
CheckBlocks();
|
CheckBlocks();
|
||||||
|
|
||||||
bool changed, xmapped = false, ymapped = false;
|
bool changed, xmapped = false, ymapped = false;
|
||||||
|
@ -55139,7 +55144,7 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
mEntryBlock->CheckAsmCode();
|
mEntryBlock->CheckAsmCode();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if DISASSEMBLE_OPT
|
||||||
char fname[100];
|
char fname[100];
|
||||||
sprintf_s(fname, "Optimize %d, %d", step, cnt);
|
sprintf_s(fname, "Optimize %d, %d", step, cnt);
|
||||||
DisassembleDebug(fname);
|
DisassembleDebug(fname);
|
||||||
|
|
Loading…
Reference in New Issue