Don't use %rcx directly with CoffTlsGetAddr (#5278)

Avoid naming %rcx as written by the CoffTlsGetAddr pseudo-instruction in the x64 backend, and instead emit a fixed-def constraint for a fresh VReg and %rcx.
This commit is contained in:
Trevor Elliott
2022-11-16 11:32:09 -08:00
committed by GitHub
parent 5a006674c3
commit 4780bd5902
4 changed files with 31 additions and 7 deletions

View File

@@ -3195,10 +3195,18 @@ pub(crate) fn emit(
sink.put1(0x17);
}
Inst::CoffTlsGetAddr { ref symbol, dst } => {
Inst::CoffTlsGetAddr {
ref symbol,
dst,
tmp,
} => {
let dst = allocs.next(dst.to_reg().to_reg());
debug_assert_eq!(dst, regs::rax());
// tmp is used below directly as %rcx
let tmp = allocs.next(tmp.to_reg().to_reg());
debug_assert_eq!(tmp, regs::rcx());
// See: https://gcc.godbolt.org/z/M8or9x6ss
// And: https://github.com/bjorn3/rustc_codegen_cranelift/issues/388#issuecomment-532930282