mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
update comments
This commit is contained in:
parent
3eb1696e09
commit
628a737500
2 changed files with 8 additions and 33 deletions
|
@ -110,12 +110,10 @@ namespace PpcGen {
|
||||||
Write32(instr);
|
Write32(instr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// use lwz ... can't find good opcode :s
|
|
||||||
void PPCXEmitter::LD (PPCReg dest, PPCReg src, int offset) {
|
void PPCXEmitter::LD (PPCReg dest, PPCReg src, int offset) {
|
||||||
u32 instr = ((58 << 26) | (dest << 21) | (src << 16) | ((offset) & 0xffff));
|
u32 instr = ((58 << 26) | (dest << 21) | (src << 16) | ((offset) & 0xffff));
|
||||||
Write32(instr);
|
Write32(instr);
|
||||||
}
|
}
|
||||||
// use stw ... can't find good opcode :s
|
|
||||||
void PPCXEmitter::STD (PPCReg dest, PPCReg src, int offset) {
|
void PPCXEmitter::STD (PPCReg dest, PPCReg src, int offset) {
|
||||||
u32 instr = ((62 << 26) | (dest << 21) | (src << 16) | ((offset) & 0xffff));
|
u32 instr = ((62 << 26) | (dest << 21) | (src << 16) | ((offset) & 0xffff));
|
||||||
Write32(instr);
|
Write32(instr);
|
||||||
|
@ -332,7 +330,7 @@ namespace PpcGen {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compare
|
// Compare (Only use CR0 atm...)
|
||||||
void PPCXEmitter::CMPI(PPCReg dest, unsigned short imm) {
|
void PPCXEmitter::CMPI(PPCReg dest, unsigned short imm) {
|
||||||
Write32((11<<26) | (dest << 16) | ((imm) & 0xffff));
|
Write32((11<<26) | (dest << 16) | ((imm) & 0xffff));
|
||||||
}
|
}
|
||||||
|
@ -372,14 +370,10 @@ namespace PpcGen {
|
||||||
// Quick Call
|
// Quick Call
|
||||||
// dest = LIS(imm) + ORI(+imm)
|
// dest = LIS(imm) + ORI(+imm)
|
||||||
void PPCXEmitter::MOVI2R(PPCReg dest, unsigned int imm) {
|
void PPCXEmitter::MOVI2R(PPCReg dest, unsigned int imm) {
|
||||||
/*
|
|
||||||
if (imm == (unsigned short)imm) {
|
if (imm == (unsigned short)imm) {
|
||||||
// 16bit
|
// 16bit
|
||||||
LI(dest, imm & 0xFFFF);
|
LI(dest, imm & 0xFFFF);
|
||||||
ANDIS(dest, dest, 0);
|
} else {
|
||||||
} else
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
// HI 16bit
|
// HI 16bit
|
||||||
LIS(dest, imm>>16);
|
LIS(dest, imm>>16);
|
||||||
if ((imm & 0xFFFF) != 0) {
|
if ((imm & 0xFFFF) != 0) {
|
||||||
|
@ -390,22 +384,8 @@ namespace PpcGen {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPCXEmitter::QuickCallFunction(void *func) {
|
void PPCXEmitter::QuickCallFunction(void *func) {
|
||||||
/*
|
/** TODO : can use simple jump **/
|
||||||
// Must check if we need to use bctrl or simple branch
|
|
||||||
u32 func_addr = (u32) func;
|
|
||||||
u32 code_addr = (u32) code;
|
|
||||||
if (func_addr - code_addr > 0x1fffffc) {
|
|
||||||
// Load func address
|
|
||||||
MOVI2R(R0, func_addr);
|
|
||||||
// Set it to link register
|
|
||||||
MTCTR(R0);
|
|
||||||
// Branch
|
|
||||||
BCTRL();
|
|
||||||
} else {
|
|
||||||
// Direct branch
|
|
||||||
BL(func);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
u32 func_addr = (u32) func;
|
u32 func_addr = (u32) func;
|
||||||
// Load func address
|
// Load func address
|
||||||
MOVI2R(R0, func_addr);
|
MOVI2R(R0, func_addr);
|
||||||
|
@ -471,7 +451,6 @@ namespace PpcGen {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Others ...
|
// Others ...
|
||||||
|
|
||||||
void PPCXEmitter::SetCodePtr(u8 *ptr)
|
void PPCXEmitter::SetCodePtr(u8 *ptr)
|
||||||
{
|
{
|
||||||
code = ptr;
|
code = ptr;
|
||||||
|
@ -491,10 +470,6 @@ namespace PpcGen {
|
||||||
|
|
||||||
void PPCXEmitter::ReserveCodeSpace(u32 bytes)
|
void PPCXEmitter::ReserveCodeSpace(u32 bytes)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
for (u32 i = 0; i < bytes/4; i++)
|
|
||||||
Write32(0xE1200070); //bkpt 0
|
|
||||||
*/
|
|
||||||
for (u32 i = 0; i < bytes/4; i++)
|
for (u32 i = 0; i < bytes/4; i++)
|
||||||
Write32(0x60000000); //nop
|
Write32(0x60000000); //nop
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace PpcGen
|
||||||
u32 condition;
|
u32 condition;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Weite opcode
|
// Write opcode
|
||||||
inline void Write32(u32 value) {*(u32*)code = value; code+=4;}
|
inline void Write32(u32 value) {*(u32*)code = value; code+=4;}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -230,6 +230,7 @@ namespace PpcGen
|
||||||
// reverse ?
|
// reverse ?
|
||||||
SUBF(Rd, Rb, Ra);
|
SUBF(Rd, Rb, Ra);
|
||||||
}
|
}
|
||||||
|
// if RCFlags update CR0
|
||||||
void SUBF (PPCReg Rd, PPCReg Ra, PPCReg Rb, int RCFlags = 0);
|
void SUBF (PPCReg Rd, PPCReg Ra, PPCReg Rb, int RCFlags = 0);
|
||||||
void SUBFC (PPCReg Rd, PPCReg Ra, PPCReg Rb);
|
void SUBFC (PPCReg Rd, PPCReg Ra, PPCReg Rb);
|
||||||
|
|
||||||
|
@ -304,7 +305,6 @@ namespace PpcGen
|
||||||
}; // class PPCXEmitter
|
}; // class PPCXEmitter
|
||||||
|
|
||||||
|
|
||||||
// Everything that needs to generate X86 code should inherit from this.
|
|
||||||
// You get memory management for free, plus, you can use all the MOV etc functions without
|
// You get memory management for free, plus, you can use all the MOV etc functions without
|
||||||
// having to prefix them with gen-> or something similar.
|
// having to prefix them with gen-> or something similar.
|
||||||
class PPCXCodeBlock : public PPCXEmitter
|
class PPCXCodeBlock : public PPCXEmitter
|
||||||
|
|
Loading…
Add table
Reference in a new issue