struct TranslateCtx<'a, T: Target> {
krate: &'a TranslatedCrate,
fmt: FmtCtx<'a>,
target_name: &'a TargetTriple,
target: &'a TargetInfo,
mini_target: PhantomData<T>,
}Fields§
§krate: &'a TranslatedCrate§fmt: FmtCtx<'a>§target_name: &'a TargetTriple§target: &'a TargetInfo§mini_target: PhantomData<T>Implementations§
Source§impl<T: Target> TranslateCtx<'_, T>
impl<T: Target> TranslateCtx<'_, T>
pub(super) fn ty(&self, span: Span, ty: &Ty) -> Result<Type, Error>
fn adt_type(&self, span: Span, tref: &TypeDeclRef) -> Result<Type, Error>
fn tuple_type( &self, span: Span, fields: &IndexVec<FieldId, Field>, layout: Option<&VariantLayout>, size: Size, align: Align, ) -> Result<Type, Error>
fn fields( &self, span: Span, fields: &IndexVec<FieldId, Field>, layout: Option<&VariantLayout>, ) -> Result<Fields, Error>
fn discriminator( &self, span: Span, variants: &IndexVec<VariantId, Variant>, value: &Discriminator, ) -> Result<Discriminator, Error>
pub(super) fn variant_discriminant( &self, span: Span, ty: &Ty, variant: VariantId, ) -> Result<Int, Error>
pub(super) fn variant_discriminant_for_tref( &self, span: Span, tref: &TypeDeclRef, variant: VariantId, ) -> Result<Int, Error>
pub(super) fn pointee_info( &self, span: Span, ty: &Ty, ) -> Result<PointeeInfo, Error>
fn freeze_and_unpin(&self, span: Span, ty: &Ty) -> Result<(bool, bool), Error>
fn unsafe_cell_strategy( &self, span: Span, ty: &Ty, ) -> Result<UnsafeCellStrategy, Error>
pub(super) fn size_and_align( &self, span: Span, ty: &Ty, ) -> Result<(u64, u64), Error>
pub(super) fn metadata_kind( &self, span: Span, ty: &Ty, ) -> Result<PointerMetaKind, Error>
pub(super) fn int_type(&self, ty: IntegerTy) -> IntType
pub(super) fn size(&self, span: Span, size: &Size) -> Result<u64, Error>
Source§impl<'a, T: Target> TranslateCtx<'a, T>
impl<'a, T: Target> TranslateCtx<'a, T>
fn new(krate: &'a TranslatedCrate) -> Result<Self, Error>
fn fn_name(&self, id: FunDeclId) -> FnName
fn global_name(&self, id: GlobalDeclId) -> GlobalName
fn local_name(&self, local: LocalId) -> LocalName
fn field_name(&self, field: FieldId) -> Int
fn block_name(&self, id: BlockId) -> BbName
fn translate(&self) -> Result<Program, Error>
Source§impl<T: Target> TranslateCtx<'_, T>
Function bodies.
impl<T: Target> TranslateCtx<'_, T>
Function bodies.
Sourcefn make_start_function(
&self,
span: Span,
main: FunDeclId,
) -> Result<Function, Error>
fn make_start_function( &self, span: Span, main: FunDeclId, ) -> Result<Function, Error>
Make a start function with the right calling convention that just calls into main().
Sourcefn make_intrinsic_function(
&self,
span: Span,
fdecl: &FunDecl,
intrinsic: IntrinsicOp,
) -> Result<Function, Error>
fn make_intrinsic_function( &self, span: Span, fdecl: &FunDecl, intrinsic: IntrinsicOp, ) -> Result<Function, Error>
Make a function that invokes the matching MiniRust intrinsic.
Sourcefn make_catch_unwind_function(
&self,
span: Span,
fdecl: &FunDecl,
) -> Result<Function, Error>
fn make_catch_unwind_function( &self, span: Span, fdecl: &FunDecl, ) -> Result<Function, Error>
Implement core::intrinsics::catch_unwind in MiniRust.
Sourcefn make_start_unwind_function(
&self,
span: Span,
fdecl: &FunDecl,
) -> Result<Function, Error>
fn make_start_unwind_function( &self, span: Span, fdecl: &FunDecl, ) -> Result<Function, Error>
Give the minirust_start_unwind foreign symbol a body that starts unwinding.
fn function( &self, span: Span, fdecl: &FunDecl, body: &ExprBody, ) -> Result<Function, Error>
fn statement( &self, statement: &Statement, ) -> Result<SmallVec<[Statement; 1]>, Error>
fn terminator( &self, terminator: &Terminator, is_cleanup: bool, extra_blocks: &mut Map<BbName, BasicBlock>, block_id_gen: &mut Generator<BlockId>, ) -> Result<Terminator, Error>
fn start_unwind(&self, on_unwind: BlockId) -> Terminator
fn place(&self, span: Span, place: &Place) -> Result<PlaceExpr, Error>
fn operand(&self, span: Span, operand: &Operand) -> Result<ValueExpr, Error>
fn switch_value( &self, span: Span, scrutinee: &SwitchScrutinee, ) -> Result<ValueExpr, Error>
fn rvalue(&self, span: Span, value: &Rvalue) -> Result<ValueExpr, Error>
fn binop( &self, span: Span, op: BinOp, left: &Operand, right: &Operand, ) -> Result<ValueExpr, Error>
fn unop( &self, span: Span, op: &UnOp, operand: &Operand, ) -> Result<ValueExpr, Error>
fn aggregate( &self, span: Span, kind: &AggregateKind, operands: &[Operand], ) -> Result<ValueExpr, Error>
fn transmute(&self, value: ValueExpr, ty: Type) -> ValueExpr
fn bool_to_int(&self, value: ValueExpr) -> ValueExpr
fn int_to_bool(&self, value: ValueExpr) -> ValueExpr
fn fn_pointer(&self, id: FunDeclId) -> ValueExpr
fn calling_convention( &self, span: Span, abi: &Abi, ) -> Result<CallingConvention, Error>
fn callee_convention( &self, span: Span, operand: &FnOperand, ) -> Result<CallingConvention, Error>
Source§impl<T: Target> TranslateCtx<'_, T>
Constants
impl<T: Target> TranslateCtx<'_, T>
Constants
Auto Trait Implementations§
impl<'a, T> Freeze for TranslateCtx<'a, T>where
PhantomData<T>: Freeze,
impl<'a, T> RefUnwindSafe for TranslateCtx<'a, T>where
PhantomData<T>: RefUnwindSafe,
impl<'a, T> Send for TranslateCtx<'a, T>where
PhantomData<T>: Send,
impl<'a, T> Sync for TranslateCtx<'a, T>where
PhantomData<T>: Sync,
impl<'a, T> Unpin for TranslateCtx<'a, T>where
PhantomData<T>: Unpin,
impl<'a, T> UnsafeUnpin for TranslateCtx<'a, T>where
PhantomData<T>: UnsafeUnpin,
impl<'a, T> UnwindSafe for TranslateCtx<'a, T>where
PhantomData<T>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more