sbpf_assembler/
debuginfo.rs

1use std::ops::Range;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4pub enum RegisterType {
5    Int,
6    Addr,
7    Null,
8}
9
10impl RegisterType {
11    pub fn to_string(&self) -> &'static str {
12        match self {
13            RegisterType::Int => "int",
14            RegisterType::Addr => "addr",
15            RegisterType::Null => "null",
16        }
17    }
18}
19
20#[derive(Debug, Clone)]
21pub struct RegisterHint {
22    pub register: usize,
23    pub register_type: RegisterType,
24}
25
26impl Default for RegisterHint {
27    fn default() -> Self {
28        Self {
29            register: 0,
30            register_type: RegisterType::Null,
31        }
32    }
33}
34
35#[derive(Debug, Clone)]
36pub struct DebugInfo {
37    pub code_span: Range<usize>,
38    pub register_hint: RegisterHint,
39}
40
41impl DebugInfo {
42    pub fn new(code_span: Range<usize>) -> Self {
43        Self { code_span, register_hint: RegisterHint::default() }
44    }
45}
46
47