]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_ssa/src/traits/intrinsic.rs
Merge commit '7c7683c8efe447b251d6c5ca6cce51233060f6e8' into clippyup
[rust.git] / compiler / rustc_codegen_ssa / src / traits / intrinsic.rs
1 use super::BackendTypes;
2 use crate::mir::operand::OperandRef;
3 use rustc_middle::ty::{self, Ty};
4 use rustc_span::Span;
5 use rustc_target::abi::call::FnAbi;
6
7 pub trait IntrinsicCallMethods<'tcx>: BackendTypes {
8     /// Remember to add all intrinsics here, in `compiler/rustc_typeck/src/check/mod.rs`,
9     /// and in `library/core/src/intrinsics.rs`; if you need access to any LLVM intrinsics,
10     /// add them to `compiler/rustc_codegen_llvm/src/context.rs`.
11     fn codegen_intrinsic_call(
12         &mut self,
13         instance: ty::Instance<'tcx>,
14         fn_abi: &FnAbi<'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     /// Emits a forced side effect.
24     ///
25     /// Currently has any effect only when LLVM versions prior to 12.0 are used as the backend.
26     fn sideeffect(&mut self);
27     /// Trait method used to inject `va_start` on the "spoofed" `VaListImpl` in
28     /// Rust defined C-variadic functions.
29     fn va_start(&mut self, val: Self::Value) -> Self::Value;
30     /// Trait method used to inject `va_end` on the "spoofed" `VaListImpl` before
31     /// Rust defined C-variadic functions return.
32     fn va_end(&mut self, val: Self::Value) -> Self::Value;
33 }