MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / new_singleton

Method new_singleton

cranelift/codegen/meta/src/cdsl/typevar.rs:54–87  ·  view source on GitHub ↗
(value_type: ValueType)

Source from the content-addressed store, hash-verified

52 }
53
54 pub fn new_singleton(value_type: ValueType) -> Self {
55 let (name, doc) = (value_type.to_string(), value_type.doc());
56 let mut builder = TypeSetBuilder::new();
57
58 let (scalar_type, num_lanes) = match value_type {
59 ValueType::Lane(lane_type) => (lane_type, 1),
60 ValueType::Vector(vec_type) => {
61 (vec_type.lane_type(), vec_type.lane_count() as RangeBound)
62 }
63 ValueType::DynamicVector(vec_type) => (
64 vec_type.lane_type(),
65 vec_type.minimum_lane_count() as RangeBound,
66 ),
67 };
68
69 builder = builder.simd_lanes(num_lanes..num_lanes);
70
71 // Only generate dynamic types for multiple lanes.
72 if num_lanes > 1 {
73 builder = builder.dynamic_simd_lanes(num_lanes..num_lanes);
74 }
75
76 let builder = match scalar_type {
77 LaneType::Int(int_type) => {
78 let bits = int_type as RangeBound;
79 builder.ints(bits..bits)
80 }
81 LaneType::Float(float_type) => {
82 let bits = float_type as RangeBound;
83 builder.floats(bits..bits)
84 }
85 };
86 TypeVar::new(name, doc, builder.build())
87 }
88
89 /// Get a fresh copy of self, named after `name`. Can only be called on non-derived typevars.
90 pub fn copy_from(other: &TypeVar, name: String) -> TypeVar {

Callers

nothing calls this directly

Calls 11

minimum_lane_countMethod · 0.80
simd_lanesMethod · 0.80
dynamic_simd_lanesMethod · 0.80
intsMethod · 0.80
floatsMethod · 0.80
newFunction · 0.50
to_stringMethod · 0.45
docMethod · 0.45
lane_typeMethod · 0.45
lane_countMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected