From 6b32fcfceade4c6d7248576ddde79e70c920716c Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Tue, 12 Oct 2021 15:05:45 +0200 Subject: [PATCH] Remove Constraint --- .../codegen/meta/src/cdsl/instructions.rs | 9 -------- cranelift/codegen/meta/src/cdsl/mod.rs | 1 - .../codegen/meta/src/cdsl/type_inference.rs | 10 --------- .../codegen/meta/src/shared/instructions.rs | 22 ++++++------------- 4 files changed, 7 insertions(+), 35 deletions(-) delete mode 100644 cranelift/codegen/meta/src/cdsl/type_inference.rs diff --git a/cranelift/codegen/meta/src/cdsl/instructions.rs b/cranelift/codegen/meta/src/cdsl/instructions.rs index 5a7a1931ad..110d5e6604 100644 --- a/cranelift/codegen/meta/src/cdsl/instructions.rs +++ b/cranelift/codegen/meta/src/cdsl/instructions.rs @@ -4,7 +4,6 @@ use std::rc::Rc; use crate::cdsl::camel_case; use crate::cdsl::formats::InstructionFormat; use crate::cdsl::operands::Operand; -use crate::cdsl::type_inference::Constraint; use crate::cdsl::typevar::TypeVar; pub(crate) type AllInstructions = Vec; @@ -128,7 +127,6 @@ pub(crate) struct InstructionBuilder { format: Rc, operands_in: Option>, operands_out: Option>, - constraints: Option>, // See Instruction comments for the meaning of these fields. is_terminator: bool, @@ -150,7 +148,6 @@ impl InstructionBuilder { format: format.clone(), operands_in: None, operands_out: None, - constraints: None, is_terminator: false, is_branch: false, @@ -176,12 +173,6 @@ impl InstructionBuilder { self } - pub fn constraints(mut self, constraints: Vec) -> Self { - assert!(self.constraints.is_none()); - self.constraints = Some(constraints); - self - } - #[allow(clippy::wrong_self_convention)] pub fn is_terminator(mut self, val: bool) -> Self { self.is_terminator = val; diff --git a/cranelift/codegen/meta/src/cdsl/mod.rs b/cranelift/codegen/meta/src/cdsl/mod.rs index bf7acbbeb4..fa5f625628 100644 --- a/cranelift/codegen/meta/src/cdsl/mod.rs +++ b/cranelift/codegen/meta/src/cdsl/mod.rs @@ -8,7 +8,6 @@ pub mod instructions; pub mod isa; pub mod operands; pub mod settings; -pub mod type_inference; pub mod types; pub mod typevar; diff --git a/cranelift/codegen/meta/src/cdsl/type_inference.rs b/cranelift/codegen/meta/src/cdsl/type_inference.rs deleted file mode 100644 index 76fc1284f2..0000000000 --- a/cranelift/codegen/meta/src/cdsl/type_inference.rs +++ /dev/null @@ -1,10 +0,0 @@ -use crate::cdsl::typevar::TypeVar; - -#[derive(Debug, Hash, PartialEq, Eq)] -pub(crate) enum Constraint { - /// Constraint specifying that a type var tv1 must be wider than or equal to type var tv2 at - /// runtime. This requires that: - /// 1) They have the same number of lanes - /// 2) In a lane tv1 has at least as many bits as tv2. - WiderOrEq(TypeVar, TypeVar), -} diff --git a/cranelift/codegen/meta/src/shared/instructions.rs b/cranelift/codegen/meta/src/shared/instructions.rs index 9ddca0bb82..8161313315 100644 --- a/cranelift/codegen/meta/src/shared/instructions.rs +++ b/cranelift/codegen/meta/src/shared/instructions.rs @@ -4,7 +4,6 @@ use crate::cdsl::instructions::{ AllInstructions, InstructionBuilder as Inst, InstructionGroupBuilder, }; use crate::cdsl::operands::Operand; -use crate::cdsl::type_inference::Constraint::WiderOrEq; use crate::cdsl::types::{LaneType, ValueType}; use crate::cdsl::typevar::{Interval, TypeSetBuilder, TypeVar}; use crate::shared::formats::Formats; @@ -3750,8 +3749,7 @@ pub(crate) fn define( &formats.unary, ) .operands_in(vec![x]) - .operands_out(vec![a]) - .constraints(vec![WiderOrEq(Bool.clone(), BoolTo.clone())]), + .operands_out(vec![a]), ); let BoolTo = &TypeVar::new( @@ -3778,8 +3776,7 @@ pub(crate) fn define( &formats.unary, ) .operands_in(vec![x]) - .operands_out(vec![a]) - .constraints(vec![WiderOrEq(BoolTo.clone(), Bool.clone())]), + .operands_out(vec![a]), ); let IntTo = &TypeVar::new( @@ -3860,8 +3857,7 @@ pub(crate) fn define( &formats.unary, ) .operands_in(vec![x]) - .operands_out(vec![a]) - .constraints(vec![WiderOrEq(Int.clone(), IntTo.clone())]), + .operands_out(vec![a]), ); let I16or32or64xN = &TypeVar::new( @@ -4087,8 +4083,7 @@ pub(crate) fn define( &formats.unary, ) .operands_in(vec![x]) - .operands_out(vec![a]) - .constraints(vec![WiderOrEq(IntTo.clone(), Int.clone())]), + .operands_out(vec![a]), ); ig.push( @@ -4108,8 +4103,7 @@ pub(crate) fn define( &formats.unary, ) .operands_in(vec![x]) - .operands_out(vec![a]) - .constraints(vec![WiderOrEq(IntTo.clone(), Int.clone())]), + .operands_out(vec![a]), ); let FloatTo = &TypeVar::new( @@ -4142,8 +4136,7 @@ pub(crate) fn define( &formats.unary, ) .operands_in(vec![x]) - .operands_out(vec![a]) - .constraints(vec![WiderOrEq(FloatTo.clone(), Float.clone())]), + .operands_out(vec![a]), ); ig.push( @@ -4165,8 +4158,7 @@ pub(crate) fn define( &formats.unary, ) .operands_in(vec![x]) - .operands_out(vec![a]) - .constraints(vec![WiderOrEq(Float.clone(), FloatTo.clone())]), + .operands_out(vec![a]), ); let F64x2 = &TypeVar::new(