1 use super::BackendTypes;
2 use crate::mir::operand::OperandRef;
3 use rustc_middle::mir::Operand;
4 use rustc_middle::ty::{self, Ty};
6 use rustc_target::abi::call::FnAbi;
8 pub trait IntrinsicCallMethods<'tcx>: BackendTypes {
9 /// Remember to add all intrinsics here, in librustc_typeck/check/mod.rs,
10 /// and in libcore/intrinsics.rs; if you need access to any llvm intrinsics,
11 /// add them to librustc_codegen_llvm/context.rs
12 fn codegen_intrinsic_call(
14 instance: ty::Instance<'tcx>,
15 fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
16 args: &[OperandRef<'tcx, Self::Value>],
17 llresult: Self::Value,
19 caller_instance: ty::Instance<'tcx>,
22 /// Intrinsic-specific pre-codegen processing, if any is required. Some intrinsics are handled
23 /// at compile time and do not generate code. Returns true if codegen is required or false if
24 /// the intrinsic does not need code generation.
25 fn is_codegen_intrinsic(
28 args: &Vec<Operand<'tcx>>,
29 caller_instance: ty::Instance<'tcx>,
33 fn assume(&mut self, val: Self::Value);
34 fn expect(&mut self, cond: Self::Value, expected: bool) -> Self::Value;
35 fn sideeffect(&mut self);
36 /// Trait method used to inject `va_start` on the "spoofed" `VaListImpl` in
37 /// Rust defined C-variadic functions.
38 fn va_start(&mut self, val: Self::Value) -> Self::Value;
39 /// Trait method used to inject `va_end` on the "spoofed" `VaListImpl` before
40 /// Rust defined C-variadic functions return.
41 fn va_end(&mut self, val: Self::Value) -> Self::Value;