sway-ir 0.71.0

Sway intermediate representation.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Some Fuel VM specific utilities.
use crate::{
    context::Context,
    irtype::{Type, TypeContent},
};

/// Return whether a [Type] _cannot_ fit in a Fuel VM register and requires 'demotion'.
pub(super) fn is_demotable_type(context: &Context, ty: &Type) -> bool {
    match ty.get_content(context) {
        TypeContent::Unit
        | TypeContent::Bool
        | TypeContent::TypedPointer(_)
        | TypeContent::Pointer => false,
        TypeContent::Uint(bits) => *bits > 64,
        _ => true,
    }
}