llvm_scratch/core/intrinsics/
intrinsic.rs

1use fmt::Formatter;
2use std::fmt;
3
4use crate::core::llvm_type::LLVMType;
5
6#[derive(Eq, PartialEq, PartialOrd, Ord, Hash, Clone)]
7pub enum Intrinsic {
8    DONOTHING,
9}
10
11impl Intrinsic {
12    pub fn return_type(&self) -> LLVMType {
13        match self {
14            Self::DONOTHING => LLVMType::new_void(),
15        }
16    }
17}
18
19impl fmt::Display for Intrinsic {
20    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
21        let int_str = match self {
22            Self::DONOTHING => "void @llvm.donothing() nounwind readnone",
23        };
24
25        write!(f, "{}", int_str)
26    }
27}