gaia_assembler/backends/windows/
mod.rs1pub mod emitter;
2pub mod x86;
3pub mod x86_64;
4
5use crate::{
6 backends::{Backend, GeneratedFiles},
7 config::GaiaConfig,
8 program::GaiaModule,
9};
10use gaia_types::{
11 helpers::{AbiCompatible, Architecture, ArtifactType, CompilationTarget},
12 Result,
13};
14
15#[derive(Default)]
17pub struct WindowsBackend {}
18
19impl Backend for WindowsBackend {
20 fn name(&self) -> &'static str {
21 "Windows (Native x86_64)"
22 }
23
24 fn primary_target(&self) -> CompilationTarget {
25 self.x86_64_backend().primary_target()
26 }
27
28 fn artifact_type(&self) -> ArtifactType {
29 ArtifactType::Executable
30 }
31
32 fn match_score(&self, target: &CompilationTarget) -> f32 {
33 if target.host != AbiCompatible::PE {
34 return -100.0;
35 }
36
37 match target.build {
38 Architecture::X86_64 => self.x86_64_backend().match_score(target),
39 Architecture::X86 => self.x86_backend().match_score(target),
40 _ => 0.0,
41 }
42 }
43
44 fn generate(&self, program: &GaiaModule, config: &GaiaConfig) -> Result<GeneratedFiles> {
45 let target = &config.target;
46 match target.build {
47 Architecture::X86_64 => self.x86_64_backend().generate(program, config),
48 Architecture::X86 => self.x86_backend().generate(program, config),
49 _ => self.x86_64_backend().generate(program, config), }
51 }
52}
53
54impl WindowsBackend {
55 fn x86_64_backend(&self) -> x86_64::X64Backend {
56 x86_64::X64Backend::default()
57 }
58 fn x86_backend(&self) -> x86::X86Backend {
59 x86::X86Backend::default()
60 }
61}