pub fn select(
        &mut self,
        condition: Value,
        x: Value,
        y: Value,
        location: Option<Location>,
    ) -> Value {
        assert!(condition.get_type(self.context).is_boolean(self.context));
        assert_eq!(x.get_type(self.context), y.get_type(self.context));
        self.make_value(Instruction::Select(
            x.get_type(self.context),
            condition,
            x,
            y,
            location,
        ))
    }
/// Record a select between two values in the block.
///
/// Restrictions:
/// - The `condition` must be a boolean.
/// - `x` and `y` must have the same type, which matches the type of the newly returned value.
///
/// # 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 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);
/// let select = instruction_builder.select(condition, x, y, location);
/// ```
Record a select between two values in the block.
Restrictions:
The `condition` must be a boolean.
`x` and `y` must have the same type, which matches the type of the newly returned value.
Record a select between two values in the block . Restrictions : The ` condition ` must be a boolean . ` x ` and ` y ` must have the same type which matches the type of the newly returned value .
pub fn select(
        &mut self,
        condition: Value,
        x: Value,
        y: Value,
        location: Option<Location>,
    ) -> Value {
        assert!(condition.get_type(self.context).is_boolean(self.context));
        assert_eq!(x.get_type(self.context), y.get_type(self.context));
        self.make_value(Instruction::Select(
            x.get_type(self.context),
            condition,
            x,
            y,
            location,
        ))
    }
pub fn select ( & mut self , condition : Value , x : Value , y : Value , location : Option < Location > , ) -> Value { assert ! ( condition get_type ( self context ) is_boolean ( self context ) ) ; assert_eq ! ( x get_type ( self context ) y get_type ( self context ) ) ; self . make_value ( Instruction :: Select ( x . get_type ( self . context ) , condition , x , y , location , ) ) }
Record a select between two values in the block.
Record a select between two values in the block .
&mut self
condition
Value
x
Value
y
Value
location
Option<Location>
&mut self
condition
Value
x
Value
y
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 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);
let select = instruction_builder.select(condition, x, y, location);
```
let select = instruction_builder . select ( condition x y location ) ; ` ` `