Code cleanup: moving poly/ into xenia/base/
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "poly/vec128.h"
|
||||
#include "xenia/base/vec128.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -25,8 +25,6 @@ namespace xe {
|
||||
namespace cpu {
|
||||
namespace frontend {
|
||||
|
||||
using vec128_t = poly::vec128_t;
|
||||
|
||||
// Map:
|
||||
// 0-31: GPR
|
||||
// 32-63: FPR
|
||||
|
||||
@@ -9,63 +9,63 @@
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_disasm.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/math.h"
|
||||
#include "poly/string_buffer.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/base/string_buffer.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
namespace frontend {
|
||||
|
||||
void Disasm_0(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_0(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s ???", i.type->name);
|
||||
}
|
||||
|
||||
void Disasm__(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm__(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s", i.type->name);
|
||||
}
|
||||
|
||||
void Disasm_X_FRT_FRB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_FRT_FRB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s f%d, f%d", i.X.Rc ? -7 : -8, i.type->name,
|
||||
i.X.Rc ? "." : "", i.X.RT, i.X.RB);
|
||||
}
|
||||
void Disasm_A_FRT_FRB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_A_FRT_FRB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s f%d, f%d", i.A.Rc ? -7 : -8, i.type->name,
|
||||
i.A.Rc ? "." : "", i.A.FRT, i.A.FRB);
|
||||
}
|
||||
void Disasm_A_FRT_FRA_FRB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_A_FRT_FRA_FRB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s f%d, f%d, f%d", i.A.Rc ? -7 : -8, i.type->name,
|
||||
i.A.Rc ? "." : "", i.A.FRT, i.A.FRA, i.A.FRB);
|
||||
}
|
||||
void Disasm_A_FRT_FRA_FRB_FRC(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_A_FRT_FRA_FRB_FRC(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s f%d, f%d, f%d, f%d", i.A.Rc ? -7 : -8, i.type->name,
|
||||
i.A.Rc ? "." : "", i.A.FRT, i.A.FRA, i.A.FRB, i.A.FRC);
|
||||
}
|
||||
void Disasm_X_RT_RA_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_RT_RA_RB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d, r%d, r%d", i.type->name, i.X.RT, i.X.RA, i.X.RB);
|
||||
}
|
||||
void Disasm_X_RT_RA0_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_RT_RA0_RB(InstrData& i, StringBuffer* str) {
|
||||
if (i.X.RA) {
|
||||
str->Append("%-8s r%d, r%d, r%d", i.type->name, i.X.RT, i.X.RA, i.X.RB);
|
||||
} else {
|
||||
str->Append("%-8s r%d, 0, r%d", i.type->name, i.X.RT, i.X.RB);
|
||||
}
|
||||
}
|
||||
void Disasm_X_FRT_RA_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_FRT_RA_RB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s f%d, r%d, r%d", i.type->name, i.X.RT, i.X.RA, i.X.RB);
|
||||
}
|
||||
void Disasm_X_FRT_RA0_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_FRT_RA0_RB(InstrData& i, StringBuffer* str) {
|
||||
if (i.X.RA) {
|
||||
str->Append("%-8s f%d, r%d, r%d", i.type->name, i.X.RT, i.X.RA, i.X.RB);
|
||||
} else {
|
||||
str->Append("%-8s f%d, 0, r%d", i.type->name, i.X.RT, i.X.RB);
|
||||
}
|
||||
}
|
||||
void Disasm_D_RT_RA_I(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_D_RT_RA_I(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d, r%d, %d", i.type->name, i.D.RT, i.D.RA,
|
||||
(int32_t)(int16_t) XEEXTS16(i.D.DS));
|
||||
}
|
||||
void Disasm_D_RT_RA0_I(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_D_RT_RA0_I(InstrData& i, StringBuffer* str) {
|
||||
if (i.D.RA) {
|
||||
str->Append("%-8s r%d, r%d, %d", i.type->name, i.D.RT, i.D.RA,
|
||||
(int32_t)(int16_t) XEEXTS16(i.D.DS));
|
||||
@@ -74,11 +74,11 @@ void Disasm_D_RT_RA0_I(InstrData& i, poly::StringBuffer* str) {
|
||||
(int32_t)(int16_t) XEEXTS16(i.D.DS));
|
||||
}
|
||||
}
|
||||
void Disasm_D_FRT_RA_I(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_D_FRT_RA_I(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s f%d, r%d, %d", i.type->name, i.D.RT, i.D.RA,
|
||||
(int32_t)(int16_t) XEEXTS16(i.D.DS));
|
||||
}
|
||||
void Disasm_D_FRT_RA0_I(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_D_FRT_RA0_I(InstrData& i, StringBuffer* str) {
|
||||
if (i.D.RA) {
|
||||
str->Append("%-8s f%d, r%d, %d", i.type->name, i.D.RT, i.D.RA,
|
||||
(int32_t)(int16_t) XEEXTS16(i.D.DS));
|
||||
@@ -87,11 +87,11 @@ void Disasm_D_FRT_RA0_I(InstrData& i, poly::StringBuffer* str) {
|
||||
(int32_t)(int16_t) XEEXTS16(i.D.DS));
|
||||
}
|
||||
}
|
||||
void Disasm_DS_RT_RA_I(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_DS_RT_RA_I(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d, r%d, %d", i.type->name, i.DS.RT, i.DS.RA,
|
||||
(int32_t)(int16_t) XEEXTS16(i.DS.DS << 2));
|
||||
}
|
||||
void Disasm_DS_RT_RA0_I(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_DS_RT_RA0_I(InstrData& i, StringBuffer* str) {
|
||||
if (i.DS.RA) {
|
||||
str->Append("%-8s r%d, r%d, %d", i.type->name, i.DS.RT, i.DS.RA,
|
||||
(int32_t)(int16_t) XEEXTS16(i.DS.DS << 2));
|
||||
@@ -100,29 +100,29 @@ void Disasm_DS_RT_RA0_I(InstrData& i, poly::StringBuffer* str) {
|
||||
(int32_t)(int16_t) XEEXTS16(i.DS.DS << 2));
|
||||
}
|
||||
}
|
||||
void Disasm_D_RA(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_D_RA(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d", i.type->name, i.D.RA);
|
||||
}
|
||||
void Disasm_X_RA_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_RA_RB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d, r%d", i.type->name, i.X.RA, i.X.RB);
|
||||
}
|
||||
void Disasm_XO_RT_RA_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_XO_RT_RA_RB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s%s r%d, r%d, r%d", i.XO.Rc ? -7 : -8, i.type->name,
|
||||
i.XO.OE ? "o" : "", i.XO.Rc ? "." : "", i.XO.RT, i.XO.RA,
|
||||
i.XO.RB);
|
||||
}
|
||||
void Disasm_XO_RT_RA(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_XO_RT_RA(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s%s r%d, r%d", i.XO.Rc ? -7 : -8, i.type->name,
|
||||
i.XO.OE ? "o" : "", i.XO.Rc ? "." : "", i.XO.RT, i.XO.RA);
|
||||
}
|
||||
void Disasm_X_RA_RT_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_RA_RT_RB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s r%d, r%d, r%d", i.X.Rc ? -7 : -8, i.type->name,
|
||||
i.X.Rc ? "." : "", i.X.RA, i.X.RT, i.X.RB);
|
||||
}
|
||||
void Disasm_D_RA_RT_I(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_D_RA_RT_I(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-7s. r%d, r%d, %.4Xh", i.type->name, i.D.RA, i.D.RT, i.D.DS);
|
||||
}
|
||||
void Disasm_X_RA_RT(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_RA_RT(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s r%d, r%d", i.X.Rc ? -7 : -8, i.type->name,
|
||||
i.X.Rc ? "." : "", i.X.RA, i.X.RT);
|
||||
}
|
||||
@@ -161,14 +161,14 @@ void Disasm_X_RA_RT(InstrData& i, poly::StringBuffer* str) {
|
||||
(i.VX128_R.VA128l | (i.VX128_R.VA128h << 5) | (i.VX128_R.VA128H << 6))
|
||||
#define VX128_R_VB128 (i.VX128_R.VB128l | (i.VX128_R.VB128h << 5))
|
||||
|
||||
void Disasm_X_VX_RA0_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_X_VX_RA0_RB(InstrData& i, StringBuffer* str) {
|
||||
if (i.X.RA) {
|
||||
str->Append("%-8s v%d, r%d, r%d", i.type->name, i.X.RT, i.X.RA, i.X.RB);
|
||||
} else {
|
||||
str->Append("%-8s v%d, 0, r%d", i.type->name, i.X.RT, i.X.RB);
|
||||
}
|
||||
}
|
||||
void Disasm_VX1281_VD_RA0_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_VX1281_VD_RA0_RB(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_1_VD128;
|
||||
if (i.VX128_1.RA) {
|
||||
str->Append("%-8s v%d, r%d, r%d", i.type->name, vd, i.VX128_1.RA,
|
||||
@@ -177,45 +177,45 @@ void Disasm_VX1281_VD_RA0_RB(InstrData& i, poly::StringBuffer* str) {
|
||||
str->Append("%-8s v%d, 0, r%d", i.type->name, vd, i.VX128_1.RB);
|
||||
}
|
||||
}
|
||||
void Disasm_VX1283_VD_VB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_VX1283_VD_VB(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_3_VD128;
|
||||
const uint32_t vb = VX128_3_VB128;
|
||||
str->Append("%-8s v%d, v%d", i.type->name, vd, vb);
|
||||
}
|
||||
void Disasm_VX1283_VD_VB_I(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_VX1283_VD_VB_I(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_VD128;
|
||||
const uint32_t va = VX128_VA128;
|
||||
const uint32_t uimm = i.VX128_3.IMM;
|
||||
str->Append("%-8s v%d, v%d, %.2Xh", i.type->name, vd, va, uimm);
|
||||
}
|
||||
void Disasm_VX_VD_VA_VB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_VX_VD_VA_VB(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s v%d, v%d, v%d", i.type->name, i.VX.VD, i.VX.VA, i.VX.VB);
|
||||
}
|
||||
void Disasm_VX128_VD_VA_VB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_VX128_VD_VA_VB(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_VD128;
|
||||
const uint32_t va = VX128_VA128;
|
||||
const uint32_t vb = VX128_VB128;
|
||||
str->Append("%-8s v%d, v%d, v%d", i.type->name, vd, va, vb);
|
||||
}
|
||||
void Disasm_VX128_VD_VA_VD_VB(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_VX128_VD_VA_VD_VB(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_VD128;
|
||||
const uint32_t va = VX128_VA128;
|
||||
const uint32_t vb = VX128_VB128;
|
||||
str->Append("%-8s v%d, v%d, v%d, v%d", i.type->name, vd, va, vd, vb);
|
||||
}
|
||||
void Disasm_VX1282_VD_VA_VB_VC(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_VX1282_VD_VA_VB_VC(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_2_VD128;
|
||||
const uint32_t va = VX128_2_VA128;
|
||||
const uint32_t vb = VX128_2_VB128;
|
||||
const uint32_t vc = i.VX128_2.VC;
|
||||
str->Append("%-8s v%d, v%d, v%d, v%d", i.type->name, vd, va, vb, vc);
|
||||
}
|
||||
void Disasm_VXA_VD_VA_VB_VC(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_VXA_VD_VA_VB_VC(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s v%d, v%d, v%d, v%d", i.type->name, i.VXA.VD, i.VXA.VA,
|
||||
i.VXA.VB, i.VXA.VC);
|
||||
}
|
||||
|
||||
void Disasm_sync(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_sync(InstrData& i, StringBuffer* str) {
|
||||
const char* name;
|
||||
int L = i.X.RT & 3;
|
||||
switch (L) {
|
||||
@@ -234,7 +234,7 @@ void Disasm_sync(InstrData& i, poly::StringBuffer* str) {
|
||||
str->Append("%-8s %.2X", name, L);
|
||||
}
|
||||
|
||||
void Disasm_dcbf(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_dcbf(InstrData& i, StringBuffer* str) {
|
||||
const char* name;
|
||||
switch (i.X.RT & 3) {
|
||||
case 0:
|
||||
@@ -256,7 +256,7 @@ void Disasm_dcbf(InstrData& i, poly::StringBuffer* str) {
|
||||
str->Append("%-8s r%d, r%d", name, i.X.RA, i.X.RB);
|
||||
}
|
||||
|
||||
void Disasm_dcbz(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_dcbz(InstrData& i, StringBuffer* str) {
|
||||
// or dcbz128 0x7C2007EC
|
||||
if (i.X.RA) {
|
||||
str->Append("%-8s r%d, r%d", i.type->name, i.X.RA, i.X.RB);
|
||||
@@ -265,16 +265,16 @@ void Disasm_dcbz(InstrData& i, poly::StringBuffer* str) {
|
||||
}
|
||||
}
|
||||
|
||||
void Disasm_fcmp(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_fcmp(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s cr%d, f%d, f%d", i.type->name, i.X.RT >> 2, i.X.RA, i.X.RB);
|
||||
}
|
||||
|
||||
void Disasm_mffsx(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_mffsx(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s f%d, FPSCR", i.X.Rc ? -7 : -8, i.type->name,
|
||||
i.X.Rc ? "." : "", i.X.RT);
|
||||
}
|
||||
|
||||
void Disasm_bx(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_bx(InstrData& i, StringBuffer* str) {
|
||||
const char* name = i.I.LK ? "bl" : "b";
|
||||
uint32_t nia;
|
||||
if (i.I.AA) {
|
||||
@@ -285,7 +285,7 @@ void Disasm_bx(InstrData& i, poly::StringBuffer* str) {
|
||||
str->Append("%-8s %.8X", name, nia);
|
||||
// TODO(benvanik): resolve target name?
|
||||
}
|
||||
void Disasm_bcx(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_bcx(InstrData& i, StringBuffer* str) {
|
||||
const char* s0 = i.B.LK ? "lr, " : "";
|
||||
const char* s1;
|
||||
if (!select_bits(i.B.BO, 2, 2)) {
|
||||
@@ -295,7 +295,7 @@ void Disasm_bcx(InstrData& i, poly::StringBuffer* str) {
|
||||
}
|
||||
char s2[8] = {0};
|
||||
if (!select_bits(i.B.BO, 4, 4)) {
|
||||
snprintf(s2, poly::countof(s2), "cr%d, ", i.B.BI >> 2);
|
||||
snprintf(s2, xe::countof(s2), "cr%d, ", i.B.BI >> 2);
|
||||
}
|
||||
uint32_t nia;
|
||||
if (i.B.AA) {
|
||||
@@ -306,17 +306,17 @@ void Disasm_bcx(InstrData& i, poly::StringBuffer* str) {
|
||||
str->Append("%-8s %s%s%s%.8X", i.type->name, s0, s1, s2, nia);
|
||||
// TODO(benvanik): resolve target name?
|
||||
}
|
||||
void Disasm_bcctrx(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_bcctrx(InstrData& i, StringBuffer* str) {
|
||||
// TODO(benvanik): mnemonics
|
||||
const char* s0 = i.XL.LK ? "lr, " : "";
|
||||
char s2[8] = {0};
|
||||
if (!select_bits(i.XL.BO, 4, 4)) {
|
||||
snprintf(s2, poly::countof(s2), "cr%d, ", i.XL.BI >> 2);
|
||||
snprintf(s2, xe::countof(s2), "cr%d, ", i.XL.BI >> 2);
|
||||
}
|
||||
str->Append("%-8s %s%sctr", i.type->name, s0, s2);
|
||||
// TODO(benvanik): resolve target name?
|
||||
}
|
||||
void Disasm_bclrx(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_bclrx(InstrData& i, StringBuffer* str) {
|
||||
const char* name = "bclr";
|
||||
if (i.code == 0x4E800020) {
|
||||
name = "blr";
|
||||
@@ -329,12 +329,12 @@ void Disasm_bclrx(InstrData& i, poly::StringBuffer* str) {
|
||||
}
|
||||
char s2[8] = {0};
|
||||
if (!select_bits(i.XL.BO, 4, 4)) {
|
||||
snprintf(s2, poly::countof(s2), "cr%d, ", i.XL.BI >> 2);
|
||||
snprintf(s2, xe::countof(s2), "cr%d, ", i.XL.BI >> 2);
|
||||
}
|
||||
str->Append("%-8s %s%s", name, s1, s2);
|
||||
}
|
||||
|
||||
void Disasm_mfcr(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_mfcr(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d, cr", i.type->name, i.X.RT);
|
||||
}
|
||||
const char* Disasm_spr_name(uint32_t n) {
|
||||
@@ -352,40 +352,40 @@ const char* Disasm_spr_name(uint32_t n) {
|
||||
}
|
||||
return reg;
|
||||
}
|
||||
void Disasm_mfspr(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_mfspr(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t n = ((i.XFX.spr & 0x1F) << 5) | ((i.XFX.spr >> 5) & 0x1F);
|
||||
const char* reg = Disasm_spr_name(n);
|
||||
str->Append("%-8s r%d, %s", i.type->name, i.XFX.RT, reg);
|
||||
}
|
||||
void Disasm_mtspr(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_mtspr(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t n = ((i.XFX.spr & 0x1F) << 5) | ((i.XFX.spr >> 5) & 0x1F);
|
||||
const char* reg = Disasm_spr_name(n);
|
||||
str->Append("%-8s %s, r%d", i.type->name, reg, i.XFX.RT);
|
||||
}
|
||||
void Disasm_mftb(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_mftb(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d, tb", i.type->name, i.XFX.RT);
|
||||
}
|
||||
void Disasm_mfmsr(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_mfmsr(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d", i.type->name, i.X.RT);
|
||||
}
|
||||
void Disasm_mtmsr(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_mtmsr(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s r%d, %d", i.type->name, i.X.RT, (i.X.RA & 16) ? 1 : 0);
|
||||
}
|
||||
|
||||
void Disasm_cmp(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_cmp(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s cr%d, %.2X, r%d, r%d", i.type->name, i.X.RT >> 2,
|
||||
i.X.RT & 1, i.X.RA, i.X.RB);
|
||||
}
|
||||
void Disasm_cmpi(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_cmpi(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s cr%d, %.2X, r%d, %d", i.type->name, i.D.RT >> 2, i.D.RT & 1,
|
||||
i.D.RA, XEEXTS16(i.D.DS));
|
||||
}
|
||||
void Disasm_cmpli(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_cmpli(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s cr%d, %.2X, r%d, %.2X", i.type->name, i.D.RT >> 2,
|
||||
i.D.RT & 1, i.D.RA, XEEXTS16(i.D.DS));
|
||||
}
|
||||
|
||||
void Disasm_rld(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_rld(InstrData& i, StringBuffer* str) {
|
||||
if (i.MD.idx == 0) {
|
||||
// XEDISASMR(rldiclx, 0x78000000, MD )
|
||||
str->Append("%*s%s r%d, r%d, %d, %d", i.MD.Rc ? -7 : -8, "rldicl",
|
||||
@@ -422,75 +422,75 @@ void Disasm_rld(InstrData& i, poly::StringBuffer* str) {
|
||||
assert_always();
|
||||
}
|
||||
}
|
||||
void Disasm_rlwim(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_rlwim(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s r%d, r%d, %d, %d, %d", i.M.Rc ? -7 : -8, i.type->name,
|
||||
i.M.Rc ? "." : "", i.M.RA, i.M.RT, i.M.SH, i.M.MB, i.M.ME);
|
||||
}
|
||||
void Disasm_rlwnmx(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_rlwnmx(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s r%d, r%d, r%d, %d, %d", i.M.Rc ? -7 : -8, i.type->name,
|
||||
i.M.Rc ? "." : "", i.M.RA, i.M.RT, i.M.SH, i.M.MB, i.M.ME);
|
||||
}
|
||||
void Disasm_srawix(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_srawix(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s r%d, r%d, %d", i.X.Rc ? -7 : -8, i.type->name,
|
||||
i.X.Rc ? "." : "", i.X.RA, i.X.RT, i.X.RB);
|
||||
}
|
||||
void Disasm_sradix(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_sradix(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%*s%s r%d, r%d, %d", i.XS.Rc ? -7 : -8, i.type->name,
|
||||
i.XS.Rc ? "." : "", i.XS.RA, i.XS.RT, (i.XS.SH5 << 5) | i.XS.SH);
|
||||
}
|
||||
|
||||
void Disasm_vpermwi128(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vpermwi128(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = i.VX128_P.VD128l | (i.VX128_P.VD128h << 5);
|
||||
const uint32_t vb = i.VX128_P.VB128l | (i.VX128_P.VB128h << 5);
|
||||
str->Append("%-8s v%d, v%d, %.2X", i.type->name, vd, vb,
|
||||
i.VX128_P.PERMl | (i.VX128_P.PERMh << 5));
|
||||
}
|
||||
void Disasm_vrfin128(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vrfin128(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_3_VD128;
|
||||
const uint32_t vb = VX128_3_VB128;
|
||||
str->Append("%-8s v%d, v%d", i.type->name, vd, vb);
|
||||
}
|
||||
void Disasm_vrlimi128(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vrlimi128(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_4_VD128;
|
||||
const uint32_t vb = VX128_4_VB128;
|
||||
str->Append("%-8s v%d, v%d, %.2X, %.2X", i.type->name, vd, vb, i.VX128_4.IMM,
|
||||
i.VX128_4.z);
|
||||
}
|
||||
void Disasm_vsldoi128(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vsldoi128(InstrData& i, StringBuffer* str) {
|
||||
const uint32_t vd = VX128_5_VD128;
|
||||
const uint32_t va = VX128_5_VA128;
|
||||
const uint32_t vb = VX128_5_VB128;
|
||||
const uint32_t sh = i.VX128_5.SH;
|
||||
str->Append("%-8s v%d, v%d, v%d, %.2X", i.type->name, vd, va, vb, sh);
|
||||
}
|
||||
void Disasm_vspltb(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vspltb(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s v%d, v%d, %.2X", i.type->name, i.VX.VD, i.VX.VB,
|
||||
i.VX.VA & 0xF);
|
||||
}
|
||||
void Disasm_vsplth(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vsplth(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s v%d, v%d, %.2X", i.type->name, i.VX.VD, i.VX.VB,
|
||||
i.VX.VA & 0x7);
|
||||
}
|
||||
void Disasm_vspltw(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vspltw(InstrData& i, StringBuffer* str) {
|
||||
str->Append("%-8s v%d, v%d, %.2X", i.type->name, i.VX.VD, i.VX.VB, i.VX.VA);
|
||||
}
|
||||
void Disasm_vspltisb(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vspltisb(InstrData& i, StringBuffer* str) {
|
||||
// 5bit -> 8bit sign extend
|
||||
int8_t simm = (i.VX.VA & 0x10) ? (i.VX.VA | 0xF0) : i.VX.VA;
|
||||
str->Append("%-8s v%d, %.2X", i.type->name, i.VX.VD, simm);
|
||||
}
|
||||
void Disasm_vspltish(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vspltish(InstrData& i, StringBuffer* str) {
|
||||
// 5bit -> 16bit sign extend
|
||||
int16_t simm = (i.VX.VA & 0x10) ? (i.VX.VA | 0xFFF0) : i.VX.VA;
|
||||
str->Append("%-8s v%d, %.4X", i.type->name, i.VX.VD, simm);
|
||||
}
|
||||
void Disasm_vspltisw(InstrData& i, poly::StringBuffer* str) {
|
||||
void Disasm_vspltisw(InstrData& i, StringBuffer* str) {
|
||||
// 5bit -> 32bit sign extend
|
||||
int32_t simm = (i.VX.VA & 0x10) ? (i.VX.VA | 0xFFFFFFF0) : i.VX.VA;
|
||||
str->Append("%-8s v%d, %.8X", i.type->name, i.VX.VD, simm);
|
||||
}
|
||||
|
||||
int DisasmPPC(InstrData& i, poly::StringBuffer* str) {
|
||||
int DisasmPPC(InstrData& i, StringBuffer* str) {
|
||||
if (!i.type) {
|
||||
str->Append("???");
|
||||
} else {
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
#ifndef XENIA_FRONTEND_PPC_DISASM_H_
|
||||
#define XENIA_FRONTEND_PPC_DISASM_H_
|
||||
|
||||
#include "xenia/base/string_buffer.h"
|
||||
#include "xenia/cpu/frontend/ppc_instr.h"
|
||||
#include "poly/string_buffer.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
namespace frontend {
|
||||
|
||||
int DisasmPPC(InstrData& i, poly::StringBuffer* str);
|
||||
int DisasmPPC(InstrData& i, StringBuffer* str);
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace cpu
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_emit-private.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/cpu/frontend/ppc_context.h"
|
||||
#include "xenia/cpu/frontend/ppc_hir_builder.h"
|
||||
|
||||
@@ -19,10 +19,6 @@ namespace frontend {
|
||||
|
||||
// TODO(benvanik): remove when enums redefined.
|
||||
using namespace xe::cpu::hir;
|
||||
using poly::vec128b;
|
||||
using poly::vec128f;
|
||||
using poly::vec128i;
|
||||
using poly::vec128s;
|
||||
|
||||
using xe::cpu::hir::Value;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_emit-private.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/cpu/frontend/ppc_context.h"
|
||||
#include "xenia/cpu/frontend/ppc_hir_builder.h"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_emit-private.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/cpu/frontend/ppc_context.h"
|
||||
#include "xenia/cpu/frontend/ppc_hir_builder.h"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_emit-private.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/cpu/frontend/ppc_context.h"
|
||||
#include "xenia/cpu/frontend/ppc_hir_builder.h"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_emit-private.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/cpu/frontend/ppc_context.h"
|
||||
#include "xenia/cpu/frontend/ppc_hir_builder.h"
|
||||
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
#include "poly/type_pool.h"
|
||||
#include "xenia/base/type_pool.h"
|
||||
#include "xenia/cpu/frontend/context_info.h"
|
||||
#include "xenia/memory.h"
|
||||
#include "xenia/cpu/function.h"
|
||||
#include "xenia/cpu/symbol_info.h"
|
||||
#include "xenia/memory.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -58,7 +58,7 @@ class PPCFrontend {
|
||||
Runtime* runtime_;
|
||||
std::unique_ptr<ContextInfo> context_info_;
|
||||
PPCBuiltins builtins_;
|
||||
poly::TypePool<PPCTranslator, PPCFrontend*> translator_pool_;
|
||||
TypePool<PPCTranslator, PPCFrontend*> translator_pool_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_hir_builder.h"
|
||||
|
||||
#include "poly/byte_order.h"
|
||||
#include "poly/memory.h"
|
||||
#include "xenia/base/byte_order.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/memory.h"
|
||||
#include "xenia/cpu/cpu-private.h"
|
||||
#include "xenia/cpu/frontend/ppc_context.h"
|
||||
#include "xenia/cpu/frontend/ppc_disasm.h"
|
||||
@@ -18,7 +19,6 @@
|
||||
#include "xenia/cpu/frontend/ppc_instr.h"
|
||||
#include "xenia/cpu/hir/label.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -82,7 +82,7 @@ int PPCHIRBuilder::Emit(FunctionInfo* symbol_info, uint32_t flags) {
|
||||
for (uint32_t address = start_address, offset = 0; address <= end_address;
|
||||
address += 4, offset++) {
|
||||
i.address = address;
|
||||
i.code = poly::load_and_swap<uint32_t>(memory->TranslateVirtual(address));
|
||||
i.code = xe::load_and_swap<uint32_t>(memory->TranslateVirtual(address));
|
||||
// TODO(benvanik): find a way to avoid using the opcode tables.
|
||||
i.type = GetInstrType(i.code);
|
||||
trace_info_.dest_count = 0;
|
||||
@@ -170,7 +170,7 @@ int PPCHIRBuilder::Emit(FunctionInfo* symbol_info, uint32_t flags) {
|
||||
|
||||
void PPCHIRBuilder::AnnotateLabel(uint32_t address, Label* label) {
|
||||
char name_buffer[13];
|
||||
snprintf(name_buffer, poly::countof(name_buffer), "loc_%.8X", address);
|
||||
snprintf(name_buffer, xe::countof(name_buffer), "loc_%.8X", address);
|
||||
label->name = (char*)arena_->Alloc(sizeof(name_buffer));
|
||||
memcpy(label->name, name_buffer, sizeof(name_buffer));
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
#ifndef XENIA_FRONTEND_PPC_HIR_BUILDER_H_
|
||||
#define XENIA_FRONTEND_PPC_HIR_BUILDER_H_
|
||||
|
||||
#include "xenia/base/string_buffer.h"
|
||||
#include "xenia/cpu/hir/hir_builder.h"
|
||||
#include "xenia/cpu/function.h"
|
||||
#include "xenia/cpu/symbol_info.h"
|
||||
#include "poly/string_buffer.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -91,7 +91,7 @@ class PPCHIRBuilder : public hir::HIRBuilder {
|
||||
PPCFrontend* frontend_;
|
||||
|
||||
// Reset whenever needed:
|
||||
poly::StringBuffer comment_buffer_;
|
||||
StringBuffer comment_buffer_;
|
||||
|
||||
// Reset each Emit:
|
||||
bool with_debug_info_;
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/math.h"
|
||||
#include "poly/string_buffer.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/base/string_buffer.h"
|
||||
#include "xenia/cpu/frontend/ppc_instr_tables.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -24,7 +24,7 @@ namespace frontend {
|
||||
std::vector<InstrType*> all_instrs_;
|
||||
|
||||
void DumpAllInstrCounts() {
|
||||
poly::StringBuffer sb;
|
||||
StringBuffer sb;
|
||||
sb.Append("Instruction translation counts:\n");
|
||||
for (auto instr_type : all_instrs_) {
|
||||
if (instr_type->translation_count) {
|
||||
@@ -42,7 +42,7 @@ void InstrOperand::Dump(std::string& out_str) {
|
||||
}
|
||||
|
||||
char buffer[32];
|
||||
const size_t max_count = poly::countof(buffer);
|
||||
const size_t max_count = xe::countof(buffer);
|
||||
switch (type) {
|
||||
case InstrOperand::kRegister:
|
||||
switch (reg.set) {
|
||||
@@ -380,7 +380,7 @@ InstrType* GetInstrType(uint32_t code) {
|
||||
|
||||
// Slow lookup via linear scan.
|
||||
// This is primarily due to laziness. It could be made fast like the others.
|
||||
for (size_t n = 0; n < poly::countof(tables::instr_table_scan); n++) {
|
||||
for (size_t n = 0; n < xe::countof(tables::instr_table_scan); n++) {
|
||||
slot = &(tables::instr_table_scan[n]);
|
||||
if (slot->opcode == (code & slot->opcode_mask)) {
|
||||
return slot;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "poly/string_buffer.h"
|
||||
#include "xenia/base/string_buffer.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -547,7 +547,7 @@ class InstrDisasm {
|
||||
void Dump(std::string& out_str, size_t pad = 13);
|
||||
};
|
||||
|
||||
typedef void (*InstrDisasmFn)(InstrData& i, poly::StringBuffer* str);
|
||||
typedef void (*InstrDisasmFn)(InstrData& i, StringBuffer* str);
|
||||
typedef void* InstrEmitFn;
|
||||
|
||||
class InstrType {
|
||||
|
||||
@@ -12,84 +12,84 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "poly/math.h"
|
||||
#include "poly/string_buffer.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/base/string_buffer.h"
|
||||
#include "xenia/cpu/frontend/ppc_instr.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
namespace frontend {
|
||||
|
||||
void Disasm_0(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm__(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_FRT_FRB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_A_FRT_FRB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_A_FRT_FRA_FRB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_A_FRT_FRA_FRB_FRC(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_RT_RA_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_RT_RA0_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_FRT_RA_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_FRT_RA0_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_D_RT_RA_I(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_D_RT_RA0_I(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_D_FRT_RA_I(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_D_FRT_RA0_I(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_DS_RT_RA_I(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_DS_RT_RA0_I(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_D_RA(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_RA_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_XO_RT_RA_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_XO_RT_RA(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_RA_RT_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_D_RA_RT_I(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_RA_RT(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_X_VX_RA0_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_VX1281_VD_RA0_RB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_VX1283_VD_VB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_VX1283_VD_VB_I(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_VX_VD_VA_VB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_VX128_VD_VA_VB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_VX128_VD_VA_VD_VB(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_VX1282_VD_VA_VB_VC(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_VXA_VD_VA_VB_VC(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_0(InstrData& i, StringBuffer* str);
|
||||
void Disasm__(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_FRT_FRB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_A_FRT_FRB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_A_FRT_FRA_FRB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_A_FRT_FRA_FRB_FRC(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_RT_RA_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_RT_RA0_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_FRT_RA_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_FRT_RA0_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_RT_RA_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_RT_RA0_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_FRT_RA_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_FRT_RA0_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_DS_RT_RA_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_DS_RT_RA0_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_RA(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_RA_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_XO_RT_RA_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_XO_RT_RA(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_RA_RT_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_D_RA_RT_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_RA_RT(InstrData& i, StringBuffer* str);
|
||||
void Disasm_X_VX_RA0_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX1281_VD_RA0_RB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX1283_VD_VB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX1283_VD_VB_I(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX_VD_VA_VB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX128_VD_VA_VB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX128_VD_VA_VD_VB(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VX1282_VD_VA_VB_VC(InstrData& i, StringBuffer* str);
|
||||
void Disasm_VXA_VD_VA_VB_VC(InstrData& i, StringBuffer* str);
|
||||
|
||||
void Disasm_sync(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_dcbf(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_dcbz(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_fcmp(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_sync(InstrData& i, StringBuffer* str);
|
||||
void Disasm_dcbf(InstrData& i, StringBuffer* str);
|
||||
void Disasm_dcbz(InstrData& i, StringBuffer* str);
|
||||
void Disasm_fcmp(InstrData& i, StringBuffer* str);
|
||||
|
||||
void Disasm_bx(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_bcx(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_bcctrx(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_bclrx(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_bx(InstrData& i, StringBuffer* str);
|
||||
void Disasm_bcx(InstrData& i, StringBuffer* str);
|
||||
void Disasm_bcctrx(InstrData& i, StringBuffer* str);
|
||||
void Disasm_bclrx(InstrData& i, StringBuffer* str);
|
||||
|
||||
void Disasm_mfcr(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_mfspr(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_mtspr(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_mftb(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_mfmsr(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_mtmsr(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_mfcr(InstrData& i, StringBuffer* str);
|
||||
void Disasm_mfspr(InstrData& i, StringBuffer* str);
|
||||
void Disasm_mtspr(InstrData& i, StringBuffer* str);
|
||||
void Disasm_mftb(InstrData& i, StringBuffer* str);
|
||||
void Disasm_mfmsr(InstrData& i, StringBuffer* str);
|
||||
void Disasm_mtmsr(InstrData& i, StringBuffer* str);
|
||||
|
||||
void Disasm_cmp(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_cmpi(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_cmpli(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_cmp(InstrData& i, StringBuffer* str);
|
||||
void Disasm_cmpi(InstrData& i, StringBuffer* str);
|
||||
void Disasm_cmpli(InstrData& i, StringBuffer* str);
|
||||
|
||||
void Disasm_rld(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_rlwim(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_rlwnmx(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_srawix(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_sradix(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_rld(InstrData& i, StringBuffer* str);
|
||||
void Disasm_rlwim(InstrData& i, StringBuffer* str);
|
||||
void Disasm_rlwnmx(InstrData& i, StringBuffer* str);
|
||||
void Disasm_srawix(InstrData& i, StringBuffer* str);
|
||||
void Disasm_sradix(InstrData& i, StringBuffer* str);
|
||||
|
||||
void Disasm_vpermwi128(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vrfin128(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vrlimi128(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vsldoi128(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vspltb(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vsplth(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vspltw(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vspltisb(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vspltish(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vspltisw(InstrData& i, poly::StringBuffer* str);
|
||||
void Disasm_vpermwi128(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vrfin128(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vrlimi128(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vsldoi128(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vspltb(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vsplth(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vspltw(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vspltisb(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vspltish(InstrData& i, StringBuffer* str);
|
||||
void Disasm_vspltisw(InstrData& i, StringBuffer* str);
|
||||
|
||||
namespace tables {
|
||||
|
||||
@@ -364,7 +364,7 @@ static InstrType instr_table_4_unprep[] = {
|
||||
"Vector Logical XOR"),
|
||||
};
|
||||
static InstrType** instr_table_4 = instr_table_prep(
|
||||
instr_table_4_unprep, poly::countof(instr_table_4_unprep), 0, 11);
|
||||
instr_table_4_unprep, xe::countof(instr_table_4_unprep), 0, 11);
|
||||
|
||||
// Opcode = 19, index = bits 10-1 (10)
|
||||
static InstrType instr_table_19_unprep[] = {
|
||||
@@ -384,7 +384,7 @@ static InstrType instr_table_19_unprep[] = {
|
||||
"Branch Conditional to Count Register"),
|
||||
};
|
||||
static InstrType** instr_table_19 = instr_table_prep(
|
||||
instr_table_19_unprep, poly::countof(instr_table_19_unprep), 1, 10);
|
||||
instr_table_19_unprep, xe::countof(instr_table_19_unprep), 1, 10);
|
||||
|
||||
// Opcode = 30, index = bits 4-1 (4)
|
||||
static InstrType instr_table_30_unprep[] = {
|
||||
@@ -400,7 +400,7 @@ static InstrType instr_table_30_unprep[] = {
|
||||
// INSTRUCTION(rldcrx, 0x78000012, MDS, General , 0),
|
||||
};
|
||||
static InstrType** instr_table_30 = instr_table_prep(
|
||||
instr_table_30_unprep, poly::countof(instr_table_30_unprep), 0, 0);
|
||||
instr_table_30_unprep, xe::countof(instr_table_30_unprep), 0, 0);
|
||||
|
||||
// Opcode = 31, index = bits 10-1 (10)
|
||||
static InstrType instr_table_31_unprep[] = {
|
||||
@@ -651,7 +651,7 @@ static InstrType instr_table_31_unprep[] = {
|
||||
"Store Vector Right Indexed LRU"),
|
||||
};
|
||||
static InstrType** instr_table_31 = instr_table_prep(
|
||||
instr_table_31_unprep, poly::countof(instr_table_31_unprep), 1, 10);
|
||||
instr_table_31_unprep, xe::countof(instr_table_31_unprep), 1, 10);
|
||||
|
||||
// Opcode = 58, index = bits 1-0 (2)
|
||||
static InstrType instr_table_58_unprep[] = {
|
||||
@@ -662,7 +662,7 @@ static InstrType instr_table_58_unprep[] = {
|
||||
"Load Word Algebraic"),
|
||||
};
|
||||
static InstrType** instr_table_58 = instr_table_prep(
|
||||
instr_table_58_unprep, poly::countof(instr_table_58_unprep), 0, 1);
|
||||
instr_table_58_unprep, xe::countof(instr_table_58_unprep), 0, 1);
|
||||
|
||||
// Opcode = 59, index = bits 5-1 (5)
|
||||
static InstrType instr_table_59_unprep[] = {
|
||||
@@ -688,7 +688,7 @@ static InstrType instr_table_59_unprep[] = {
|
||||
"Floating Negative Multiply-Add [Single]"),
|
||||
};
|
||||
static InstrType** instr_table_59 = instr_table_prep(
|
||||
instr_table_59_unprep, poly::countof(instr_table_59_unprep), 1, 5);
|
||||
instr_table_59_unprep, xe::countof(instr_table_59_unprep), 1, 5);
|
||||
|
||||
// Opcode = 62, index = bits 1-0 (2)
|
||||
static InstrType instr_table_62_unprep[] = {
|
||||
@@ -697,7 +697,7 @@ static InstrType instr_table_62_unprep[] = {
|
||||
"Store Doubleword with Update"),
|
||||
};
|
||||
static InstrType** instr_table_62 = instr_table_prep(
|
||||
instr_table_62_unprep, poly::countof(instr_table_62_unprep), 0, 1);
|
||||
instr_table_62_unprep, xe::countof(instr_table_62_unprep), 0, 1);
|
||||
|
||||
// Opcode = 63, index = bits 10-1 (10)
|
||||
// NOTE: the A format instructions need some special handling because
|
||||
@@ -757,7 +757,7 @@ static InstrType instr_table_63_unprep[] = {
|
||||
"Floating Convert From Integer Doubleword"),
|
||||
};
|
||||
static InstrType** instr_table_63 = instr_table_prep_63(
|
||||
instr_table_63_unprep, poly::countof(instr_table_63_unprep), 1, 10);
|
||||
instr_table_63_unprep, xe::countof(instr_table_63_unprep), 1, 10);
|
||||
|
||||
// Main table, index = bits 31-26 (6) : (code >> 26)
|
||||
static InstrType instr_table_unprep[64] = {
|
||||
@@ -837,7 +837,7 @@ static InstrType instr_table_unprep[64] = {
|
||||
"Store Floating-Point Double with Update"),
|
||||
};
|
||||
static InstrType** instr_table = instr_table_prep(
|
||||
instr_table_unprep, poly::countof(instr_table_unprep), 26, 31);
|
||||
instr_table_unprep, xe::countof(instr_table_unprep), 26, 31);
|
||||
|
||||
// Altivec instructions.
|
||||
// TODO(benvanik): build a table like the other instructions.
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
|
||||
#include "poly/memory.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/memory.h"
|
||||
#include "xenia/cpu/frontend/ppc_frontend.h"
|
||||
#include "xenia/cpu/frontend/ppc_instr.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
#if 0
|
||||
@@ -63,7 +63,7 @@ int PPCScanner::FindExtents(FunctionInfo* symbol_info) {
|
||||
InstrData i;
|
||||
while (true) {
|
||||
i.address = address;
|
||||
i.code = poly::load_and_swap<uint32_t>(memory->TranslateVirtual(address));
|
||||
i.code = xe::load_and_swap<uint32_t>(memory->TranslateVirtual(address));
|
||||
|
||||
// If we fetched 0 assume that we somehow hit one of the awesome
|
||||
// 'no really we meant to end after that bl' functions.
|
||||
@@ -290,7 +290,7 @@ std::vector<BlockInfo> PPCScanner::FindBlocks(FunctionInfo* symbol_info) {
|
||||
InstrData i;
|
||||
for (uint32_t address = start_address; address <= end_address; address += 4) {
|
||||
i.address = address;
|
||||
i.code = poly::load_and_swap<uint32_t>(memory->TranslateVirtual(address));
|
||||
i.code = xe::load_and_swap<uint32_t>(memory->TranslateVirtual(address));
|
||||
if (!i.code) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
#include "xenia/cpu/frontend/ppc_translator.h"
|
||||
|
||||
#include "poly/assert.h"
|
||||
#include "poly/byte_order.h"
|
||||
#include "poly/memory.h"
|
||||
#include "poly/reset_scope.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/byte_order.h"
|
||||
#include "xenia/base/memory.h"
|
||||
#include "xenia/base/reset_scope.h"
|
||||
#include "xenia/cpu/compiler/compiler_passes.h"
|
||||
#include "xenia/cpu/cpu-private.h"
|
||||
#include "xenia/cpu/frontend/ppc_disasm.h"
|
||||
@@ -92,10 +92,10 @@ int PPCTranslator::Translate(FunctionInfo* symbol_info,
|
||||
SCOPE_profile_cpu_f("cpu");
|
||||
|
||||
// Reset() all caching when we leave.
|
||||
poly::make_reset_scope(builder_);
|
||||
poly::make_reset_scope(compiler_);
|
||||
poly::make_reset_scope(assembler_);
|
||||
poly::make_reset_scope(&string_buffer_);
|
||||
xe::make_reset_scope(builder_);
|
||||
xe::make_reset_scope(compiler_);
|
||||
xe::make_reset_scope(assembler_);
|
||||
xe::make_reset_scope(&string_buffer_);
|
||||
|
||||
// Scan the function to find its extents. We only need to do this if we
|
||||
// haven't already been provided with them from some other source.
|
||||
@@ -176,7 +176,7 @@ int PPCTranslator::Translate(FunctionInfo* symbol_info,
|
||||
};
|
||||
|
||||
void PPCTranslator::DumpSource(FunctionInfo* symbol_info,
|
||||
poly::StringBuffer* string_buffer) {
|
||||
StringBuffer* string_buffer) {
|
||||
Memory* memory = frontend_->memory();
|
||||
|
||||
string_buffer->Append("%s fn %.8X-%.8X %s\n",
|
||||
@@ -193,7 +193,7 @@ void PPCTranslator::DumpSource(FunctionInfo* symbol_info,
|
||||
for (uint32_t address = start_address, offset = 0; address <= end_address;
|
||||
address += 4, offset++) {
|
||||
i.address = address;
|
||||
i.code = poly::load_and_swap<uint32_t>(memory->TranslateVirtual(address));
|
||||
i.code = xe::load_and_swap<uint32_t>(memory->TranslateVirtual(address));
|
||||
// TODO(benvanik): find a way to avoid using the opcode tables.
|
||||
i.type = GetInstrType(i.code);
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "xenia/base/string_buffer.h"
|
||||
#include "xenia/cpu/backend/assembler.h"
|
||||
#include "xenia/cpu/compiler/compiler.h"
|
||||
#include "xenia/cpu/symbol_info.h"
|
||||
#include "poly/string_buffer.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -34,7 +34,7 @@ class PPCTranslator {
|
||||
uint32_t trace_flags, Function** out_function);
|
||||
|
||||
private:
|
||||
void DumpSource(FunctionInfo* symbol_info, poly::StringBuffer* string_buffer);
|
||||
void DumpSource(FunctionInfo* symbol_info, StringBuffer* string_buffer);
|
||||
|
||||
private:
|
||||
PPCFrontend* frontend_;
|
||||
@@ -43,7 +43,7 @@ class PPCTranslator {
|
||||
std::unique_ptr<compiler::Compiler> compiler_;
|
||||
std::unique_ptr<backend::Assembler> assembler_;
|
||||
|
||||
poly::StringBuffer string_buffer_;
|
||||
StringBuffer string_buffer_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "poly/main.h"
|
||||
#include "poly/math.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/main.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/cpu/cpu.h"
|
||||
#include "xenia/cpu/backend/x64/x64_backend.h"
|
||||
#include "xenia/cpu/frontend/ppc_context.h"
|
||||
#include "xenia/cpu/frontend/ppc_frontend.h"
|
||||
#include "xenia/cpu/raw_module.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
#if !XE_PLATFORM_WIN32
|
||||
#include <dirent.h>
|
||||
@@ -48,11 +48,11 @@ struct TestCase {
|
||||
class TestSuite {
|
||||
public:
|
||||
TestSuite(const std::wstring& src_file_path) : src_file_path(src_file_path) {
|
||||
name = src_file_path.substr(
|
||||
src_file_path.find_last_of(poly::path_separator) + 1);
|
||||
name = src_file_path.substr(src_file_path.find_last_of(xe::path_separator) +
|
||||
1);
|
||||
name = ReplaceExtension(name, L"");
|
||||
map_file_path = poly::to_wstring(FLAGS_test_bin_path) + name + L".map";
|
||||
bin_file_path = poly::to_wstring(FLAGS_test_bin_path) + name + L".bin";
|
||||
map_file_path = xe::to_wstring(FLAGS_test_bin_path) + name + L".map";
|
||||
bin_file_path = xe::to_wstring(FLAGS_test_bin_path) + name + L".bin";
|
||||
}
|
||||
|
||||
bool Load() {
|
||||
@@ -92,7 +92,7 @@ class TestSuite {
|
||||
}
|
||||
|
||||
bool ReadMap(const std::wstring& map_file_path) {
|
||||
FILE* f = fopen(poly::to_string(map_file_path).c_str(), "r");
|
||||
FILE* f = fopen(xe::to_string(map_file_path).c_str(), "r");
|
||||
if (!f) {
|
||||
return false;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ class TestSuite {
|
||||
|
||||
bool ReadAnnotations(const std::wstring& src_file_path) {
|
||||
TestCase* current_test_case = nullptr;
|
||||
FILE* f = fopen(poly::to_string(src_file_path).c_str(), "r");
|
||||
FILE* f = fopen(xe::to_string(src_file_path).c_str(), "r");
|
||||
if (!f) {
|
||||
return false;
|
||||
}
|
||||
@@ -273,7 +273,7 @@ class TestRunner {
|
||||
auto reg_value = it.second.substr(space_pos + 1);
|
||||
if (!ppc_state->CompareRegWithString(reg_name.c_str(),
|
||||
reg_value.c_str(), actual_value,
|
||||
poly::countof(actual_value))) {
|
||||
xe::countof(actual_value))) {
|
||||
any_failed = true;
|
||||
printf("Register %s assert failed:\n", reg_name.c_str());
|
||||
printf(" Expected: %s == %s\n", reg_name.c_str(), reg_value.c_str());
|
||||
@@ -373,7 +373,7 @@ bool RunTests(const std::wstring& test_name) {
|
||||
int passed_count = 0;
|
||||
|
||||
auto test_path_root =
|
||||
poly::fix_path_separators(poly::to_wstring(FLAGS_test_path));
|
||||
xe::fix_path_separators(xe::to_wstring(FLAGS_test_path));
|
||||
std::vector<std::wstring> test_files;
|
||||
if (!DiscoverTests(test_path_root, test_files)) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user