~garritfra/antimony

e595b564f4560f1e17131cc273a7081821ebfbf7 — Garrit Franke 5 months ago a9387fc
feat(x86): add x86 target
3 files changed, 5 insertions(+), 2 deletions(-)

M src/builder/mod.rs
M src/generator/mod.rs
M src/main.rs
M src/builder/mod.rs => src/builder/mod.rs +1 -0
@@ 141,6 141,7 @@ impl Builder {
                #[cfg(feature = "llvm")]
                generator::llvm::LLVMGenerator::generate(condensed)
            }
            Target::X86 => generator::x86::X86Generator::generate(condensed),
        };

        buffer.write_all(output.as_bytes()).expect("write failed");

M src/generator/mod.rs => src/generator/mod.rs +3 -1
@@ 30,6 30,7 @@ pub enum Target {
    C,
    JS,
    LLVM,
    X86,
}

impl Target {


@@ 41,6 42,7 @@ impl Target {
        match &*ext.to_string_lossy() {
            "c" => Some(Self::C),
            "js" => Some(Self::JS),
            "s" => Some(Self::X86),
            _ => None,
        }
    }


@@ 56,7 58,7 @@ impl FromStr for Target {
            "c" => Ok(Target::C),
            "js" => Ok(Target::JS),
            "llvm" => Ok(Target::LLVM),

            "x86" => Ok(Target::X86),
            _ => Err(format!("no target {} found", s)),
        }
    }

M src/main.rs => src/main.rs +1 -1
@@ 56,7 56,7 @@ struct Opt {
    #[structopt(subcommand)]
    command: Command,

    /// Target language. Options: c, js, llvm
    /// Target language. Options: c, js, llvm, x86
    #[structopt(long, short, parse(try_from_str))]
    target: Option<Target>,
}