]> git.lizzy.rs Git - rust.git/blob - src/librustc_codegen_ssa/traits/intrinsic.rs
ede30a0bed756d2c29e7d93be495a9904ccc8e94
[rust.git] / src / librustc_codegen_ssa / traits / intrinsic.rs
1 use super::BackendTypes;
2 use crate::mir::operand::OperandRef;
3 use rustc::ty::Ty;
4 use rustc_target::abi::call::FnType;
5 use syntax_pos::Span;
6
7 pub trait IntrinsicCallMethods<'tcx>: BackendTypes {
8     /// Remember to add all intrinsics here, in librustc_typeck/check/mod.rs,
9     /// and in libcore/intrinsics.rs; if you need access to any llvm intrinsics,
10     /// add them to librustc_codegen_llvm/context.rs
11     fn codegen_intrinsic_call(
12         &mut self,
13         callee_ty: Ty<'tcx>,
14         fn_ty: &FnType<'tcx, Ty<'tcx>>,
15         args: &[OperandRef<'tcx, Self::Value>],
16         llresult: Self::Value,
17         span: Span,
18     );
19
20     fn abort(&mut self);
21     fn assume(&mut self, val: Self::Value);
22     fn expect(&mut self, cond: Self::Value, expected: bool) -> Self::Value;
23     /// Trait method used to inject `va_start` on the "spoofed" `VaListImpl` in
24     /// Rust defined C-variadic functions.
25     fn va_start(&mut self, val: Self::Value) -> Self::Value;
26     /// Trait method used to inject `va_end` on the "spoofed" `VaListImpl` before
27     /// Rust defined C-variadic functions return.
28     fn va_end(&mut self, val: Self::Value) -> Self::Value;
29 }