Remove the sarg_t type and dummy_sarg_t instruction
They are no longer necessary with the new style backends
This commit is contained in:
@@ -393,8 +393,6 @@ impl fmt::Debug for VectorType {
|
|||||||
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub(crate) enum SpecialType {
|
pub(crate) enum SpecialType {
|
||||||
Flag(shared_types::Flag),
|
Flag(shared_types::Flag),
|
||||||
// FIXME remove once the old style backends are removed.
|
|
||||||
StructArgument,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SpecialType {
|
impl SpecialType {
|
||||||
@@ -409,9 +407,6 @@ impl SpecialType {
|
|||||||
"CPU flags representing the result of a floating point comparison. These
|
"CPU flags representing the result of a floating point comparison. These
|
||||||
flags can be tested with a :type:`floatcc` condition code.",
|
flags can be tested with a :type:`floatcc` condition code.",
|
||||||
),
|
),
|
||||||
SpecialType::StructArgument => {
|
|
||||||
String::from("After legalization sarg_t arguments will get this type.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,7 +414,6 @@ impl SpecialType {
|
|||||||
pub fn lane_bits(self) -> u64 {
|
pub fn lane_bits(self) -> u64 {
|
||||||
match self {
|
match self {
|
||||||
SpecialType::Flag(_) => 0,
|
SpecialType::Flag(_) => 0,
|
||||||
SpecialType::StructArgument => 0,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,7 +422,6 @@ impl SpecialType {
|
|||||||
match self {
|
match self {
|
||||||
SpecialType::Flag(shared_types::Flag::IFlags) => 1,
|
SpecialType::Flag(shared_types::Flag::IFlags) => 1,
|
||||||
SpecialType::Flag(shared_types::Flag::FFlags) => 2,
|
SpecialType::Flag(shared_types::Flag::FFlags) => 2,
|
||||||
SpecialType::StructArgument => 3,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -438,7 +431,6 @@ impl fmt::Display for SpecialType {
|
|||||||
match *self {
|
match *self {
|
||||||
SpecialType::Flag(shared_types::Flag::IFlags) => write!(f, "iflags"),
|
SpecialType::Flag(shared_types::Flag::IFlags) => write!(f, "iflags"),
|
||||||
SpecialType::Flag(shared_types::Flag::FFlags) => write!(f, "fflags"),
|
SpecialType::Flag(shared_types::Flag::FFlags) => write!(f, "fflags"),
|
||||||
SpecialType::StructArgument => write!(f, "sarg_t"),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -450,7 +442,6 @@ impl fmt::Debug for SpecialType {
|
|||||||
"{}",
|
"{}",
|
||||||
match *self {
|
match *self {
|
||||||
SpecialType::Flag(_) => format!("FlagsType({})", self),
|
SpecialType::Flag(_) => format!("FlagsType({})", self),
|
||||||
SpecialType::StructArgument => format!("StructArgument"),
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -464,14 +455,12 @@ impl From<shared_types::Flag> for SpecialType {
|
|||||||
|
|
||||||
pub(crate) struct SpecialTypeIterator {
|
pub(crate) struct SpecialTypeIterator {
|
||||||
flag_iter: shared_types::FlagIterator,
|
flag_iter: shared_types::FlagIterator,
|
||||||
done: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SpecialTypeIterator {
|
impl SpecialTypeIterator {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
flag_iter: shared_types::FlagIterator::new(),
|
flag_iter: shared_types::FlagIterator::new(),
|
||||||
done: false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -479,16 +468,7 @@ impl SpecialTypeIterator {
|
|||||||
impl Iterator for SpecialTypeIterator {
|
impl Iterator for SpecialTypeIterator {
|
||||||
type Item = SpecialType;
|
type Item = SpecialType;
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
if let Some(f) = self.flag_iter.next() {
|
self.flag_iter.next().map(SpecialType::from)
|
||||||
Some(SpecialType::from(f))
|
|
||||||
} else {
|
|
||||||
if !self.done {
|
|
||||||
self.done = true;
|
|
||||||
Some(SpecialType::StructArgument)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1929,31 +1929,6 @@ pub(crate) fn define(
|
|||||||
.can_load(true),
|
.can_load(true),
|
||||||
);
|
);
|
||||||
|
|
||||||
let Sarg = &TypeVar::new(
|
|
||||||
"Sarg",
|
|
||||||
"Any scalar or vector type with at most 128 lanes",
|
|
||||||
TypeSetBuilder::new()
|
|
||||||
.specials(vec![crate::cdsl::types::SpecialType::StructArgument])
|
|
||||||
.build(),
|
|
||||||
);
|
|
||||||
let sarg_t = &Operand::new("sarg_t", Sarg);
|
|
||||||
|
|
||||||
// FIXME remove once the old style codegen backends are removed.
|
|
||||||
ig.push(
|
|
||||||
Inst::new(
|
|
||||||
"dummy_sarg_t",
|
|
||||||
r#"
|
|
||||||
This creates a sarg_t
|
|
||||||
|
|
||||||
This instruction is internal and should not be created by
|
|
||||||
Cranelift users.
|
|
||||||
"#,
|
|
||||||
&formats.nullary,
|
|
||||||
)
|
|
||||||
.operands_in(vec![])
|
|
||||||
.operands_out(vec![sarg_t]),
|
|
||||||
);
|
|
||||||
|
|
||||||
ig.push(
|
ig.push(
|
||||||
Inst::new(
|
Inst::new(
|
||||||
"copy_nop",
|
"copy_nop",
|
||||||
|
|||||||
@@ -400,7 +400,6 @@ impl Display for Type {
|
|||||||
f.write_str(match *self {
|
f.write_str(match *self {
|
||||||
IFLAGS => "iflags",
|
IFLAGS => "iflags",
|
||||||
FFLAGS => "fflags",
|
FFLAGS => "fflags",
|
||||||
SARG_T => "sarg_t",
|
|
||||||
INVALID => panic!("INVALID encountered"),
|
INVALID => panic!("INVALID encountered"),
|
||||||
_ => panic!("Unknown Type(0x{:x})", self.0),
|
_ => panic!("Unknown Type(0x{:x})", self.0),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3560,8 +3560,6 @@ pub(crate) fn lower_insn_to_regs<C: LowerCtx<I = Inst>>(
|
|||||||
panic!("ALU+imm and ALU+carry ops should not appear here!");
|
panic!("ALU+imm and ALU+carry ops should not appear here!");
|
||||||
}
|
}
|
||||||
|
|
||||||
Opcode::DummySargT => unreachable!(),
|
|
||||||
|
|
||||||
Opcode::Iabs => {
|
Opcode::Iabs => {
|
||||||
let rd = get_output_reg(ctx, outputs[0]).only_reg().unwrap();
|
let rd = get_output_reg(ctx, outputs[0]).only_reg().unwrap();
|
||||||
let rn = put_input_in_reg(ctx, inputs[0], NarrowValueMode::None);
|
let rn = put_input_in_reg(ctx, inputs[0], NarrowValueMode::None);
|
||||||
|
|||||||
@@ -2895,7 +2895,6 @@ fn lower_insn_to_regs<C: LowerCtx<I = Inst>>(
|
|||||||
| Opcode::AdjustSpDown
|
| Opcode::AdjustSpDown
|
||||||
| Opcode::AdjustSpUpImm
|
| Opcode::AdjustSpUpImm
|
||||||
| Opcode::AdjustSpDownImm
|
| Opcode::AdjustSpDownImm
|
||||||
| Opcode::DummySargT
|
|
||||||
| Opcode::IfcmpSp => {
|
| Opcode::IfcmpSp => {
|
||||||
panic!("Unused opcode should not be encountered.");
|
panic!("Unused opcode should not be encountered.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6870,8 +6870,7 @@ fn lower_insn_to_regs<C: LowerCtx<I = Inst>>(
|
|||||||
| Opcode::AdjustSpUpImm
|
| Opcode::AdjustSpUpImm
|
||||||
| Opcode::AdjustSpDownImm
|
| Opcode::AdjustSpDownImm
|
||||||
| Opcode::IfcmpSp
|
| Opcode::IfcmpSp
|
||||||
| Opcode::Copy
|
| Opcode::Copy => {
|
||||||
| Opcode::DummySargT => {
|
|
||||||
panic!("Unused opcode should not be encountered.");
|
panic!("Unused opcode should not be encountered.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -451,7 +451,6 @@ where
|
|||||||
Opcode::Spill => unimplemented!("Spill"),
|
Opcode::Spill => unimplemented!("Spill"),
|
||||||
Opcode::Fill => unimplemented!("Fill"),
|
Opcode::Fill => unimplemented!("Fill"),
|
||||||
Opcode::FillNop => assign(arg(0)?),
|
Opcode::FillNop => assign(arg(0)?),
|
||||||
Opcode::DummySargT => unimplemented!("DummySargT"),
|
|
||||||
Opcode::CopyNop => unimplemented!("CopyNop"),
|
Opcode::CopyNop => unimplemented!("CopyNop"),
|
||||||
Opcode::AdjustSpDown => unimplemented!("AdjustSpDown"),
|
Opcode::AdjustSpDown => unimplemented!("AdjustSpDown"),
|
||||||
Opcode::AdjustSpUpImm => unimplemented!("AdjustSpUpImm"),
|
Opcode::AdjustSpUpImm => unimplemented!("AdjustSpUpImm"),
|
||||||
|
|||||||
@@ -326,7 +326,6 @@ impl<'a> Lexer<'a> {
|
|||||||
.unwrap_or_else(|| match text {
|
.unwrap_or_else(|| match text {
|
||||||
"iflags" => Token::Type(types::IFLAGS),
|
"iflags" => Token::Type(types::IFLAGS),
|
||||||
"fflags" => Token::Type(types::FFLAGS),
|
"fflags" => Token::Type(types::FFLAGS),
|
||||||
"sarg_t" => Token::Type(types::SARG_T),
|
|
||||||
_ => Token::Identifier(text),
|
_ => Token::Identifier(text),
|
||||||
}),
|
}),
|
||||||
loc,
|
loc,
|
||||||
@@ -620,7 +619,7 @@ mod tests {
|
|||||||
let mut lex = Lexer::new(
|
let mut lex = Lexer::new(
|
||||||
"v0 v00 vx01 block1234567890 block5234567890 v1x vx1 vxvx4 \
|
"v0 v00 vx01 block1234567890 block5234567890 v1x vx1 vxvx4 \
|
||||||
function0 function b1 i32x4 f32x5 \
|
function0 function b1 i32x4 f32x5 \
|
||||||
iflags fflags sarg_t iflagss",
|
iflags fflags iflagss",
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
lex.next(),
|
lex.next(),
|
||||||
@@ -643,7 +642,6 @@ mod tests {
|
|||||||
assert_eq!(lex.next(), token(Token::Identifier("f32x5"), 1));
|
assert_eq!(lex.next(), token(Token::Identifier("f32x5"), 1));
|
||||||
assert_eq!(lex.next(), token(Token::Type(types::IFLAGS), 1));
|
assert_eq!(lex.next(), token(Token::Type(types::IFLAGS), 1));
|
||||||
assert_eq!(lex.next(), token(Token::Type(types::FFLAGS), 1));
|
assert_eq!(lex.next(), token(Token::Type(types::FFLAGS), 1));
|
||||||
assert_eq!(lex.next(), token(Token::Type(types::SARG_T), 1));
|
|
||||||
assert_eq!(lex.next(), token(Token::Identifier("iflagss"), 1));
|
assert_eq!(lex.next(), token(Token::Identifier("iflagss"), 1));
|
||||||
assert_eq!(lex.next(), None);
|
assert_eq!(lex.next(), None);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user