|
1 | 1 | //! This module defines x86_64-specific machine instruction types. |
2 | 2 |
|
3 | 3 | pub use emit_state::EmitState; |
| 4 | +use regalloc2::PRegSet; |
4 | 5 |
|
5 | 6 | use crate::binemit::{Addend, CodeOffset, Reloc}; |
6 | 7 | use crate::ir::{ExternalName, LibCall, TrapCode, Type, types}; |
@@ -96,6 +97,7 @@ impl Inst { |
96 | 97 | | Inst::Args { .. } |
97 | 98 | | Inst::Rets { .. } |
98 | 99 | | Inst::StackSwitchBasic { .. } |
| 100 | + | Inst::DeadLoadWithContext { .. } |
99 | 101 | | Inst::TrapIf { .. } |
100 | 102 | | Inst::TrapIfAnd { .. } |
101 | 103 | | Inst::TrapIfOr { .. } |
@@ -671,6 +673,12 @@ impl PrettyPrint for Inst { |
671 | 673 | ) |
672 | 674 | } |
673 | 675 |
|
| 676 | + Inst::DeadLoadWithContext { load_ptr, context } => { |
| 677 | + let load_ptr = pretty_print_reg(**load_ptr, 8); |
| 678 | + let context = pretty_print_reg(**context, 8); |
| 679 | + format!("dead_load_with_context {load_ptr}, {context}") |
| 680 | + } |
| 681 | + |
674 | 682 | Inst::JmpKnown { dst } => { |
675 | 683 | let op = ljustify("jmp".to_string()); |
676 | 684 | let dst = dst.to_string(); |
@@ -1045,6 +1053,19 @@ fn x64_get_operands(inst: &mut Inst, collector: &mut impl OperandVisitor) { |
1045 | 1053 | collector.reg_clobbers(clobbers); |
1046 | 1054 | } |
1047 | 1055 |
|
| 1056 | + Inst::DeadLoadWithContext { load_ptr, context } => { |
| 1057 | + // load_ptr is an input param. |
| 1058 | + collector.reg_use(load_ptr); |
| 1059 | + // Demand context (vmctx) go into RDI. |
| 1060 | + // TODO: Do I still have to move it, or will regalloc make sure it's there? |
| 1061 | + collector.reg_fixed_use(context, regs::rdi()); |
| 1062 | + // Reserve r10 as a place for the signal handler to stow the return |
| 1063 | + // address (which we're overwriting with that of the epoch-ending |
| 1064 | + // stub). Picking r10 because it's caller-saved but otherwise |
| 1065 | + // arbitrarily. |
| 1066 | + collector.reg_clobbers(PRegSet::empty().with(regs::gpr_preg(asm::gpr::enc::R10))); |
| 1067 | + } |
| 1068 | + |
1048 | 1069 | Inst::ReturnCallKnown { info } => { |
1049 | 1070 | let ReturnCallInfo { |
1050 | 1071 | dest, uses, tmp, .. |
|
0 commit comments