[ABI] X86/X64 GP registers should use the real type (GpbLo, GpbHi, Gpw, Gpd, Gpq) and not just Gp (fixes #292)

This commit is contained in:
kobalicek
2021-01-26 01:30:59 +01:00
parent 0636dd316a
commit 6678143772
2 changed files with 72 additions and 72 deletions

View File

@@ -545,78 +545,78 @@ static constexpr Bnd bnd(uint32_t rId) noexcept { return Bnd(rId); }
//! Creates a TMM register operand. //! Creates a TMM register operand.
static constexpr Tmm tmm(uint32_t rId) noexcept { return Tmm(rId); } static constexpr Tmm tmm(uint32_t rId) noexcept { return Tmm(rId); }
static constexpr Gp al = Gp(Gp::SignatureAndId(GpbLo::kSignature, Gp::kIdAx)); static constexpr GpbLo al = GpbLo(Gp::kIdAx);
static constexpr Gp bl = Gp(Gp::SignatureAndId(GpbLo::kSignature, Gp::kIdBx)); static constexpr GpbLo bl = GpbLo(Gp::kIdBx);
static constexpr Gp cl = Gp(Gp::SignatureAndId(GpbLo::kSignature, Gp::kIdCx)); static constexpr GpbLo cl = GpbLo(Gp::kIdCx);
static constexpr Gp dl = Gp(Gp::SignatureAndId(GpbLo::kSignature, Gp::kIdDx)); static constexpr GpbLo dl = GpbLo(Gp::kIdDx);
static constexpr Gp spl = Gp(Gp::SignatureAndId(GpbLo::kSignature, Gp::kIdSp)); static constexpr GpbLo spl = GpbLo(Gp::kIdSp);
static constexpr Gp bpl = Gp(Gp::SignatureAndId(GpbLo::kSignature, Gp::kIdBp)); static constexpr GpbLo bpl = GpbLo(Gp::kIdBp);
static constexpr Gp sil = Gp(Gp::SignatureAndId(GpbLo::kSignature, Gp::kIdSi)); static constexpr GpbLo sil = GpbLo(Gp::kIdSi);
static constexpr Gp dil = Gp(Gp::SignatureAndId(GpbLo::kSignature, Gp::kIdDi)); static constexpr GpbLo dil = GpbLo(Gp::kIdDi);
static constexpr Gp r8b = Gp(Gp::SignatureAndId(GpbLo::kSignature, Gp::kIdR8)); static constexpr GpbLo r8b = GpbLo(Gp::kIdR8);
static constexpr Gp r9b = Gp(Gp::SignatureAndId(GpbLo::kSignature, Gp::kIdR9)); static constexpr GpbLo r9b = GpbLo(Gp::kIdR9);
static constexpr Gp r10b = Gp(Gp::SignatureAndId(GpbLo::kSignature, Gp::kIdR10)); static constexpr GpbLo r10b = GpbLo(Gp::kIdR10);
static constexpr Gp r11b = Gp(Gp::SignatureAndId(GpbLo::kSignature, Gp::kIdR11)); static constexpr GpbLo r11b = GpbLo(Gp::kIdR11);
static constexpr Gp r12b = Gp(Gp::SignatureAndId(GpbLo::kSignature, Gp::kIdR12)); static constexpr GpbLo r12b = GpbLo(Gp::kIdR12);
static constexpr Gp r13b = Gp(Gp::SignatureAndId(GpbLo::kSignature, Gp::kIdR13)); static constexpr GpbLo r13b = GpbLo(Gp::kIdR13);
static constexpr Gp r14b = Gp(Gp::SignatureAndId(GpbLo::kSignature, Gp::kIdR14)); static constexpr GpbLo r14b = GpbLo(Gp::kIdR14);
static constexpr Gp r15b = Gp(Gp::SignatureAndId(GpbLo::kSignature, Gp::kIdR15)); static constexpr GpbLo r15b = GpbLo(Gp::kIdR15);
static constexpr Gp ah = Gp(Gp::SignatureAndId(GpbHi::kSignature, Gp::kIdAx)); static constexpr GpbHi ah = GpbHi(Gp::kIdAx);
static constexpr Gp bh = Gp(Gp::SignatureAndId(GpbHi::kSignature, Gp::kIdBx)); static constexpr GpbHi bh = GpbHi(Gp::kIdBx);
static constexpr Gp ch = Gp(Gp::SignatureAndId(GpbHi::kSignature, Gp::kIdCx)); static constexpr GpbHi ch = GpbHi(Gp::kIdCx);
static constexpr Gp dh = Gp(Gp::SignatureAndId(GpbHi::kSignature, Gp::kIdDx)); static constexpr GpbHi dh = GpbHi(Gp::kIdDx);
static constexpr Gp ax = Gp(Gp::SignatureAndId(Gpw::kSignature, Gp::kIdAx)); static constexpr Gpw ax = Gpw(Gp::kIdAx);
static constexpr Gp bx = Gp(Gp::SignatureAndId(Gpw::kSignature, Gp::kIdBx)); static constexpr Gpw bx = Gpw(Gp::kIdBx);
static constexpr Gp cx = Gp(Gp::SignatureAndId(Gpw::kSignature, Gp::kIdCx)); static constexpr Gpw cx = Gpw(Gp::kIdCx);
static constexpr Gp dx = Gp(Gp::SignatureAndId(Gpw::kSignature, Gp::kIdDx)); static constexpr Gpw dx = Gpw(Gp::kIdDx);
static constexpr Gp sp = Gp(Gp::SignatureAndId(Gpw::kSignature, Gp::kIdSp)); static constexpr Gpw sp = Gpw(Gp::kIdSp);
static constexpr Gp bp = Gp(Gp::SignatureAndId(Gpw::kSignature, Gp::kIdBp)); static constexpr Gpw bp = Gpw(Gp::kIdBp);
static constexpr Gp si = Gp(Gp::SignatureAndId(Gpw::kSignature, Gp::kIdSi)); static constexpr Gpw si = Gpw(Gp::kIdSi);
static constexpr Gp di = Gp(Gp::SignatureAndId(Gpw::kSignature, Gp::kIdDi)); static constexpr Gpw di = Gpw(Gp::kIdDi);
static constexpr Gp r8w = Gp(Gp::SignatureAndId(Gpw::kSignature, Gp::kIdR8)); static constexpr Gpw r8w = Gpw(Gp::kIdR8);
static constexpr Gp r9w = Gp(Gp::SignatureAndId(Gpw::kSignature, Gp::kIdR9)); static constexpr Gpw r9w = Gpw(Gp::kIdR9);
static constexpr Gp r10w = Gp(Gp::SignatureAndId(Gpw::kSignature, Gp::kIdR10)); static constexpr Gpw r10w = Gpw(Gp::kIdR10);
static constexpr Gp r11w = Gp(Gp::SignatureAndId(Gpw::kSignature, Gp::kIdR11)); static constexpr Gpw r11w = Gpw(Gp::kIdR11);
static constexpr Gp r12w = Gp(Gp::SignatureAndId(Gpw::kSignature, Gp::kIdR12)); static constexpr Gpw r12w = Gpw(Gp::kIdR12);
static constexpr Gp r13w = Gp(Gp::SignatureAndId(Gpw::kSignature, Gp::kIdR13)); static constexpr Gpw r13w = Gpw(Gp::kIdR13);
static constexpr Gp r14w = Gp(Gp::SignatureAndId(Gpw::kSignature, Gp::kIdR14)); static constexpr Gpw r14w = Gpw(Gp::kIdR14);
static constexpr Gp r15w = Gp(Gp::SignatureAndId(Gpw::kSignature, Gp::kIdR15)); static constexpr Gpw r15w = Gpw(Gp::kIdR15);
static constexpr Gp eax = Gp(Gp::SignatureAndId(Gpd::kSignature, Gp::kIdAx)); static constexpr Gpd eax = Gpd(Gp::kIdAx);
static constexpr Gp ebx = Gp(Gp::SignatureAndId(Gpd::kSignature, Gp::kIdBx)); static constexpr Gpd ebx = Gpd(Gp::kIdBx);
static constexpr Gp ecx = Gp(Gp::SignatureAndId(Gpd::kSignature, Gp::kIdCx)); static constexpr Gpd ecx = Gpd(Gp::kIdCx);
static constexpr Gp edx = Gp(Gp::SignatureAndId(Gpd::kSignature, Gp::kIdDx)); static constexpr Gpd edx = Gpd(Gp::kIdDx);
static constexpr Gp esp = Gp(Gp::SignatureAndId(Gpd::kSignature, Gp::kIdSp)); static constexpr Gpd esp = Gpd(Gp::kIdSp);
static constexpr Gp ebp = Gp(Gp::SignatureAndId(Gpd::kSignature, Gp::kIdBp)); static constexpr Gpd ebp = Gpd(Gp::kIdBp);
static constexpr Gp esi = Gp(Gp::SignatureAndId(Gpd::kSignature, Gp::kIdSi)); static constexpr Gpd esi = Gpd(Gp::kIdSi);
static constexpr Gp edi = Gp(Gp::SignatureAndId(Gpd::kSignature, Gp::kIdDi)); static constexpr Gpd edi = Gpd(Gp::kIdDi);
static constexpr Gp r8d = Gp(Gp::SignatureAndId(Gpd::kSignature, Gp::kIdR8)); static constexpr Gpd r8d = Gpd(Gp::kIdR8);
static constexpr Gp r9d = Gp(Gp::SignatureAndId(Gpd::kSignature, Gp::kIdR9)); static constexpr Gpd r9d = Gpd(Gp::kIdR9);
static constexpr Gp r10d = Gp(Gp::SignatureAndId(Gpd::kSignature, Gp::kIdR10)); static constexpr Gpd r10d = Gpd(Gp::kIdR10);
static constexpr Gp r11d = Gp(Gp::SignatureAndId(Gpd::kSignature, Gp::kIdR11)); static constexpr Gpd r11d = Gpd(Gp::kIdR11);
static constexpr Gp r12d = Gp(Gp::SignatureAndId(Gpd::kSignature, Gp::kIdR12)); static constexpr Gpd r12d = Gpd(Gp::kIdR12);
static constexpr Gp r13d = Gp(Gp::SignatureAndId(Gpd::kSignature, Gp::kIdR13)); static constexpr Gpd r13d = Gpd(Gp::kIdR13);
static constexpr Gp r14d = Gp(Gp::SignatureAndId(Gpd::kSignature, Gp::kIdR14)); static constexpr Gpd r14d = Gpd(Gp::kIdR14);
static constexpr Gp r15d = Gp(Gp::SignatureAndId(Gpd::kSignature, Gp::kIdR15)); static constexpr Gpd r15d = Gpd(Gp::kIdR15);
static constexpr Gp rax = Gp(Gp::SignatureAndId(Gpq::kSignature, Gp::kIdAx)); static constexpr Gpq rax = Gpq(Gp::kIdAx);
static constexpr Gp rbx = Gp(Gp::SignatureAndId(Gpq::kSignature, Gp::kIdBx)); static constexpr Gpq rbx = Gpq(Gp::kIdBx);
static constexpr Gp rcx = Gp(Gp::SignatureAndId(Gpq::kSignature, Gp::kIdCx)); static constexpr Gpq rcx = Gpq(Gp::kIdCx);
static constexpr Gp rdx = Gp(Gp::SignatureAndId(Gpq::kSignature, Gp::kIdDx)); static constexpr Gpq rdx = Gpq(Gp::kIdDx);
static constexpr Gp rsp = Gp(Gp::SignatureAndId(Gpq::kSignature, Gp::kIdSp)); static constexpr Gpq rsp = Gpq(Gp::kIdSp);
static constexpr Gp rbp = Gp(Gp::SignatureAndId(Gpq::kSignature, Gp::kIdBp)); static constexpr Gpq rbp = Gpq(Gp::kIdBp);
static constexpr Gp rsi = Gp(Gp::SignatureAndId(Gpq::kSignature, Gp::kIdSi)); static constexpr Gpq rsi = Gpq(Gp::kIdSi);
static constexpr Gp rdi = Gp(Gp::SignatureAndId(Gpq::kSignature, Gp::kIdDi)); static constexpr Gpq rdi = Gpq(Gp::kIdDi);
static constexpr Gp r8 = Gp(Gp::SignatureAndId(Gpq::kSignature, Gp::kIdR8)); static constexpr Gpq r8 = Gpq(Gp::kIdR8);
static constexpr Gp r9 = Gp(Gp::SignatureAndId(Gpq::kSignature, Gp::kIdR9)); static constexpr Gpq r9 = Gpq(Gp::kIdR9);
static constexpr Gp r10 = Gp(Gp::SignatureAndId(Gpq::kSignature, Gp::kIdR10)); static constexpr Gpq r10 = Gpq(Gp::kIdR10);
static constexpr Gp r11 = Gp(Gp::SignatureAndId(Gpq::kSignature, Gp::kIdR11)); static constexpr Gpq r11 = Gpq(Gp::kIdR11);
static constexpr Gp r12 = Gp(Gp::SignatureAndId(Gpq::kSignature, Gp::kIdR12)); static constexpr Gpq r12 = Gpq(Gp::kIdR12);
static constexpr Gp r13 = Gp(Gp::SignatureAndId(Gpq::kSignature, Gp::kIdR13)); static constexpr Gpq r13 = Gpq(Gp::kIdR13);
static constexpr Gp r14 = Gp(Gp::SignatureAndId(Gpq::kSignature, Gp::kIdR14)); static constexpr Gpq r14 = Gpq(Gp::kIdR14);
static constexpr Gp r15 = Gp(Gp::SignatureAndId(Gpq::kSignature, Gp::kIdR15)); static constexpr Gpq r15 = Gpq(Gp::kIdR15);
static constexpr Xmm xmm0 = Xmm(0); static constexpr Xmm xmm0 = Xmm(0);
static constexpr Xmm xmm1 = Xmm(1); static constexpr Xmm xmm1 = Xmm(1);

View File

@@ -55,10 +55,10 @@ static void generateOpcodes(asmjit::x86::Emitter* e, bool useRex1 = false, bool
Gp gdB = useRex2 ? r9d : ebx; Gp gdB = useRex2 ? r9d : ebx;
Gp gdC = useRex2 ? r10d : ecx; Gp gdC = useRex2 ? r10d : ecx;
Gp gzA = useRex1 ? r8 : e->zax(); Gp gzA = useRex1 ? r8.as<Gp>() : e->zax();
Gp gzB = useRex2 ? r9 : e->zbx(); Gp gzB = useRex2 ? r9.as<Gp>() : e->zbx();
Gp gzC = useRex2 ? r10 : e->zcx(); Gp gzC = useRex2 ? r10.as<Gp>() : e->zcx();
Gp gzD = useRex2 ? r11 : e->zdx(); Gp gzD = useRex2 ? r11.as<Gp>() : e->zdx();
KReg kA = k1; KReg kA = k1;
KReg kB = k2; KReg kB = k2;