From 9fdc713c87c11dc6356727b87035a2c9fc9b0d39 Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Sun, 5 Apr 2015 21:18:05 +1200 Subject: [PATCH] While I'm here, Add some comments. --- Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp b/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp index ff8b7d6cc3..5c95aa39b2 100644 --- a/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp +++ b/Source/Core/Core/PowerPC/Jit64IL/IR_X86.cpp @@ -43,8 +43,19 @@ struct RegInfo JitIL *Jit; IRBuilder* Build; InstLoc FirstI; + + // IInfo contains (per instruction) + // Bits 0-1: Saturating count of number of instructions referencing this instruction. + // Bits 2-3: single bit per operand marking if this is the last instruction to reference that operand's result. + // Used to decide if we should free any registers associated with the operands after this instruction + // and if we can clobber the operands registers. + // Warning, Memory instruction use these bits slightly differently. + // Bits 15-31: Spill location std::vector IInfo; + + // The last instruction which uses the result of this instruction. Used by the register allocator. std::vector lastUsed; + InstLoc regs[MAX_NUMBER_OF_REGS]; InstLoc fregs[MAX_NUMBER_OF_REGS]; unsigned numSpills; @@ -412,6 +423,8 @@ static X64Reg regBinLHSReg(RegInfo& RI, InstLoc I) return reg; } +// Clear any registers which end their lifetime at I +// Don't use this for special instructions like memory load/stores static void regNormalRegClear(RegInfo& RI, InstLoc I) { if (RI.IInfo[I - RI.FirstI] & 4) @@ -420,6 +433,7 @@ static void regNormalRegClear(RegInfo& RI, InstLoc I) regClearInst(RI, getOp2(I)); } +// Clear any floating point registers which end their lifetime at I static void fregNormalRegClear(RegInfo& RI, InstLoc I) { if (RI.IInfo[I - RI.FirstI] & 4)