llvm-native-core 0.1.6

LLVM-native core semantic engine — IR, CodeGen, X86 MC, Clang frontend pipeline
//! PowerPC Target Backend — complete register information,
//! instruction set metadata, instruction selection, MC encoding,
//! and assembly printer for the PowerPC 32/64-bit architecture family.
//!
//! Clean-room behavioral reconstruction from the Power ISA
//! (Versions 2.07 and 3.0), the PowerPC ELF ABI Supplement
//! (ELFv1 and ELFv2), and the PowerPC Assembly Language Reference.
//! Zero LLVM source code consultation.
//!
//! Architecture coverage:
//! - PowerISA 2.07: base 32/64-bit integer instruction set
//! - PowerISA 3.0: additional instructions
//! - FPU: double-precision operations
//! - VMX/VSX: AltiVec vector extensions (v0-v31, vs0-vs63)
//! - ABIs: ELFv1 (PPC64 big-endian), ELFv2 (PPC64 little-endian)

pub mod powerpc_x86_bridge;
pub mod ppc_asm_printer;
pub mod ppc_instr_info;
pub mod ppc_isel;
pub mod ppc_isel_full;
pub mod ppc_mc_encoder;
pub mod ppc_register_info;
pub mod ppc_subtarget_full;

// Re-export key types for convenience
pub use ppc_asm_printer::PpcAsmPrinter;
pub use ppc_instr_info::{PpcInstrDesc, PpcInstrInfo, PpcOpcode, PpcOperandType};
pub use ppc_isel::PpcInstructionSelector;
pub use ppc_isel_full::{
    PpcFullInstructionSelector, PpcMachineInstrExt, VsxElementType, VsxLoadStoreOp,
    VsxPermuteOp, VsxPattern, VsxReductionOp, MmaAccTile, MmaOuterType, MmaPattern,
    MmaInterLane, PrefixType, PrefixInstrDesc, DfpRoundingMode, DfpTestGroup,
    DfpClassTest, BfpConvertOp, VleFormat,
};
pub use ppc_mc_encoder::PpcMCEncoder;
pub use ppc_register_info::{
    PpcRegClass, PpcRegisterInfo, PPC_FPR_BASE, PPC_FPR_COUNT, PPC_GPR_BASE, PPC_GPR_COUNT,
    PPC_MAX_REG_ID, PPC_VR_BASE,
};
pub use ppc_subtarget_full::{
    PpcAbi, PpcCpu, PpcFeatureSet, PpcSchedModel, PpcSubtargetDb,
    PpcSubtargetFull, PpcTuningFlags,
};

/// PowerPC default endianness is big-endian (ELFv1), but ELFv2 is little-endian.
pub const PPC_ENDIANNESS: &str = "big";

/// PowerPC stack alignment (16 bytes per ABI).
pub const PPC_STACK_ALIGNMENT: u32 = 16;

/// PowerPC red zone size (288 bytes for ELFv2 ABI).
pub const PPC_RED_ZONE_SIZE: u32 = 288;

/// Default PowerPC page size (4 KiB).
pub const PPC_PAGE_SIZE: u32 = 4096;

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

    #[test]
    fn test_ppc_constants() {
        assert_eq!(PPC_ENDIANNESS, "big");
        assert_eq!(PPC_STACK_ALIGNMENT, 16);
        assert_eq!(PPC_RED_ZONE_SIZE, 288);
        assert_eq!(PPC_PAGE_SIZE, 4096);
    }
}