extractng Nodes from son.rs

Signed-off-by: Jakub Doka <jakub.doka2@gmail.com>
This commit is contained in:
Jakub Doka 2024-12-17 00:18:44 +01:00
parent ec9bb886f8
commit 945e5c70f6
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143
6 changed files with 2283 additions and 2243 deletions

View file

@ -2,8 +2,8 @@ use {
super::{AssemblySpec, Backend}, super::{AssemblySpec, Backend},
crate::{ crate::{
lexer::TokenKind, lexer::TokenKind,
nodes::{Kind, Nid, Nodes, MEM},
parser, parser,
son::{Kind, Nid, Nodes, MEM},
ty::{self, Loc, Module, Offset, Size, Types}, ty::{self, Loc, Module, Offset, Size, Types},
utils::{EntSlice, EntVec}, utils::{EntSlice, EntVec},
}, },

View file

@ -5,8 +5,8 @@ use {
HbvmBackend, Nid, Nodes, PLoc, Reloc, TypedReloc, HbvmBackend, Nid, Nodes, PLoc, Reloc, TypedReloc,
}, },
lexer::TokenKind, lexer::TokenKind,
nodes::{Kind, ARG_START, MEM, VOID},
parser, quad_sort, parser, quad_sort,
son::{Kind, ARG_START, MEM, VOID},
ty::{self, Arg, Loc, Module, Offset, Sig, Types}, ty::{self, Arg, Loc, Module, Offset, Sig, Types},
utils::{BitSet, EntSlice}, utils::{BitSet, EntSlice},
}, },

View file

@ -60,6 +60,7 @@ pub mod fmt;
pub mod fs; pub mod fs;
pub mod fuzz; pub mod fuzz;
pub mod lexer; pub mod lexer;
pub mod nodes;
pub mod parser; pub mod parser;
pub mod son; pub mod son;
pub mod ty; pub mod ty;
@ -67,8 +68,8 @@ pub mod ty;
pub mod backend { pub mod backend {
use { use {
crate::{ crate::{
nodes::Nodes,
parser, parser,
son::Nodes,
ty::{self, Module, Types}, ty::{self, Module, Types},
utils::EntSlice, utils::EntSlice,
}, },

2194
lang/src/nodes.rs Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -50,21 +50,43 @@ optional:
ADDI64 r254, r254, 16d ADDI64 r254, r254, 16d
JALA r0, r31, 0a JALA r0, r31, 0a
optionala: optionala:
ADDI64 r254, r254, -48d ADDI64 r254, r254, -128d
CP r17, r1 ST r31, r254, 64a, 64h
ADDI64 r14, r254, 8d CP r38, r1
ADDI64 r15, r254, 16d ADDI64 r33, r254, 48d
ST r14, r254, 16a, 8h JAL r31, r0, :some_index
LI64 r16, 1d ST r1, r33, 0a, 16h
ST r16, r254, 24a, 8h LD r34, r254, 48a, 1h
ADDI64 r13, r254, 0d ANDI r34, r34, 255d
ST r13, r254, 32a, 8h JNE r34, r0, :0
UN
0: ADDI64 r34, r254, 8d
ADDI64 r35, r254, 16d
LRA r36, r0, :heap
LD r33, r254, 56a, 8h
ST r34, r254, 16a, 8h
LI64 r37, 1d
ADD64 r33, r33, r36
ST r37, r254, 24a, 8h
LD r33, r33, 0a, 1h
ADDI64 r32, r254, 0d
ST r32, r254, 32a, 8h
ANDI r33, r33, 255d
ST r0, r254, 0a, 8h ST r0, r254, 0a, 8h
ST r0, r254, 8a, 8h ST r0, r254, 8a, 8h
ST r0, r254, 40a, 8h ST r33, r254, 40a, 8h
BMC r15, r17, 32h BMC r35, r38, 32h
ADDI64 r254, r254, 48d LD r31, r254, 64a, 64h
ADDI64 r254, r254, 128d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 556 some_index:
ADDI64 r254, r254, -16d
LI8 r13, 1b
ST r13, r254, 0a, 1h
ST r0, r254, 8a, 8h
LD r1, r254, 0a, 16h
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
code size: 769
ret: 100 ret: 100
status: Ok(()) status: Ok(())