use super::common::*;
use super::function::{DwarfDirective, SectionDirective};
use super::variable::ModuleVariableDirective;
use crate::Spanned;
use crate::parser::Span;
use crate::r#type::{AliasFunctionDirective, EntryFunctionDirective, FuncFunctionDirective};
#[derive(Debug, Clone, PartialEq, Spanned, Default)]
pub struct Module {
pub directives: Vec<ModuleDirective>,
pub span: Span,
}
#[derive(Debug, Clone, PartialEq, Spanned)]
pub enum ModuleDirective {
ModuleVariable {
linkage: Option<DataLinkage>,
directive: ModuleVariableDirective,
span: Span,
},
EntryFunction {
linkage: Option<CodeLinkage>,
directive: EntryFunctionDirective,
span: Span,
},
FuncFunction {
linkage: Option<CodeLinkage>,
directive: FuncFunctionDirective,
span: Span,
},
AliasFunction {
directive: AliasFunctionDirective,
span: Span,
},
ModuleInfo {
directive: ModuleInfoDirectiveKind,
span: Span,
},
Debug {
directive: ModuleDebugDirective,
span: Span,
},
}
#[derive(Debug, Clone, PartialEq, Spanned)]
pub enum ModuleInfoDirectiveKind {
Version {
directive: VersionDirective,
span: Span,
},
Target {
directive: TargetDirective,
span: Span,
},
AddressSize {
directive: AddressSizeDirective,
span: Span,
},
}
#[derive(Debug, Clone, PartialEq, Spanned)]
pub struct VersionDirective {
pub major: u32,
pub minor: u32,
pub span: Span,
}
#[derive(Debug, Clone, PartialEq, Spanned)]
pub struct TargetDirective {
pub entries: Vec<TargetString>,
pub span: Span,
}
#[derive(Debug, Clone, PartialEq, Spanned)]
pub struct AddressSizeDirective {
pub size: AddressSize,
pub span: Span,
}
#[derive(Debug, Clone, PartialEq, Spanned)]
pub enum ModuleDebugDirective {
File {
directive: FileDirective,
span: Span,
},
Section {
directive: SectionDirective,
span: Span,
},
Dwarf {
directive: DwarfDirective,
span: Span,
},
}
#[derive(Debug, Clone, PartialEq, Spanned)]
pub struct FileDirective {
pub index: u32,
pub path: String,
pub timestamp: Option<u64>,
pub file_size: Option<u64>,
pub span: Span,
}
#[derive(Debug, Clone, PartialEq, Spanned)]
pub enum TargetString {
Sm120a { span: Span },
Sm120f { span: Span },
Sm120 { span: Span },
Sm121a { span: Span },
Sm121f { span: Span },
Sm121 { span: Span },
Sm110a { span: Span },
Sm110f { span: Span },
Sm110 { span: Span },
Sm100a { span: Span },
Sm100f { span: Span },
Sm100 { span: Span },
Sm101a { span: Span },
Sm101f { span: Span },
Sm101 { span: Span },
Sm103a { span: Span },
Sm103f { span: Span },
Sm103 { span: Span },
Sm90a { span: Span },
Sm90 { span: Span },
Sm80 { span: Span },
Sm86 { span: Span },
Sm87 { span: Span },
Sm88 { span: Span },
Sm89 { span: Span },
Sm70 { span: Span },
Sm72 { span: Span },
Sm75 { span: Span },
Sm60 { span: Span },
Sm61 { span: Span },
Sm62 { span: Span },
Sm50 { span: Span },
Sm52 { span: Span },
Sm53 { span: Span },
Sm30 { span: Span },
Sm32 { span: Span },
Sm35 { span: Span },
Sm37 { span: Span },
Sm20 { span: Span },
Sm10 { span: Span },
Sm11 { span: Span },
Sm12 { span: Span },
Sm13 { span: Span },
TexmodeUnified { span: Span },
TexmodeIndependent { span: Span },
Debug { span: Span },
MapF64ToF32 { span: Span },
}
#[derive(Debug, Clone, PartialEq, Spanned)]
pub enum AddressSize {
Size32 { span: Span },
Size64 { span: Span },
}