llvm-native-core 0.1.9

LLVM-native core semantic engine — IR, CodeGen, X86 MC, Clang frontend pipeline
//! SPARC Target Backend — Sun/Oracle SPARC v8/v9 RISC architecture.
//!
//! Complete register information, instruction set metadata, instruction
//! selection, MC encoding, and assembly printer for the SPARC architecture
//! family, covering both 32-bit SPARC v8 and 64-bit SPARC v9.
//!
//! Clean-room behavioral reconstruction from the SPARC Architecture Manual
//! Version 8 and Version 9, the SPARC ABI Supplement, and the SPARC
//! Compliance Definition. Zero LLVM source code consultation.
//!
//! Architecture coverage:
//! - SPARC v8: 32-bit integer, FPU, windowed register file
//! - SPARC v9: 64-bit integer extensions, VIS
//! - 3 instruction formats: Format 1 (CALL), Format 2 (SETHI/Branches),
//!   Format 3 (all arithmetic/logical/memory)

pub mod sparc_asm_printer;
pub mod sparc_instr_info;
pub mod sparc_isel;
pub mod sparc_mc_encoder;
pub mod sparc_register_info;
pub mod sparc_vis_isel;
pub mod sparc_x86_bridge;

// Re-export key types for convenience
pub use sparc_asm_printer::SparcAsmPrinter;
pub use sparc_instr_info::{SparcInstrDesc, SparcInstrInfo, SparcOpcode, SparcOperandType};
pub use sparc_isel::SparcInstructionSelector;
pub use sparc_mc_encoder::SparcMCEncoder;
pub use sparc_register_info::{
    SparcRegClass, SparcRegisterInfo, SPARC_FPR_BASE, SPARC_FPR_COUNT, SPARC_GPR_BASE,
    SPARC_GPR_COUNT, SPARC_MAX_REG_ID,
};

/// SPARC is big-endian by default.
pub const SPARC_ENDIANNESS: &str = "big";

/// SPARC stack alignment (8 bytes for v8, 16 bytes for v9).
pub const SPARC_STACK_ALIGNMENT: u32 = 16;

/// SPARC red zone size (none defined by ABI).
pub const SPARC_RED_ZONE_SIZE: u32 = 0;

/// Default SPARC page size (8 KiB is common for SPARC).
pub const SPARC_PAGE_SIZE: u32 = 8192;

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_sparc_constants() {
        assert_eq!(SPARC_ENDIANNESS, "big");
        assert_eq!(SPARC_STACK_ALIGNMENT, 16);
        assert_eq!(SPARC_RED_ZONE_SIZE, 0);
        assert_eq!(SPARC_PAGE_SIZE, 8192);
    }
}