diff --git a/src/archs/amd64/amd64.rs b/src/archs/amd64/amd64.rs index 8106a33..1ca6c80 100644 --- a/src/archs/amd64/amd64.rs +++ b/src/archs/amd64/amd64.rs @@ -235,15 +235,6 @@ impl Architecture for Amd64 { )); } - fn not(&mut self, dest: &Destination, dest2: &Destination) { - self.buf.push_str(&formatdoc!( - " - \tcmp {dest}, 0 - \tsete {dest2} - ", - )); - } - fn add( &mut self, lhs: &Source, diff --git a/src/archs/arch.rs b/src/archs/arch.rs index 0fe6139..353d4dc 100644 --- a/src/archs/arch.rs +++ b/src/archs/arch.rs @@ -59,7 +59,6 @@ pub trait Architecture: ArchitectureClone { fn declare(&mut self, name: &str, size: usize); fn mov(&mut self, src: &Source, dest: &Destination, signed: bool) -> Result<(), ArchError>; fn negate(&mut self, dest: &Destination); - fn not(&mut self, dest: &Destination, dest2: &Destination); fn add( &mut self, lhs: &Source, diff --git a/src/codegen/codegen.rs b/src/codegen/codegen.rs index e30d90f..11b518c 100644 --- a/src/codegen/codegen.rs +++ b/src/codegen/codegen.rs @@ -747,8 +747,11 @@ impl CodeGen { Some(&r.dest(self.arch.size(&type_, &self.scope))), state, )?; - self.arch - .not(&r.dest(self.arch.size(&type_, &self.scope)), dest); + self.arch.cmp( + &r.dest(self.arch.size(&type_, &self.scope)), + &Source::Immediate(Immediate::UInt(0)), + ); + self.arch.setcc(dest, CmpOp::Equal); self.arch.free(r)?; } UnOp::Address => {