cairo-native 0.8.0

A compiler to convert Cairo's IR Sierra code to MLIR and execute it.
//! # Builtin costs type
//!
//! A ptr to a list of u64, this list will not change at runtime in size and thus we only really need to store the pointer,
//! it can be allocated on the stack on rust side and passed.

use super::WithSelf;
use crate::{error::Result, metadata::MetadataStorage};
use cairo_lang_sierra::{
    extensions::{
        core::{CoreLibfunc, CoreType},
        types::InfoOnlyConcreteType,
    },
    program_registry::ProgramRegistry,
};
use melior::{
    dialect::llvm,
    ir::{Module, Type},
    Context,
};

/// Build the MLIR type.
///
/// Check out [the module](self) for more info.
pub fn build<'ctx>(
    context: &'ctx Context,
    _module: &Module<'ctx>,
    _registry: &ProgramRegistry<CoreType, CoreLibfunc>,
    _metadata: &mut MetadataStorage,
    _info: WithSelf<InfoOnlyConcreteType>,
) -> Result<Type<'ctx>> {
    // A ptr to a list of u64
    Ok(llvm::r#type::pointer(context, 0))
}