Browse Source

ISLE: use `lower_to_amode` inside `sink_load` implementation

pull/3506/head
Nick Fitzgerald 3 years ago
parent
commit
bbb4949128
  1. 22
      cranelift/codegen/src/isa/x64/lower/isle.rs

22
cranelift/codegen/src/isa/x64/lower/isle.rs

@ -8,13 +8,12 @@ use super::{
is_mergeable_load, lower_to_amode, AluRmiROpcode, Inst as MInst, OperandSize, Reg, RegMemImm, is_mergeable_load, lower_to_amode, AluRmiROpcode, Inst as MInst, OperandSize, Reg, RegMemImm,
Writable, Writable,
}; };
use crate::isa::x64::inst::args::SyntheticAmode;
use crate::isa::x64::settings as x64_settings; use crate::isa::x64::settings as x64_settings;
use crate::{ use crate::{
ir::{immediates::*, types::*, Inst, InstructionData, Opcode, Value, ValueList}, ir::{immediates::*, types::*, Inst, InstructionData, Opcode, Value, ValueList},
isa::x64::inst::{ isa::x64::inst::{
args::{ args::{Avx512Opcode, CmpOpcode, ExtMode, Imm8Reg, RegMem, ShiftKind, SseOpcode, CC},
Amode, Avx512Opcode, CmpOpcode, ExtMode, Imm8Reg, RegMem, ShiftKind, SseOpcode, CC,
},
x64_map_regs, RegMapper, x64_map_regs, RegMapper,
}, },
machinst::{get_output_reg, InsnInput, InsnOutput, LowerCtx}, machinst::{get_output_reg, InsnInput, InsnOutput, LowerCtx},
@ -369,22 +368,9 @@ where
fn sink_load(&mut self, load: &SinkableLoad) -> RegMemImm { fn sink_load(&mut self, load: &SinkableLoad) -> RegMemImm {
self.lower_ctx.sink_inst(load.inst); self.lower_ctx.sink_inst(load.inst);
let addr = lower_to_amode(self.lower_ctx, load.addr_input, load.offset);
let flags = self
.lower_ctx
.memflags(load.inst)
.expect("sinkable loads should have memflags");
let base = self
.lower_ctx
.put_input_in_regs(load.addr_input.insn, load.addr_input.input)
.only_reg()
.unwrap();
RegMemImm::Mem { RegMemImm::Mem {
addr: Amode::imm_reg(load.offset as u32, base) addr: SyntheticAmode::Real(addr),
.with_flags(flags)
.into(),
} }
} }

Loading…
Cancel
Save