Skip to content

Commit

Permalink
machinst x64: inline helper used only once;
Browse files Browse the repository at this point in the history
  • Loading branch information
bnjbvr committed Sep 9, 2020
1 parent 7a833f4 commit cb96d16
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions cranelift/codegen/src/isa/x64/lower.rs
Expand Up @@ -53,10 +53,6 @@ fn is_valid_atomic_transaction_ty(ty: Type) -> bool {
}
}

fn iri_to_u64_imm(ctx: Ctx, inst: IRInst) -> Option<u64> {
ctx.get_constant(inst)
}

/// Returns whether the given specified `input` is a result produced by an instruction with Opcode
/// `op`.
// TODO investigate failures with checking against the result index.
Expand Down Expand Up @@ -454,13 +450,12 @@ fn lower_insn_to_regs<C: LowerCtx<I = Inst>>(

match op {
Opcode::Iconst | Opcode::Bconst | Opcode::Null => {
if let Some(w64) = iri_to_u64_imm(ctx, insn) {
let dst_is_64 = w64 > 0x7fffffff;
let dst = get_output_reg(ctx, outputs[0]);
ctx.emit(Inst::imm_r(dst_is_64, w64, dst));
} else {
unimplemented!();
}
let w64 = ctx
.get_constant(insn)
.expect("constant value for iconst et al");
let dst_is_64 = w64 > 0x7fffffff;
let dst = get_output_reg(ctx, outputs[0]);
ctx.emit(Inst::imm_r(dst_is_64, w64, dst));
}

Opcode::Iadd
Expand Down

0 comments on commit cb96d16

Please sign in to comment.