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:
@@ -1511,6 +1511,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn aliases() {
|
||||
use crate::ir::condcodes::IntCC;
|
||||
use crate::ir::InstBuilder;
|
||||
|
||||
let mut func = Function::new();
|
||||
@@ -1525,7 +1526,7 @@ mod tests {
|
||||
assert_eq!(pos.func.dfg.resolve_aliases(v1), v1);
|
||||
|
||||
let arg0 = pos.func.dfg.append_block_param(block0, types::I32);
|
||||
let (s, c) = pos.ins().iadd_ifcout(v1, arg0);
|
||||
let (s, c) = pos.ins().iadd_cout(v1, arg0);
|
||||
let iadd = match pos.func.dfg.value_def(s) {
|
||||
ValueDef::Result(i, 0) => i,
|
||||
_ => panic!(),
|
||||
@@ -1535,9 +1536,9 @@ mod tests {
|
||||
pos.func.dfg.clear_results(iadd);
|
||||
pos.func.dfg.attach_result(iadd, s);
|
||||
|
||||
// Replace `iadd_ifcout` with a normal `iadd` and an `ifcmp`.
|
||||
// Replace `iadd_cout` with a normal `iadd` and an `icmp`.
|
||||
pos.func.dfg.replace(iadd).iadd(v1, arg0);
|
||||
let c2 = pos.ins().ifcmp(s, v1);
|
||||
let c2 = pos.ins().icmp(IntCC::Equal, s, v1);
|
||||
pos.func.dfg.change_to_alias(c, c2);
|
||||
|
||||
assert_eq!(pos.func.dfg.resolve_aliases(c2), c2);
|
||||
|
||||
@@ -244,14 +244,6 @@ impl Type {
|
||||
}
|
||||
}
|
||||
|
||||
/// Is this a CPU flags type?
|
||||
pub fn is_flags(self) -> bool {
|
||||
match self {
|
||||
IFLAGS | FFLAGS => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Is this a ref type?
|
||||
pub fn is_ref(self) -> bool {
|
||||
match self {
|
||||
@@ -453,12 +445,10 @@ impl Display for Type {
|
||||
} else if self.is_ref() {
|
||||
write!(f, "r{}", self.lane_bits())
|
||||
} else {
|
||||
f.write_str(match *self {
|
||||
IFLAGS => "iflags",
|
||||
FFLAGS => "fflags",
|
||||
match *self {
|
||||
INVALID => panic!("INVALID encountered"),
|
||||
_ => panic!("Unknown Type(0x{:x})", self.0),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -478,8 +468,6 @@ impl Debug for Type {
|
||||
} else {
|
||||
match *self {
|
||||
INVALID => write!(f, "types::INVALID"),
|
||||
IFLAGS => write!(f, "types::IFLAGS"),
|
||||
FFLAGS => write!(f, "types::FFLAGS"),
|
||||
_ => write!(f, "Type(0x{:x})", self.0),
|
||||
}
|
||||
}
|
||||
@@ -501,10 +489,6 @@ mod tests {
|
||||
fn basic_scalars() {
|
||||
assert_eq!(INVALID, INVALID.lane_type());
|
||||
assert_eq!(0, INVALID.bits());
|
||||
assert_eq!(IFLAGS, IFLAGS.lane_type());
|
||||
assert_eq!(0, IFLAGS.bits());
|
||||
assert_eq!(FFLAGS, FFLAGS.lane_type());
|
||||
assert_eq!(0, FFLAGS.bits());
|
||||
assert_eq!(I8, I8.lane_type());
|
||||
assert_eq!(I16, I16.lane_type());
|
||||
assert_eq!(I32, I32.lane_type());
|
||||
@@ -518,8 +502,6 @@ mod tests {
|
||||
assert_eq!(R64, R64.lane_type());
|
||||
|
||||
assert_eq!(INVALID.lane_bits(), 0);
|
||||
assert_eq!(IFLAGS.lane_bits(), 0);
|
||||
assert_eq!(FFLAGS.lane_bits(), 0);
|
||||
assert_eq!(I8.lane_bits(), 8);
|
||||
assert_eq!(I16.lane_bits(), 16);
|
||||
assert_eq!(I32.lane_bits(), 32);
|
||||
@@ -535,7 +517,6 @@ mod tests {
|
||||
fn typevar_functions() {
|
||||
assert_eq!(INVALID.half_width(), None);
|
||||
assert_eq!(INVALID.half_width(), None);
|
||||
assert_eq!(FFLAGS.half_width(), None);
|
||||
assert_eq!(I8.half_width(), None);
|
||||
assert_eq!(I16.half_width(), Some(I8));
|
||||
assert_eq!(I32.half_width(), Some(I16));
|
||||
@@ -546,8 +527,6 @@ mod tests {
|
||||
assert_eq!(F64.half_width(), Some(F32));
|
||||
|
||||
assert_eq!(INVALID.double_width(), None);
|
||||
assert_eq!(IFLAGS.double_width(), None);
|
||||
assert_eq!(FFLAGS.double_width(), None);
|
||||
assert_eq!(I8.double_width(), Some(I16));
|
||||
assert_eq!(I16.double_width(), Some(I32));
|
||||
assert_eq!(I32.double_width(), Some(I64));
|
||||
@@ -614,8 +593,6 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn format_scalars() {
|
||||
assert_eq!(IFLAGS.to_string(), "iflags");
|
||||
assert_eq!(FFLAGS.to_string(), "fflags");
|
||||
assert_eq!(I8.to_string(), "i8");
|
||||
assert_eq!(I16.to_string(), "i16");
|
||||
assert_eq!(I32.to_string(), "i32");
|
||||
|
||||
Reference in New Issue
Block a user