From 396e42e17c94dfa0224c820e5d051cee9876d75b Mon Sep 17 00:00:00 2001 From: archshift Date: Sun, 10 Aug 2014 01:09:27 -0700 Subject: [PATCH] sVU_zerorec.cpp: Removed "using namespace std" --- pcsx2/x86/sVU_zerorec.cpp | 117 +++++++++++++++++++------------------- 1 file changed, 58 insertions(+), 59 deletions(-) diff --git a/pcsx2/x86/sVU_zerorec.cpp b/pcsx2/x86/sVU_zerorec.cpp index 6354a8bbff..56bac0a19b 100644 --- a/pcsx2/x86/sVU_zerorec.cpp +++ b/pcsx2/x86/sVU_zerorec.cpp @@ -45,7 +45,6 @@ // Needed in gcc for find. #include -using namespace std; using namespace x86Emitter; // temporary externs @@ -151,7 +150,7 @@ struct VuFunctionHeader VuFunctionHeader() : startpc(0xffffffff), pprogfunc(NULL) {} ~VuFunctionHeader() { - for (vector::iterator it = ranges.begin(); it != ranges.end(); ++it) + for (std::vector::iterator it = ranges.begin(); it != ranges.end(); ++it) { free(it->pmem); } @@ -163,7 +162,7 @@ struct VuFunctionHeader u32 startpc; void* pprogfunc; - vector ranges; + std::vector ranges; }; struct VuBlockHeader @@ -203,7 +202,7 @@ class VuInstruction VuInstruction *pPrevInst; int SetCachedRegs(int upper, u32 vuxyz); - void Recompile(list::iterator& itinst, u32 vuxyz); + void Recompile(std::list::iterator& itinst, u32 vuxyz); }; enum BlockType @@ -221,7 +220,7 @@ enum BlockType class VuBaseBlock { public: - typedef list LISTBLOCKS; + typedef std::list LISTBLOCKS; VuBaseBlock(); @@ -229,8 +228,8 @@ class VuBaseBlock void AssignVFRegs(); void AssignVIRegs(int parent); - list::iterator GetInstIterAtPc(int instpc); - void GetInstsAtPc(int instpc, list& listinsts); + std::list::iterator GetInstIterAtPc(int instpc); + void GetInstsAtPc(int instpc, std::list& listinsts); void Recompile(); @@ -241,8 +240,8 @@ class VuBaseBlock void* pcode; // x86 code pointer void* pendcode; // end of the x86 code pointer int cycles; - list insts; - list parents; + std::list insts; + std::list parents; LISTBLOCKS blocks; // blocks branches to u32* pChildJumps[4]; // addrs that need to be filled with the children's start addrs // if highest bit is set, addr needs to be relational @@ -297,7 +296,7 @@ struct VUPIPELINES fdivPipe fdiv; efuPipe efu; ialuPipe ialu[8]; - list< WRITEBACK > listWritebacks; + std::list< WRITEBACK > listWritebacks; }; VuBaseBlock::VuBaseBlock() @@ -316,17 +315,17 @@ VuBaseBlock::VuBaseBlock() #define SUPERVU_STACKSIZE 0x1000 -static list s_listVUHeaders[2]; -static list* s_plistCachedHeaders[2] = {NULL, NULL}; +static std::list s_listVUHeaders[2]; +static std::list* s_plistCachedHeaders[2] = {NULL, NULL}; static VuFunctionHeader** recVUHeaders[2] = { NULL, NULL }; static VuBlockHeader* recVUBlocks[2] = { NULL, NULL }; static u8* recVUStack[2] = { NULL, NULL }; static u8* recVUStackPtr[2] = { NULL, NULL }; -static vector<_x86regs> s_vecRegArray(128); +static std::vector<_x86regs> s_vecRegArray(128); static VURegs* VU = NULL; -static list s_listBlocks; +static std::list s_listBlocks; static u32 s_vu = 0; static u32 s_UnconditionalDelay = 0; // 1 if there are two sequential branches and the last is unconditional static u32 g_nLastBlockExecuted = 0; @@ -368,7 +367,7 @@ static void SuperVUAlloc(int vuindex) void DestroyCachedHeaders(int vuindex, int j) { - list::iterator it = s_plistCachedHeaders[vuindex][j].begin(); + std::list::iterator it = s_plistCachedHeaders[vuindex][j].begin(); while (it != s_plistCachedHeaders[vuindex][j].end()) { @@ -381,7 +380,7 @@ void DestroyCachedHeaders(int vuindex, int j) void DestroyVUHeaders(int vuindex) { - list::iterator it = s_listVUHeaders[vuindex].begin(); + std::list::iterator it = s_listVUHeaders[vuindex].begin(); while (it != s_listVUHeaders[vuindex].end()) { @@ -458,8 +457,8 @@ void SuperVUReset(int vuindex) // clear the block and any joining blocks (size given in bytes) static void __fastcall SuperVUClear(u32 startpc, u32 size, int vuindex) { - vector::iterator itrange; - list::iterator it = s_listVUHeaders[vuindex].begin(); + std::vector::iterator itrange; + std::list::iterator it = s_listVUHeaders[vuindex].begin(); u32 endpc = startpc + ((size + 7) & ~7); // Ensure size is a multiple of u64 (round up) while (it != s_listVUHeaders[vuindex].end()) { @@ -474,7 +473,7 @@ static void __fastcall SuperVUClear(u32 startpc, u32 size, int vuindex) { recVUHeaders[vuindex][(*it)->startpc/8] = NULL; #ifdef SUPERVU_CACHING - list* plist = &s_plistCachedHeaders[vuindex][(*it)->startpc/8]; + std::list* plist = &s_plistCachedHeaders[vuindex][(*it)->startpc / 8]; plist->push_back(*it); if (plist->size() > 30) { @@ -547,7 +546,7 @@ u32 SuperVUGetVIAddr(int reg, int read) return (uptr)&VU->VI[reg]; } -void SuperVUDumpBlock(list& blocks, int vuindex) +void SuperVUDumpBlock(std::list& blocks, int vuindex) { u32 *mem; u32 i; @@ -563,8 +562,8 @@ void SuperVUDumpBlock(list& blocks, int vuindex) INST_Q_READ, INST_P_READ, INST_CLIP_WRITE, INST_STATUS_WRITE, INST_MAC_WRITE, INST_Q_WRITE); eff.Printf("XMM: Upper: read0 read1 write acc temp; Lower: read0 read1 write acc temp\n\n"); - list::iterator itblock; - list::iterator itinst; + std::list::iterator itblock; + std::list::iterator itinst; VuBaseBlock::LISTBLOCKS::iterator itchild; for(itblock = blocks.begin(); itblock != blocks.end(); itblock++) @@ -710,7 +709,7 @@ void* SuperVUGetProgram(u32 startpc, int vuindex) #ifdef SUPERVU_CACHING void* pmem = (vuindex & 1) ? VU1.Micro : VU0.Micro; // check if program exists in cache - list::iterator it; + std::list::iterator it; for(it = s_plistCachedHeaders[vuindex][startpc/8].begin(); it != s_plistCachedHeaders[vuindex][startpc/8].end(); it++) { if ((*it)->IsSame(pmem)) @@ -750,7 +749,7 @@ void* SuperVUGetProgram(u32 startpc, int vuindex) bool VuFunctionHeader::IsSame(void* pmem) { #ifdef SUPERVU_CACHING - vector::iterator it; + std::vector::iterator it; for(it = ranges.begin(); it != ranges.end(); it++) { if (memcmp_mmx((u8*)pmem + it->start, it->pmem, it->size)) @@ -760,12 +759,12 @@ bool VuFunctionHeader::IsSame(void* pmem) return true; } -list::iterator VuBaseBlock::GetInstIterAtPc(int instpc) +std::list::iterator VuBaseBlock::GetInstIterAtPc(int instpc) { pxAssert(instpc >= 0); int curpc = startpc; - list::iterator it; + std::list::iterator it; for (it = insts.begin(); it != insts.end(); ++it) { if (it->type & INST_DUMMY) continue; @@ -779,14 +778,14 @@ list::iterator VuBaseBlock::GetInstIterAtPc(int instpc) return insts.begin(); } -void VuBaseBlock::GetInstsAtPc(int instpc, list& listinsts) +void VuBaseBlock::GetInstsAtPc(int instpc, std::list& listinsts) { pxAssert(instpc >= 0); listinsts.clear(); int curpc = startpc; - list::iterator it; + std::list::iterator it; for (it = insts.begin(); it != insts.end(); ++it) { if (it->type & INST_DUMMY) continue; @@ -801,7 +800,7 @@ void VuBaseBlock::GetInstsAtPc(int instpc, list& listinsts) } // look for the pc in other blocks - for (list::iterator itblock = s_listBlocks.begin(); itblock != s_listBlocks.end(); ++itblock) + for (std::list::iterator itblock = s_listBlocks.begin(); itblock != s_listBlocks.end(); ++itblock) { if (*itblock == this) continue; @@ -833,7 +832,7 @@ static VuFunctionHeader* SuperVURecompileProgram(u32 startpc, int vuindex) } } - list::iterator itblock; + std::list::iterator itblock; s_vu = vuindex; VU = s_vu ? &VU1 : &VU0; @@ -910,7 +909,7 @@ static VuFunctionHeader* SuperVURecompileProgram(u32 startpc, int vuindex) #endif // destroy - for (list::iterator itblock = s_listBlocks.begin(); itblock != s_listBlocks.end(); ++itblock) + for (std::list::iterator itblock = s_listBlocks.begin(); itblock != s_listBlocks.end(); ++itblock) { delete *itblock; } @@ -943,12 +942,12 @@ static VuInstruction SuperVUFlushInst() return inst; } -void SuperVUAddWritebacks(VuBaseBlock* pblock, const list& listWritebacks) +void SuperVUAddWritebacks(VuBaseBlock* pblock, const std::list& listWritebacks) { #ifdef SUPERVU_WRITEBACKS // regardless of repetition, add the pipes (for selfloops) - list::const_iterator itwriteback = listWritebacks.begin(); - list::iterator itinst = pblock->insts.begin(), itinst2; + std::list::const_iterator itwriteback = listWritebacks.begin(); + std::list::iterator itinst = pblock->insts.begin(), itinst2; while (itwriteback != listWritebacks.end()) { @@ -1028,7 +1027,7 @@ static VuBaseBlock* SuperVUBuildBlocks(VuBaseBlock* parent, u32 startpc, const V { VuBaseBlock* pblock = pbh->pblock; - list::iterator itinst; + std::list::iterator itinst; if (pblock->startpc == startpc) { @@ -1139,9 +1138,9 @@ static VuBaseBlock* SuperVUBuildBlocks(VuBaseBlock* parent, u32 startpc, const V u8 macflags = 0; - list< WRITEBACK > listWritebacks; - list< WRITEBACK >::iterator itwriteback; - list::iterator itinst; + std::list< WRITEBACK > listWritebacks; + std::list< WRITEBACK >::iterator itwriteback; + std::list::iterator itinst; u32 hasSecondBranch = 0; u32 needFullStatusFlag = 0; @@ -1621,7 +1620,7 @@ static VuBaseBlock* SuperVUBuildBlocks(VuBaseBlock* parent, u32 startpc, const V static void SuperVUInitLiveness(VuBaseBlock* pblock) { - list::iterator itinst, itnext; + std::list::iterator itinst, itnext; pxAssert(pblock->insts.size() > 0); @@ -1704,8 +1703,8 @@ u32 COMPUTE_LIVE(u32 R, u32 K, u32 L) static void SuperVULivenessAnalysis() { BOOL changed; - list::reverse_iterator itblock; - list::iterator itinst, itnext; + std::list::reverse_iterator itblock; + std::list::iterator itinst, itnext; VuBaseBlock::LISTBLOCKS::iterator itchild; u32 livevars[2]; @@ -1816,11 +1815,11 @@ static void SuperVULivenessAnalysis() static void SuperVUEliminateDeadCode() { - list::iterator itblock; + std::list::iterator itblock; VuBaseBlock::LISTBLOCKS::iterator itchild; - list::iterator itinst, itnext; - list listParents; - list::iterator itparent; + std::list::iterator itinst, itnext; + std::list listParents; + std::list::iterator itparent; for(itblock = s_listBlocks.begin(); itblock != s_listBlocks.end(); itblock++) { @@ -1840,7 +1839,7 @@ static void SuperVUEliminateDeadCode() if (itinst->nParentPc >= 0 && itnext->nParentPc >= 0 && itinst->nParentPc != itnext->nParentPc) // superman returns { // take the live vars from the next next inst - list::iterator itnextnext = itnext; + std::list::iterator itnextnext = itnext; ++itnextnext; if (itnextnext != (*itblock)->insts.end()) { @@ -2024,8 +2023,8 @@ static void SuperVUEliminateDeadCode() void VuBaseBlock::AssignVFRegs() { VuBaseBlock::LISTBLOCKS::iterator itchild; - list::iterator itblock; - list::iterator itinst, itnext, itinst2; + std::list::iterator itblock; + std::list::iterator itinst, itnext, itinst2; // init the start regs if (type & BLOCKTYPE_ANALYZED) return; // nothing changed @@ -2292,8 +2291,8 @@ void VuBaseBlock::AssignVFRegs() struct MARKOVBLANKET { - list parents; - list children; + std::list parents; + std::list children; }; static MARKOVBLANKET s_markov; @@ -2329,7 +2328,7 @@ void VuBaseBlock::AssignVIRegs(int parent) pxAssert(parents.size() > 0); - list::iterator itparent; + std::list::iterator itparent; u32 usedvars = insts.front().usedvars[0]; u32 livevars = insts.front().livevars[0]; @@ -2397,7 +2396,7 @@ void VuBaseBlock::AssignVIRegs(int parent) static void SuperVUAssignRegs() { - list::iterator itblock, itblock2; + std::list::iterator itblock, itblock2; for(itblock = s_listBlocks.begin(); itblock != s_listBlocks.end(); itblock++) { @@ -2681,7 +2680,7 @@ static void SuperVURecompile() _initXMMregs(); - list::iterator itblock; + std::list::iterator itblock; for(itblock = s_listBlocks.begin(); itblock != s_listBlocks.end(); itblock++) { @@ -2878,7 +2877,7 @@ void VuBaseBlock::Recompile() MOV32ItoM((uptr)&VU->VI[REG_TPC], startpc); MOV32ItoM((uptr)&s_svulast, startpc); - list::iterator itparent; + std::list::iterator itparent; for (itparent = parents.begin(); itparent != parents.end(); ++itparent) { if ((*itparent)->blocks.size() == 1 && (*itparent)->blocks.front()->startpc == startpc && @@ -2920,7 +2919,7 @@ void VuBaseBlock::Recompile() _initX86regs(); #endif - list::iterator itinst; + std::list::iterator itinst; for(itinst = insts.begin(); itinst != insts.end(); itinst++) { s_pCurInst = &(*itinst); @@ -3003,7 +3002,7 @@ void VuBaseBlock::Recompile() u32 livevars[2] = {0}; - list::iterator lastinst = GetInstIterAtPc(endpc - 8); + std::list::iterator lastinst = GetInstIterAtPc(endpc - 8); lastinst++; if (lastinst != insts.end()) @@ -3263,7 +3262,7 @@ int VuInstruction::SetCachedRegs(int upper, u32 vuxyz) return info; } -void VuInstruction::Recompile(list::iterator& itinst, u32 vuxyz) +void VuInstruction::Recompile(std::list::iterator& itinst, u32 vuxyz) { //static PCSX2_ALIGNED16(VECTOR _VF); //static PCSX2_ALIGNED16(VECTOR _VFc); @@ -3306,7 +3305,7 @@ void VuInstruction::Recompile(list::iterator& itinst, u32 vuxyz) // } // } - list::iterator itblock; + std::list::iterator itblock; for(itblock = s_listBlocks.begin(); itblock != s_listBlocks.end(); itblock++) { if (nParentPc >= (*itblock)->startpc && nParentPc < (*itblock)->endpc) @@ -3536,7 +3535,7 @@ void VuInstruction::Recompile(list::iterator& itinst, u32 vuxyz) pxAssert(!(type & (INST_CLIP_WRITE | INST_STATUS_WRITE | INST_MAC_WRITE))); pc += 8; - list::const_iterator itinst2; + std::list::const_iterator itinst2; if ((regs[0].VIwrite | regs[1].VIwrite) & ((1 << REG_MAC_FLAG) | (1 << REG_STATUS_FLAG))) {