1
Fork 0
rust/src/librustc_codegen_ssa/traits/intrinsic.rs

43 lines
1.7 KiB
Rust
Raw Normal View History

use super::BackendTypes;
2019-02-09 23:31:47 +09:00
use crate::mir::operand::OperandRef;
use rustc_middle::mir::Operand;
2020-03-29 16:41:09 +02:00
use rustc_middle::ty::{self, Ty};
use rustc_span::{Span, Symbol};
use rustc_target::abi::call::FnAbi;
2018-09-07 15:39:39 -07:00
pub trait IntrinsicCallMethods<'tcx>: BackendTypes {
2018-09-24 17:35:39 +02:00
/// Remember to add all intrinsics here, in librustc_typeck/check/mod.rs,
/// and in libcore/intrinsics.rs; if you need access to any llvm intrinsics,
/// add them to librustc_codegen_llvm/context.rs
2018-09-11 11:46:03 +02:00
fn codegen_intrinsic_call(
&mut self,
instance: ty::Instance<'tcx>,
fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
2018-09-11 11:46:03 +02:00
args: &[OperandRef<'tcx, Self::Value>],
llresult: Self::Value,
span: Span,
caller_instance: ty::Instance<'tcx>,
2018-09-11 11:46:03 +02:00
);
2018-09-07 15:39:39 -07:00
/// Intrinsic-specific pre-codegen processing, if any is required. Some intrinsics are handled
/// at compile time and do not generate code. Returns true if codegen is required or false if
/// the intrinsic does not need code generation.
fn is_codegen_intrinsic(
&mut self,
intrinsic: Symbol,
args: &Vec<Operand<'tcx>>,
caller_instance: ty::Instance<'tcx>,
) -> bool;
fn abort(&mut self);
fn assume(&mut self, val: Self::Value);
fn expect(&mut self, cond: Self::Value, expected: bool) -> Self::Value;
fn sideeffect(&mut self);
/// Trait method used to inject `va_start` on the "spoofed" `VaListImpl` in
/// Rust defined C-variadic functions.
fn va_start(&mut self, val: Self::Value) -> Self::Value;
/// Trait method used to inject `va_end` on the "spoofed" `VaListImpl` before
/// Rust defined C-variadic functions return.
fn va_end(&mut self, val: Self::Value) -> Self::Value;
2018-09-07 15:39:39 -07:00
}