pub fn conditional_branch(
        mut self,
        condition: Value,
        true_block: Block,
        false_block: Block,
        true_args: &[Value],
        false_args: &[Value],
        location: Option<Location>,
    ) {
        self.make_value(Instruction::ConditionalBranch(
            condition,
            true_block,
            false_block,
            true_args.to_vec(),
            false_args.to_vec(),
            location,
        ));
    }
/// Record a conditional branch between blocks.
///
/// Restrictions:
/// - The `condition` must be a boolean.
///
/// # Examples
///
/// ```
/// # use yair::*;
/// # let mut context = Context::new();
/// # let module = context.create_module().build();
/// # let u32_ty = context.get_uint_type(32);
/// # let function = module.create_function(&mut context).with_name("func").with_return_type(u32_ty).with_arg("a", u32_ty).with_arg("b", u32_ty).build();
/// # let block = function.create_block(&mut context).build();
/// # let true_block = function.create_block(&mut context).with_arg(u32_ty).with_arg(u32_ty).build();
/// # let false_block = function.create_block(&mut context).with_arg(u32_ty).with_arg(u32_ty).build();
/// # let x = function.get_arg(&context, 0);
/// # let y = function.get_arg(&context, 1);
/// # let mut instruction_builder = block.create_instructions(&mut context);
/// # let location = None;
/// # let condition = instruction_builder.cmp_ge(x, y, location);
/// instruction_builder.conditional_branch(condition, true_block, false_block, &[ x, y ], &[ x, y ], location);
/// ```
Record a conditional branch between blocks.
Restrictions:
The `condition` must be a boolean.
Record a conditional branch between blocks . Restrictions : The ` condition ` must be a boolean .
pub fn conditional_branch(
        mut self,
        condition: Value,
        true_block: Block,
        false_block: Block,
        true_args: &[Value],
        false_args: &[Value],
        location: Option<Location>,
    ) {
        self.make_value(Instruction::ConditionalBranch(
            condition,
            true_block,
            false_block,
            true_args.to_vec(),
            false_args.to_vec(),
            location,
        ));
    }
pub fn conditional_branch ( mut self , condition : Value , true_block : Block , false_block : Block , true_args : & [ Value ] , false_args : & [ Value ] , location : Option < Location > , ) { self . make_value ( Instruction :: ConditionalBranch ( condition , true_block , false_block , true_args . to_vec ( ) , false_args . to_vec ( ) , location , ) ) ; }
Record a conditional branch between blocks.
Record a conditional branch between blocks .
mut self
condition
Value
true_block
Block
false_block
Block
true_args
&[Value]
false_args
&[Value]
location
Option<Location>
mut self
condition
Value
true_block
Block
false_block
Block
true_args
&[Value]
false_args
&[Value]
location
Option<Location>
examples
None
use yair::*;
None
let mut context = context::new();
None
let module = context.create_module().build();
None
let u32_ty = context.get_uint_type(32);
None
let function = module.create_function(&mut context).with_name("func").with_return_type(u32_ty).with_arg("a", u32_ty).with_arg("b", u32_ty).build();
None
let block = function.create_block(&mut context).build();
None
let true_block = function.create_block(&mut context).with_arg(u32_ty).with_arg(u32_ty).build();
None
let false_block = function.create_block(&mut context).with_arg(u32_ty).with_arg(u32_ty).build();
None
let x = function.get_arg(&context, 0);
None
let y = function.get_arg(&context, 1);
None
let mut instruction_builder = block.create_instructions(&mut context);
None
let location = none;
None
let condition = instruction_builder.cmp_ge(x, y, location);
instruction_builder.conditional_branch(condition, true_block, false_block, &[ x, y ], &[ x, y ], location);
```
instruction_builder . conditional_branch ( condition true_block false_block & [ x y ] & [ x y ] location ) ; ` ` `