From c94a65c993f5da6a86bd1e6d23e359ba2052f836 Mon Sep 17 00:00:00 2001 From: johannst Date: Fri, 13 Dec 2024 00:18:53 +0000 Subject: deploy: 758f014afb8ec5c20ef2fc862fc12e80f65d3d25 --- src/juicebox_asm/lib.rs.html | 154 +------------------------------------------ 1 file changed, 3 insertions(+), 151 deletions(-) (limited to 'src/juicebox_asm/lib.rs.html') diff --git a/src/juicebox_asm/lib.rs.html b/src/juicebox_asm/lib.rs.html index 2b9ed8a..4b32e80 100644 --- a/src/juicebox_asm/lib.rs.html +++ b/src/juicebox_asm/lib.rs.html @@ -88,81 +88,7 @@ 87 88 89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164
//! A simple `x64` jit assembler with a minimal runtime to execute emitted code for fun.
+90
//! A simple `x64` jit assembler with a minimal runtime to execute emitted code for fun.
 //!
 //! The following is an fibonacci example implementation.
 //! ```rust
@@ -240,6 +166,7 @@
 mod asm;
 mod imm;
 mod label;
+mod mem;
 mod reg;
 mod rt;
 
@@ -248,82 +175,7 @@
 pub use asm::Asm;
 pub use imm::{Imm16, Imm32, Imm64, Imm8};
 pub use label::Label;
+pub use mem::{Mem16, Mem32, Mem64, Mem8};
 pub use reg::{Reg16, Reg32, Reg64, Reg8};
 pub use rt::Runtime;
-
-/// Type representing a memory operand.
-#[derive(Clone, Copy)]
-pub enum MemOp {
-    /// An indirect memory operand, eg `mov [rax], rcx`.
-    Indirect(Reg64),
-
-    /// An indirect memory operand with additional displacement, eg `mov [rax + 0x10], rcx`.
-    IndirectDisp(Reg64, i32),
-
-    /// An indirect memory operand in the form base + index, eg `mov [rax + rcx], rdx`.
-    IndirectBaseIndex(Reg64, Reg64),
-}
-
-impl MemOp {
-    /// Get the base address register of the memory operand.
-    const fn base(&self) -> Reg64 {
-        match self {
-            MemOp::Indirect(base) => *base,
-            MemOp::IndirectDisp(base, ..) => *base,
-            MemOp::IndirectBaseIndex(base, ..) => *base,
-        }
-    }
-
-    /// Get the index register of the memory operand.
-    fn index(&self) -> Reg64 {
-        // Return zero index register for memory operands w/o index register.
-        let zero_index = Reg64::rax;
-        use reg::Reg;
-        assert_eq!(zero_index.idx(), 0);
-
-        match self {
-            MemOp::Indirect(..) => zero_index,
-            MemOp::IndirectDisp(..) => zero_index,
-            MemOp::IndirectBaseIndex(.., index) => *index,
-        }
-    }
-}
-
-/// Trait to give size hints for memory operands.
-trait MemOpSized {
-    fn mem_op(&self) -> MemOp;
-}
-
-macro_rules! impl_memop_sized {
-    ($(#[$doc:meta] $name:ident)+) => {
-        $(
-        #[$doc]
-        pub struct $name(MemOp);
-
-        impl $name {
-            /// Create a memory with size hint from a raw memory operand.
-            pub fn from(op: MemOp) -> Self {
-                Self(op)
-            }
-        }
-
-        impl MemOpSized for $name {
-            fn mem_op(&self) -> MemOp {
-                self.0
-            }
-        }
-        )+
-    };
-}
-
-impl_memop_sized!(
-    /// A memory operand with a word (8 bit) size hint.
-    MemOp8
-    /// A memory operand with a word (16 bit) size hint.
-    MemOp16
-    /// A memory operand with a dword (32 bit) size hint.
-    MemOp32
-    /// A memory operand with a qword (64 bit) size hint.
-    MemOp64
-);
 
\ No newline at end of file -- cgit v1.2.3