Remove IFLAGS/FFLAGS types (#5406)
All instructions using the CPU flags types (IFLAGS/FFLAGS) were already removed. This patch completes the cleanup by removing all remaining instructions that define values of CPU flags types, as well as the types themselves. Specifically, the following features are removed: - The IFLAGS and FFLAGS types and the SpecialType category. - Special handling of IFLAGS and FFLAGS in machinst/isle.rs and machinst/lower.rs. - The ifcmp, ifcmp_imm, ffcmp, iadd_ifcin, iadd_ifcout, iadd_ifcarry, isub_ifbin, isub_ifbout, and isub_ifborrow instructions. - The writes_cpu_flags instruction property. - The flags verifier pass. - Flags handling in the interpreter. All of these features are currently unused; no functional change intended by this patch. This addresses https://github.com/bytecodealliance/wasmtime/issues/3249.
This commit is contained in:
@@ -1940,14 +1940,6 @@
|
||||
(MInst.AluRRR (ALUOp.AddS) (operand_size ty) dst src1 src2)
|
||||
dst)))
|
||||
|
||||
;; Helper for emitting `adds` instructions, setting flags in ambient
|
||||
;; state. Used only for `iadd_ifcout`.
|
||||
(decl add_with_flags (Type Reg Reg) Reg)
|
||||
(rule (add_with_flags ty src1 src2)
|
||||
(let ((dst WritableReg (temp_writable_reg $I64))
|
||||
(_ Unit (emit (MInst.AluRRR (ALUOp.AddS) (operand_size ty) dst src1 src2))))
|
||||
dst))
|
||||
|
||||
;; Helper for emitting `adc` instructions.
|
||||
(decl adc_paired (Type Reg Reg) ConsumesFlags)
|
||||
(rule (adc_paired ty src1 src2)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! This module defines aarch64-specific machine instruction types.
|
||||
|
||||
use crate::binemit::{Addend, CodeOffset, Reloc};
|
||||
use crate::ir::types::{F32, F64, FFLAGS, I128, I16, I32, I64, I8, I8X16, IFLAGS, R32, R64};
|
||||
use crate::ir::types::{F32, F64, I128, I16, I32, I64, I8, I8X16, R32, R64};
|
||||
use crate::ir::{types, ExternalName, MemFlags, Opcode, Type};
|
||||
use crate::isa::CallConv;
|
||||
use crate::machinst::*;
|
||||
@@ -1280,7 +1280,6 @@ impl MachInst for Inst {
|
||||
Ok((&[RegClass::Float], &[I8X16]))
|
||||
}
|
||||
_ if ty.is_dynamic_vector() => Ok((&[RegClass::Float], &[I8X16])),
|
||||
IFLAGS | FFLAGS => Ok((&[RegClass::Int], &[I64])),
|
||||
_ => Err(CodegenError::Unsupported(format!(
|
||||
"Unexpected SSA-value type: {}",
|
||||
ty
|
||||
|
||||
@@ -2332,36 +2332,6 @@
|
||||
(lower_msb Reg (lsr_imm $I64 lower_msb (imm_shift_from_u8 63))))
|
||||
(add_shift $I64 lower_msb upper_msb (lshl_from_u64 $I64 1))))
|
||||
|
||||
;;; Rules for `iadd_ifcout` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; This is a two-output instruction that is needed for the
|
||||
;; legalizer's explicit heap-check sequence, among possible other
|
||||
;; uses. Its second output is a flags output only ever meant to
|
||||
;; check for overflow using the
|
||||
;; `backend.unsigned_add_overflow_condition()` condition.
|
||||
;;
|
||||
;; Note that the CLIF validation will ensure that no flag-setting
|
||||
;; operation comes between this IaddIfcout and its use (e.g., a
|
||||
;; Trapif). Thus, we can rely on implicit communication through the
|
||||
;; processor flags rather than explicitly generating flags into a
|
||||
;; register. We simply use the variant of the add instruction that
|
||||
;; sets flags (`adds`) here.
|
||||
;;
|
||||
;; Note that the second output (the flags) need not be generated,
|
||||
;; because flags are never materialized into a register; the only
|
||||
;; instructions that can use a value of type `iflags` or `fflags`
|
||||
;; will look directly for the flags-producing instruction (which can
|
||||
;; always be found, by construction) and merge it.
|
||||
;;
|
||||
;; Now handle the iadd as above, except use an AddS opcode that sets
|
||||
;; flags.
|
||||
|
||||
(rule (lower (has_type (ty_int ty)
|
||||
(iadd_ifcout a b)))
|
||||
(output_pair
|
||||
(add_with_flags ty a b)
|
||||
(invalid_reg)))
|
||||
|
||||
;;; Rules for `iadd_cout` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; For values smaller than a register, we do a normal `add` with both arguments
|
||||
|
||||
@@ -167,14 +167,6 @@ pub(crate) fn lower_insn_to_regs(
|
||||
|
||||
Opcode::Return => implemented_in_isle(ctx),
|
||||
|
||||
Opcode::Ifcmp | Opcode::Ffcmp => {
|
||||
// An Ifcmp/Ffcmp must always be seen as a use of a brif/brff or trueif/trueff
|
||||
// instruction. This will always be the case as long as the IR uses an Ifcmp/Ffcmp from
|
||||
// the same block, or a dominating block. In other words, it cannot pass through a BB
|
||||
// param (phi). The flags pass of the verifier will ensure this.
|
||||
panic!("Should never reach ifcmp as isel root!");
|
||||
}
|
||||
|
||||
Opcode::Icmp => implemented_in_isle(ctx),
|
||||
|
||||
Opcode::Fcmp => implemented_in_isle(ctx),
|
||||
@@ -253,8 +245,6 @@ pub(crate) fn lower_insn_to_regs(
|
||||
|
||||
Opcode::FcvtToUintSat | Opcode::FcvtToSintSat => implemented_in_isle(ctx),
|
||||
|
||||
Opcode::IaddIfcout => implemented_in_isle(ctx),
|
||||
|
||||
Opcode::UaddOverflowTrap => implemented_in_isle(ctx),
|
||||
|
||||
Opcode::IaddCout => implemented_in_isle(ctx),
|
||||
@@ -267,15 +257,10 @@ pub(crate) fn lower_insn_to_regs(
|
||||
| Opcode::SremImm
|
||||
| Opcode::IrsubImm
|
||||
| Opcode::IaddCin
|
||||
| Opcode::IaddIfcin
|
||||
| Opcode::IaddCarry
|
||||
| Opcode::IaddIfcarry
|
||||
| Opcode::IsubBin
|
||||
| Opcode::IsubIfbin
|
||||
| Opcode::IsubBout
|
||||
| Opcode::IsubIfbout
|
||||
| Opcode::IsubBorrow
|
||||
| Opcode::IsubIfborrow
|
||||
| Opcode::BandImm
|
||||
| Opcode::BorImm
|
||||
| Opcode::BxorImm
|
||||
@@ -284,8 +269,7 @@ pub(crate) fn lower_insn_to_regs(
|
||||
| Opcode::IshlImm
|
||||
| Opcode::UshrImm
|
||||
| Opcode::SshrImm
|
||||
| Opcode::IcmpImm
|
||||
| Opcode::IfcmpImm => {
|
||||
| Opcode::IcmpImm => {
|
||||
panic!("ALU+imm and ALU+carry ops should not appear here!");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user