Struct gccjit::Block
[−]
[src]
pub struct Block<'ctx> { /* fields omitted */ }
Block represents a basic block in gccjit. Blocks are created by functions. A basic block consists of a series of instructions terminated by a terminator instruction, which can be either a jump to one block, a conditional branch to two blocks (true/false branches), a return, or a void return.
Methods
impl<'ctx> Block<'ctx>
[src]
fn get_function(&self) -> Function<'ctx>
fn add_eval<T: ToRValue<'ctx>>(&self, loc: Option<Location<'ctx>>, value: T)
Evaluates the rvalue parameter and discards its result. Equivalent
to (void)
fn add_assignment<L: ToLValue<'ctx>, R: ToRValue<'ctx>>(
&self,
loc: Option<Location<'ctx>>,
assign_target: L,
value: R
)
&self,
loc: Option<Location<'ctx>>,
assign_target: L,
value: R
)
Assigns the value of an rvalue to an lvalue directly. Equivalent
to
fn add_assignment_op<L: ToLValue<'ctx>, R: ToRValue<'ctx>>(
&self,
loc: Option<Location<'ctx>>,
assign_target: L,
op: BinaryOp,
value: R
)
&self,
loc: Option<Location<'ctx>>,
assign_target: L,
op: BinaryOp,
value: R
)
Performs a binary operation on an LValue and an RValue, assigning the result of the binary operation to the LValue upon completion. Equivalent to the *=, +=, -=, etc. operator family in C.
fn add_comment<S: AsRef<str>>(&self, loc: Option<Location<'ctx>>, message: S)
Adds a comment to a block. It's unclear from the documentation what this actually means.
fn end_with_conditional<T: ToRValue<'ctx>>(
&self,
loc: Option<Location<'ctx>>,
cond: T,
on_true: Block<'ctx>,
on_false: Block<'ctx>
)
&self,
loc: Option<Location<'ctx>>,
cond: T,
on_true: Block<'ctx>,
on_false: Block<'ctx>
)
Terminates a block by branching to one of two blocks, depending on the value of a conditional RValue.
fn end_with_jump(&self, loc: Option<Location<'ctx>>, target: Block<'ctx>)
Terminates a block by unconditionally jumping to another block.
fn end_with_return<T: ToRValue<'ctx>>(
&self,
loc: Option<Location<'ctx>>,
ret: T
)
&self,
loc: Option<Location<'ctx>>,
ret: T
)
Terminates a block by returning from the containing function, setting
the rvalue to be the return value of the function. This is equivalent
to C's "return
fn end_with_void_return(&self, loc: Option<Location<'ctx>>)
Terminates a block by returning from the containing function, returning no value. This is equivalent to C's bare "return" with no expression. This function can only be used to terminate a block within a function that returns void.
Trait Implementations
impl<'ctx> Copy for Block<'ctx>
[src]
impl<'ctx> Clone for Block<'ctx>
[src]
fn clone(&self) -> Block<'ctx>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more