llvm-native-core 0.1.13

LLVM-native core semantic engine — IR, CodeGen, X86 MC, Clang frontend pipeline
//! GlobalISel — Global Instruction Selection framework.
//!
//! Clean-room behavioral reconstruction from the LLVM GlobalISel
//! documentation, the generic Machine IR specification, and the
//! Legalizer/Combiner pipeline design. Zero LLVM C++ source code
//! consultation.
//!
//! GlobalISel operates directly on the target-independent Machine IR
//! (MIR), applying a sequence of passes: IR translation, legalization,
//! register bank selection, instruction selection, and combining.
//! Unlike SelectionDAG, GlobalISel works on the whole function at once.
//!
//! Modules:
//! - `gisel_machine_ir`: Machine IR builder for GlobalISel
//! - `gisel_legalizer`: Generic instruction legalizer
//! - `gisel_combiner`: Machine IR peephole combiner

pub mod gisel_combiner;
pub mod gisel_irtranslator;
pub mod gisel_legalizer;
pub mod gisel_machine_ir;
pub mod gisel_regbankselect;

pub use gisel_combiner::GISelCombiner;
pub use gisel_irtranslator::GISelIRTranslator;
pub use gisel_legalizer::{
    GISelLegalizer, LegalizeAction, LegalizeCondition, LegalizeRule, LegalizerInfo,
};
pub use gisel_machine_ir::MachineIRBuilder;
pub use gisel_regbankselect::{
    CostModel, ExhaustiveRegBankSelect, GreedyRegBankSelect, RegBankSelectPass,
    RegBankSelectStrategy, RegisterBank, RepairingPlacement, TargetRegBankInfo,
};

/// Default maximum number of legalization iterations.
pub const GISEL_MAX_LEGALIZATION_ITERATIONS: usize = 32;

/// Default maximum number of combine iterations.
pub const GISEL_MAX_COMBINE_ITERATIONS: usize = 8;

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

    #[test]
    fn test_gisel_constants() {
        assert_eq!(GISEL_MAX_LEGALIZATION_ITERATIONS, 32);
        assert_eq!(GISEL_MAX_COMBINE_ITERATIONS, 8);
    }
}