diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-12-07 23:00:09 +0100 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-12-07 23:00:09 +0100 |
commit | f4a9fdb3357ce1a2dfc12cbb0fee6b915bc810c4 (patch) | |
tree | f250376867477ac309d9fed4333224efe2d3969d /src | |
parent | 647e3646c2f686ce236059b935336c43c8a9a074 (diff) | |
download | juicebox-asm-f4a9fdb3357ce1a2dfc12cbb0fee6b915bc810c4.tar.gz juicebox-asm-f4a9fdb3357ce1a2dfc12cbb0fee6b915bc810c4.zip |
remove prelude
Diffstat (limited to 'src')
-rw-r--r-- | src/imm.rs | 2 | ||||
-rw-r--r-- | src/insn/add.rs | 3 | ||||
-rw-r--r-- | src/insn/call.rs | 3 | ||||
-rw-r--r-- | src/insn/cmp.rs | 3 | ||||
-rw-r--r-- | src/insn/dec.rs | 3 | ||||
-rw-r--r-- | src/insn/jmp.rs | 3 | ||||
-rw-r--r-- | src/insn/jnz.rs | 3 | ||||
-rw-r--r-- | src/insn/jz.rs | 3 | ||||
-rw-r--r-- | src/insn/mov.rs | 3 | ||||
-rw-r--r-- | src/insn/test.rs | 3 | ||||
-rw-r--r-- | src/label.rs | 3 | ||||
-rw-r--r-- | src/lib.rs | 8 | ||||
-rw-r--r-- | src/prelude.rs | 10 | ||||
-rw-r--r-- | src/reg.rs | 5 |
14 files changed, 29 insertions, 26 deletions
@@ -60,4 +60,4 @@ mod test { assert_eq!(size_of::<usize>(), size_of::<Imm64>()); assert_eq!(size_of::<isize>(), size_of::<Imm64>()); } -}
\ No newline at end of file +} diff --git a/src/insn/add.rs b/src/insn/add.rs index 8232fe4..0a6772a 100644 --- a/src/insn/add.rs +++ b/src/insn/add.rs @@ -1,4 +1,5 @@ -use crate::prelude::*; +use super::Add; +use crate::{Asm, Imm16, MemOp, Reg16, Reg32, Reg64}; impl Add<Reg64, Reg64> for Asm { fn add(&mut self, op1: Reg64, op2: Reg64) { diff --git a/src/insn/call.rs b/src/insn/call.rs index 8a71db8..f089512 100644 --- a/src/insn/call.rs +++ b/src/insn/call.rs @@ -1,4 +1,5 @@ -use crate::prelude::*; +use super::Call; +use crate::{Asm, Reg64}; impl Call<Reg64> for Asm { fn call(&mut self, op1: Reg64) { diff --git a/src/insn/cmp.rs b/src/insn/cmp.rs index 93aa26c..835202c 100644 --- a/src/insn/cmp.rs +++ b/src/insn/cmp.rs @@ -1,4 +1,5 @@ -use crate::prelude::*; +use super::Cmp; +use crate::{Asm, Imm16, MemOp}; impl Cmp<MemOp, Imm16> for Asm { fn cmp(&mut self, op1: MemOp, op2: Imm16) { diff --git a/src/insn/dec.rs b/src/insn/dec.rs index c5803e7..1377d1c 100644 --- a/src/insn/dec.rs +++ b/src/insn/dec.rs @@ -1,4 +1,5 @@ -use crate::prelude::*; +use super::Dec; +use crate::{Asm, Reg32, Reg64}; impl Dec<Reg64> for Asm { fn dec(&mut self, op1: Reg64) { diff --git a/src/insn/jmp.rs b/src/insn/jmp.rs index 71d1dbc..0539318 100644 --- a/src/insn/jmp.rs +++ b/src/insn/jmp.rs @@ -1,4 +1,5 @@ -use crate::prelude::*; +use super::Jmp; +use crate::{Asm, Label}; impl Jmp<&mut Label> for Asm { fn jmp(&mut self, op1: &mut Label) { diff --git a/src/insn/jnz.rs b/src/insn/jnz.rs index 6517bd7..739d013 100644 --- a/src/insn/jnz.rs +++ b/src/insn/jnz.rs @@ -1,4 +1,5 @@ -use crate::prelude::*; +use super::Jnz; +use crate::{Asm, Label}; impl Jnz<&mut Label> for Asm { fn jnz(&mut self, op1: &mut Label) { diff --git a/src/insn/jz.rs b/src/insn/jz.rs index 6563ca2..c591b1d 100644 --- a/src/insn/jz.rs +++ b/src/insn/jz.rs @@ -1,4 +1,5 @@ -use crate::prelude::*; +use super::Jz; +use crate::{Asm, Label}; impl Jz<&mut Label> for Asm { fn jz(&mut self, op1: &mut Label) { diff --git a/src/insn/mov.rs b/src/insn/mov.rs index 2614d82..2f61e07 100644 --- a/src/insn/mov.rs +++ b/src/insn/mov.rs @@ -1,4 +1,5 @@ -use crate::prelude::*; +use super::Mov; +use crate::{Asm, Imm16, Imm32, Imm64, Imm8, MemOp, Reg16, Reg32, Reg64, Reg8}; // -- MOV : reg reg diff --git a/src/insn/test.rs b/src/insn/test.rs index b7ac774..e90d855 100644 --- a/src/insn/test.rs +++ b/src/insn/test.rs @@ -1,4 +1,5 @@ -use crate::prelude::*; +use super::Test; +use crate::{Asm, Imm16, MemOp, Reg32, Reg64}; impl Test<Reg64, Reg64> for Asm { fn test(&mut self, op1: Reg64, op2: Reg64) { diff --git a/src/label.rs b/src/label.rs index a0bd864..4b441d9 100644 --- a/src/label.rs +++ b/src/label.rs @@ -6,7 +6,8 @@ use std::collections::HashSet; /// A label which is used as target for jump instructions. /// /// ```rust -/// use juicebox_asm::prelude::*; +/// use juicebox_asm::{Asm, Label, Reg64}; +/// use juicebox_asm::insn::{Mov, Jmp}; /// /// let mut lbl = Label::new(); /// let mut asm = Asm::new(); @@ -2,7 +2,8 @@ //! //! The following is an fibonacci example implementation. //! ```rust -//! use juicebox_asm::prelude::*; +//! use juicebox_asm::{Asm, Reg64, Imm64, Label}; +//! use juicebox_asm::insn::*; //! use juicebox_asm::Runtime; //! //! const fn fib_rs(n: u64) -> u64 { @@ -72,14 +73,13 @@ //! } //! ``` -pub mod prelude; - mod imm; -mod insn; mod label; mod reg; mod rt; +pub mod insn; + pub use imm::{Imm16, Imm32, Imm64, Imm8}; pub use label::Label; pub use reg::{Reg16, Reg32, Reg64, Reg8}; diff --git a/src/prelude.rs b/src/prelude.rs deleted file mode 100644 index d8dd912..0000000 --- a/src/prelude.rs +++ /dev/null @@ -1,10 +0,0 @@ -//! Crate prelude, which can be used to import the most important types at once. - -pub use crate::Asm; -pub use crate::MemOp; - -pub use crate::imm::{Imm16, Imm32, Imm64, Imm8}; -pub use crate::label::Label; -pub use crate::reg::{Reg16, Reg32, Reg64, Reg8}; - -pub use crate::insn::{Add, Call, Cmp, Dec, Jmp, Jnz, Jz, Mov, Test}; @@ -158,7 +158,10 @@ mod tests { assert!(!r.rexw()); // Check need REX byte. - let rex = matches!(r, r8l | r9l | r10l | r11l | r12l | r13l | r14l | r15l | spl | bpl | sil | dil); + let rex = matches!( + r, + r8l | r9l | r10l | r11l | r12l | r13l | r14l | r15l | spl | bpl | sil | dil + ); assert_eq!(r.need_rex(), rex); // Check need SIB byte. |