Remove Constraint

This commit is contained in:
bjorn3
2021-10-12 15:05:45 +02:00
parent 466a446f8c
commit 6b32fcfcea
4 changed files with 7 additions and 35 deletions

View File

@@ -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<Instruction>;
@@ -128,7 +127,6 @@ pub(crate) struct InstructionBuilder {
format: Rc<InstructionFormat>,
operands_in: Option<Vec<Operand>>,
operands_out: Option<Vec<Operand>>,
constraints: Option<Vec<Constraint>>,
// 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<Constraint>) -> 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;

View File

@@ -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;

View File

@@ -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),
}

View File

@@ -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(