emit_x64: Port to new register allocator interface
This commit is contained in:
parent
f883bad2cc
commit
08a467bf9a
3 changed files with 796 additions and 833 deletions
File diff suppressed because it is too large
Load diff
|
@ -56,9 +56,9 @@ static void EmitMove(BlockOfCode* code, HostLoc to, HostLoc from) {
|
||||||
} else if (HostLocIsGPR(to) && HostLocIsGPR(from)) {
|
} else if (HostLocIsGPR(to) && HostLocIsGPR(from)) {
|
||||||
code->mov(HostLocToReg64(to), HostLocToReg64(from));
|
code->mov(HostLocToReg64(to), HostLocToReg64(from));
|
||||||
} else if (HostLocIsXMM(to) && HostLocIsGPR(from)) {
|
} else if (HostLocIsXMM(to) && HostLocIsGPR(from)) {
|
||||||
ASSERT_MSG(false, "TODO");
|
code->movq(HostLocToXmm(to), HostLocToReg64(from));
|
||||||
} else if (HostLocIsGPR(to) && HostLocIsXMM(from)) {
|
} else if (HostLocIsGPR(to) && HostLocIsXMM(from)) {
|
||||||
ASSERT_MSG(false, "TODO");
|
code->movq(HostLocToReg64(to), HostLocToXmm(from));
|
||||||
} else if (HostLocIsXMM(to) && HostLocIsSpill(from)) {
|
} else if (HostLocIsXMM(to) && HostLocIsSpill(from)) {
|
||||||
code->movsd(HostLocToXmm(to), SpillToOpArg(from));
|
code->movsd(HostLocToXmm(to), SpillToOpArg(from));
|
||||||
} else if (HostLocIsSpill(to) && HostLocIsXMM(from)) {
|
} else if (HostLocIsSpill(to) && HostLocIsXMM(from)) {
|
||||||
|
@ -82,6 +82,10 @@ static void EmitExchange(BlockOfCode* code, HostLoc a, HostLoc b) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Argument::GetImmediateU1() const {
|
||||||
|
return value.GetU1();
|
||||||
|
}
|
||||||
|
|
||||||
u8 Argument::GetImmediateU8() const {
|
u8 Argument::GetImmediateU8() const {
|
||||||
u64 imm = ImmediateToU64(value);
|
u64 imm = ImmediateToU64(value);
|
||||||
ASSERT(imm < 0x100);
|
ASSERT(imm < 0x100);
|
||||||
|
|
|
@ -76,6 +76,7 @@ public:
|
||||||
return value.IsImmediate();
|
return value.IsImmediate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GetImmediateU1() const;
|
||||||
u8 GetImmediateU8() const;
|
u8 GetImmediateU8() const;
|
||||||
u16 GetImmediateU16() const;
|
u16 GetImmediateU16() const;
|
||||||
u32 GetImmediateU32() const;
|
u32 GetImmediateU32() const;
|
||||||
|
@ -113,6 +114,9 @@ public:
|
||||||
arg.allocated = true;
|
arg.allocated = true;
|
||||||
return HostLocToXmm(UseHostLocReg(arg.value, any_xmm));
|
return HostLocToXmm(UseHostLocReg(arg.value, any_xmm));
|
||||||
}
|
}
|
||||||
|
OpArg UseOpArg(Argument& arg) {
|
||||||
|
return UseGpr(arg);
|
||||||
|
}
|
||||||
void Use(Argument& arg, HostLoc host_loc) {
|
void Use(Argument& arg, HostLoc host_loc) {
|
||||||
ASSERT(!arg.allocated);
|
ASSERT(!arg.allocated);
|
||||||
arg.allocated = true;
|
arg.allocated = true;
|
||||||
|
@ -135,12 +139,9 @@ public:
|
||||||
UseScratchHostLocReg(arg.value, {host_loc});
|
UseScratchHostLocReg(arg.value, {host_loc});
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefineValue(IR::Inst* inst, const Xbyak::Reg64& reg) {
|
void DefineValue(IR::Inst* inst, const Xbyak::Reg& reg) {
|
||||||
HostLoc hostloc = static_cast<HostLoc>(reg.getIdx() + static_cast<size_t>(HostLoc::RAX));
|
ASSERT(reg.getKind() == Xbyak::Operand::XMM || reg.getKind() == Xbyak::Operand::REG);
|
||||||
DefineValue(inst, hostloc);
|
HostLoc hostloc = static_cast<HostLoc>(reg.getIdx() + static_cast<size_t>(reg.getKind() == Xbyak::Operand::XMM ? HostLoc::XMM0 : HostLoc::RAX));
|
||||||
}
|
|
||||||
void DefineValue(IR::Inst* inst, const Xbyak::Xmm& reg) {
|
|
||||||
HostLoc hostloc = static_cast<HostLoc>(reg.getIdx() + static_cast<size_t>(HostLoc::XMM0));
|
|
||||||
DefineValue(inst, hostloc);
|
DefineValue(inst, hostloc);
|
||||||
}
|
}
|
||||||
void DefineValue(IR::Inst* inst, Argument& arg) {
|
void DefineValue(IR::Inst* inst, Argument& arg) {
|
||||||
|
|
Loading…
Reference in a new issue