llvm-scratch 0.1.15

Free Standing library in Rust
Documentation
use fmt::Formatter;
use std::fmt;

use crate::core::llvm_type::LLVMType;

#[derive(Eq, PartialEq, PartialOrd, Ord, Hash, Clone)]
pub enum Intrinsic {
    DONOTHING,
}

impl Intrinsic {
    pub fn return_type(&self) -> LLVMType {
        match self {
            Self::DONOTHING => LLVMType::new_void(),
        }
    }
}

impl fmt::Display for Intrinsic {
    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
        let int_str = match self {
            Self::DONOTHING => "void @llvm.donothing() nounwind readnone",
        };

        write!(f, "{}", int_str)
    }
}