diff --git a/src/asm/write_asm.rs b/src/asm/write_asm.rs index 007adac..73c4e22 100644 --- a/src/asm/write_asm.rs +++ b/src/asm/write_asm.rs @@ -208,7 +208,7 @@ impl WriteString for RType { Self::Sub(data_size) => format!("sub{}", data_size.write_string()), Self::Sll(data_size) => format!("sll{}", data_size.write_string()), Self::Srl(data_size) => format!("srl{}", data_size.write_string()), - Self::Sra(data_size) => format!("sra{}", data_size.write_string()), + Self::Sra(data_size) => format!("srl{}", data_size.write_string()), Self::Mul(data_size) => format!("mul{}", data_size.write_string()), Self::Div { data_size, diff --git a/src/ir/mod.rs b/src/ir/mod.rs index d6842d5..a8287e9 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -131,7 +131,7 @@ impl HasDtype for Declaration { } } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, PartialEq, Clone)] pub struct FunctionSignature { pub ret: Dtype, pub params: Vec, @@ -155,7 +155,7 @@ impl HasDtype for FunctionSignature { } } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, PartialEq, Clone)] pub struct FunctionDefinition { /// Memory allocations for local variables. The allocation is performed at the beginning of a /// function invocation. @@ -168,7 +168,7 @@ pub struct FunctionDefinition { pub bid_init: BlockId, } -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)] pub struct BlockId(pub usize); impl fmt::Display for BlockId { @@ -177,14 +177,14 @@ impl fmt::Display for BlockId { } } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, PartialEq, Clone)] pub struct Block { pub phinodes: Vec>, pub instructions: Vec>, pub exit: BlockExit, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, PartialEq, Clone)] #[allow(clippy::large_enum_variant)] pub enum Instruction { Nop, @@ -255,7 +255,7 @@ impl Instruction { } } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, PartialEq, Clone)] pub enum BlockExit { Jump { arg: JumpArg, @@ -300,7 +300,7 @@ impl BlockExit { } } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, PartialEq, Clone)] pub struct JumpArg { pub bid: BlockId, pub args: Vec, @@ -327,7 +327,7 @@ impl fmt::Display for JumpArg { } } -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[derive(Debug, PartialEq, Clone)] pub enum Operand { Constant(Constant), Register { rid: RegisterId, dtype: Dtype }, @@ -849,7 +849,7 @@ impl HasDtype for Constant { } } -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[derive(Debug, PartialEq, Eq, Hash, Clone)] pub struct Named { name: Option, inner: T, diff --git a/src/tests.rs b/src/tests.rs index 277d751..8055de1 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -216,7 +216,12 @@ pub fn test_opt, P2: AsRef, O: Optimize