llvm_wrap/
cc.rs

1//! A renamed `LLVMCallConv`
2use super::*;
3
4/// A renamed `LLVMCallConv`
5#[derive(Copy, Clone, Debug, Eq, PartialEq)]
6pub enum CallConv {
7    /// The default C calling convention
8    C = 0,
9    /// Makes calls as fast as possible. Allows tail calls
10    Fast = 8,
11    /// Assumes the function will not be called frequently
12    Cold = 9,
13    /// The calling convention for WebKit JS
14    WebKitJS = 12,
15    /// Dynamic calling convention for code patching
16    AnyReg = 13,
17    /// The x86 standard calling convention
18    X86Stdcall = 64,
19    /// The x86 fast calling convention
20    X86Fastcall = 65,
21}
22
23impl CallConv {
24    /// The `LLVMCallConv` this value represents
25    pub fn inner(&self) -> LLVMCallConv {
26        use llvm_sys::LLVMCallConv::*;
27        use self::CallConv::*;
28        match self {
29            &C => LLVMCCallConv,
30            &Fast => LLVMFastCallConv,
31            &Cold => LLVMColdCallConv,
32            &WebKitJS => LLVMWebKitJSCallConv,
33            &AnyReg => LLVMAnyRegCallConv,
34            &X86Stdcall => LLVMX86StdcallCallConv,
35            &X86Fastcall => LLVMX86FastcallCallConv,
36        }
37    }
38}