Struct rustc_codegen_llvm::builder::Builder [−][src]
pub struct Builder<'a, 'll, 'tcx> {
pub llbuilder: &'ll mut Builder<'ll>,
pub cx: &'a CodegenCx<'ll, 'tcx>,
}
Fields
llbuilder: &'ll mut Builder<'ll>
cx: &'a CodegenCx<'ll, 'tcx>
Implementations
pub fn insert_element(
&mut self,
vec: &'ll Value,
elt: &'ll Value,
idx: &'ll Value
) -> &'ll Value
pub fn shuffle_vector(
&mut self,
v1: &'ll Value,
v2: &'ll Value,
mask: &'ll Value
) -> &'ll Value
fn check_call<'b>(
&mut self,
typ: &str,
fn_ty: &'ll Type,
llfn: &'ll Value,
args: &'b [&'ll Value]
) -> Cow<'b, [&'ll Value]>
Methods from Deref<Target = CodegenCx<'ll, 'tcx>>
Generates a new symbol name with the given prefix. This symbol name must
only be used for definitions with internal
or private
linkage.
Looks up debug source information about a BytePos
.
Declare a global value.
If there’s a value with the same name already declared, the function will return its Value instead.
Declare a C ABI function.
Only use this for foreign function ABIs and glue. For Rust functions use
declare_fn
instead.
If there’s a value with the same name already declared, the function will update the declaration and return existing Value instead.
Declare a Rust function.
If there’s a value with the same name already declared, the function will update the declaration and return existing Value instead.
Declare a global with an intention to define it.
Use this function when you intend to define a global. This function will
return None
if the name already has a definition associated with it. In that
case an error should be reported to the user, because it usually happens due
to user’s fault (e.g., misuse of #[no_mangle]
or #[export_name]
attributes).
Declare a private global
Use this function when you intend to define a global without a name.
Gets declared value by name.
Gets defined or externally defined (AvailableExternally linkage) value by name.
pub(crate) unsafe fn should_assume_dso_local(
&self,
llval: &Value,
is_declaration: bool
) -> bool
pub(crate) unsafe fn should_assume_dso_local(
&self,
llval: &Value,
is_declaration: bool
) -> bool
Whether a definition or declaration can be assumed to be local to a group of libraries that form a single DSO or executable.
x Creates an integer type with the given number of bits, e.g., i24
Return a LLVM type that has at most the required alignment, and exactly the required size, as a best-effort padding array.
Trait Implementations
fn codegen_llvm_inline_asm(
&mut self,
ia: &LlvmInlineAsmInner,
outputs: Vec<PlaceRef<'tcx, &'ll Value>>,
inputs: Vec<&'ll Value>,
span: Span
) -> bool
fn codegen_llvm_inline_asm(
&mut self,
ia: &LlvmInlineAsmInner,
outputs: Vec<PlaceRef<'tcx, &'ll Value>>,
inputs: Vec<&'ll Value>,
span: Span
) -> bool
Take an inline assembly expression and splat it out via LLVM
fn codegen_inline_asm(
&mut self,
template: &[InlineAsmTemplatePiece],
operands: &[InlineAsmOperandRef<'tcx, Self>],
options: InlineAsmOptions,
line_spans: &[Span]
)
fn codegen_inline_asm(
&mut self,
template: &[InlineAsmTemplatePiece],
operands: &[InlineAsmOperandRef<'tcx, Self>],
options: InlineAsmOptions,
line_spans: &[Span]
)
Take an inline assembly expression and splat it out via LLVM
fn append_block(
cx: &'a CodegenCx<'ll, 'tcx>,
llfn: &'ll Value,
name: &str
) -> &'ll BasicBlock
fn cond_br(
&mut self,
cond: &'ll Value,
then_llbb: &'ll BasicBlock,
else_llbb: &'ll BasicBlock
)
fn switch(
&mut self,
v: &'ll Value,
else_llbb: &'ll BasicBlock,
cases: impl ExactSizeIterator<Item = (u128, &'ll BasicBlock)>
)
fn invoke(
&mut self,
llty: &'ll Type,
llfn: &'ll Value,
args: &[&'ll Value],
then: &'ll BasicBlock,
catch: &'ll BasicBlock,
funclet: Option<&Funclet<'ll>>
) -> &'ll Value
fn checked_binop(
&mut self,
oop: OverflowOp,
ty: Ty<'_>,
lhs: Self::Value,
rhs: Self::Value
) -> (Self::Value, Self::Value)
fn atomic_load(
&mut self,
ty: &'ll Type,
ptr: &'ll Value,
order: AtomicOrdering,
size: Size
) -> &'ll Value
fn write_operand_repeatedly(
self,
cg_elem: OperandRef<'tcx, &'ll Value>,
count: u64,
dest: PlaceRef<'tcx, &'ll Value>
) -> Self
fn write_operand_repeatedly(
self,
cg_elem: OperandRef<'tcx, &'ll Value>,
count: u64,
dest: PlaceRef<'tcx, &'ll Value>
) -> Self
Called for Rvalue::Repeat when the elem is neither a ZST nor optimizable using memset.
fn store_with_flags(
&mut self,
val: &'ll Value,
ptr: &'ll Value,
align: Align,
flags: MemFlags
) -> &'ll Value
fn atomic_store(
&mut self,
val: &'ll Value,
ptr: &'ll Value,
order: AtomicOrdering,
size: Size
)
fn memcpy(
&mut self,
dst: &'ll Value,
dst_align: Align,
src: &'ll Value,
src_align: Align,
size: &'ll Value,
flags: MemFlags
)
fn memmove(
&mut self,
dst: &'ll Value,
dst_align: Align,
src: &'ll Value,
src_align: Align,
size: &'ll Value,
flags: MemFlags
)
fn memset(
&mut self,
ptr: &'ll Value,
fill_byte: &'ll Value,
size: &'ll Value,
align: Align,
flags: MemFlags
)
fn landing_pad(
&mut self,
ty: &'ll Type,
pers_fn: &'ll Value,
num_clauses: usize
) -> &'ll Value
fn cleanup_ret(
&mut self,
funclet: &Funclet<'ll>,
unwind: Option<&'ll BasicBlock>
) -> &'ll Value
fn catch_switch(
&mut self,
parent: Option<&'ll Value>,
unwind: Option<&'ll BasicBlock>,
num_handlers: usize
) -> &'ll Value
fn atomic_cmpxchg(
&mut self,
dst: &'ll Value,
cmp: &'ll Value,
src: &'ll Value,
order: AtomicOrdering,
failure_order: AtomicOrdering,
weak: bool
) -> &'ll Value
fn atomic_rmw(
&mut self,
op: AtomicRmwBinOp,
dst: &'ll Value,
src: &'ll Value,
order: AtomicOrdering
) -> &'ll Value
Called for StorageLive
Called for StorageDead
fn instrprof_increment(
&mut self,
fn_name: &'ll Value,
hash: &'ll Value,
num_counters: &'ll Value,
index: &'ll Value
)
fn call(
&mut self,
llty: &'ll Type,
llfn: &'ll Value,
args: &[&'ll Value],
funclet: Option<&Funclet<'ll>>
) -> &'ll Value
fn to_immediate(
&mut self,
val: Self::Value,
layout: TyAndLayout<'_, &TyS<'_>>
) -> Self::Value
fn set_function_source_hash(
&mut self,
instance: Instance<'tcx>,
function_source_hash: u64
) -> bool
fn set_function_source_hash(
&mut self,
instance: Instance<'tcx>,
function_source_hash: u64
) -> bool
Returns true if the function source hash was added to the coverage map (even if it had
already been added, for this instance). Returns false only if -Z instrument-coverage
is
not enabled (a coverage map is not being generated). Read more
fn add_coverage_counter(
&mut self,
instance: Instance<'tcx>,
id: CounterValueReference,
region: CodeRegion
) -> bool
fn add_coverage_counter(
&mut self,
instance: Instance<'tcx>,
id: CounterValueReference,
region: CodeRegion
) -> bool
Returns true if the counter was added to the coverage map; false if -Z instrument-coverage
is not enabled (a coverage map is not being generated). Read more
fn add_coverage_counter_expression(
&mut self,
instance: Instance<'tcx>,
id: InjectedExpressionId,
lhs: ExpressionOperandId,
op: Op,
rhs: ExpressionOperandId,
region: Option<CodeRegion>
) -> bool
fn add_coverage_counter_expression(
&mut self,
instance: Instance<'tcx>,
id: InjectedExpressionId,
lhs: ExpressionOperandId,
op: Op,
rhs: ExpressionOperandId,
region: Option<CodeRegion>
) -> bool
Returns true if the expression was added to the coverage map; false if
-Z instrument-coverage
is not enabled (a coverage map is not being generated). Read more
Returns true if the region was added to the coverage map; false if -Z instrument-coverage
is not enabled (a coverage map is not being generated). Read more
fn dbg_var_addr(
&mut self,
dbg_var: &'ll DIVariable,
dbg_loc: &'ll DILocation,
variable_alloca: Self::Value,
direct_offset: Size,
indirect_offsets: &[Size]
)
type FnAbiOfResult = &'tcx FnAbi<'tcx, Ty<'tcx>>
type FnAbiOfResult = &'tcx FnAbi<'tcx, Ty<'tcx>>
The &FnAbi
-wrapping type (or &FnAbi
itself), which will be
returned from fn_abi_of_*
(see also handle_fn_abi_err
). Read more
fn handle_fn_abi_err(
&self,
err: FnAbiError<'tcx>,
span: Span,
fn_abi_request: FnAbiRequest<'tcx>
) -> !
fn handle_fn_abi_err(
&self,
err: FnAbiError<'tcx>,
span: Span,
fn_abi_request: FnAbiRequest<'tcx>
) -> !
Helper used for fn_abi_of_*
, to adapt tcx.fn_abi_of_*(...)
into a
Self::FnAbiOfResult
(which does not need to be a Result<...>
). Read more
Remember to add all intrinsics here, in compiler/rustc_typeck/src/check/mod.rs
,
and in library/core/src/intrinsics.rs
; if you need access to any LLVM intrinsics,
add them to compiler/rustc_codegen_llvm/src/context.rs
. Read more
Emits a forced side effect. Read more
Trait method used to inject va_start
on the “spoofed” VaListImpl
in
Rust defined C-variadic functions. Read more
type LayoutOfResult = TyAndLayout<'tcx>
type LayoutOfResult = TyAndLayout<'tcx>
The TyAndLayout
-wrapping type (or TyAndLayout
itself), which will be
returned from layout_of
(see also handle_layout_err
). Read more
Helper used for layout_of
, to adapt tcx.layout_of(...)
into a
Self::LayoutOfResult
(which does not need to be a Result<...>
). Read more
Span
to use for tcx.at(span)
, from layout_of
.
Auto Trait Implementations
impl<'a, 'll, 'tcx> !RefUnwindSafe for Builder<'a, 'll, 'tcx>
impl<'a, 'll, 'tcx> !UnwindSafe for Builder<'a, 'll, 'tcx>
Blanket Implementations
Mutably borrows from an owned value. Read more
fn fn_abi_of_fn_ptr(
&self,
sig: Binder<'tcx, FnSig<'tcx>>,
extra_args: &'tcx List<&'tcx TyS<'tcx>>
) -> Self::FnAbiOfResult
fn fn_abi_of_fn_ptr(
&self,
sig: Binder<'tcx, FnSig<'tcx>>,
extra_args: &'tcx List<&'tcx TyS<'tcx>>
) -> Self::FnAbiOfResult
Compute a FnAbi
suitable for indirect calls, i.e. to fn
pointers. Read more
fn fn_abi_of_instance(
&self,
instance: Instance<'tcx>,
extra_args: &'tcx List<&'tcx TyS<'tcx>>
) -> Self::FnAbiOfResult
fn fn_abi_of_instance(
&self,
instance: Instance<'tcx>,
extra_args: &'tcx List<&'tcx TyS<'tcx>>
) -> Self::FnAbiOfResult
Compute a FnAbi
suitable for declaring/defining an fn
instance, and for
direct calls to an fn
. Read more
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 16 bytes