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

Method resolve

cranelift/codegen/src/ir/instructions.rs:901–1016  ·  view source on GitHub ↗

Resolve this operand constraint into a concrete value type, given the value of the controlling type variable.

(&self, ctrl_type: Type)

Source from the content-addressed store, hash-verified

899 /// Resolve this operand constraint into a concrete value type, given the value of the
900 /// controlling type variable.
901 pub fn resolve(&self, ctrl_type: Type) -> ResolvedConstraint {
902 use self::OperandConstraint::*;
903 use self::ResolvedConstraint::Bound;
904 match *self {
905 Concrete(t) => Bound(t),
906 Free(vts) => ResolvedConstraint::Free(TYPE_SETS[vts as usize]),
907 Same => Bound(ctrl_type),
908 LaneOf => Bound(ctrl_type.lane_of()),
909 AsTruthy => Bound(ctrl_type.as_truthy()),
910 HalfWidth => Bound(ctrl_type.half_width().expect("invalid type for half_width")),
911 DoubleWidth => Bound(
912 ctrl_type
913 .double_width()
914 .expect("invalid type for double_width"),
915 ),
916 SplitLanes => {
917 if ctrl_type.is_dynamic_vector() {
918 Bound(
919 ctrl_type
920 .dynamic_to_vector()
921 .expect("invalid type for dynamic_to_vector")
922 .split_lanes()
923 .expect("invalid type for split_lanes")
924 .vector_to_dynamic()
925 .expect("invalid dynamic type"),
926 )
927 } else {
928 Bound(
929 ctrl_type
930 .split_lanes()
931 .expect("invalid type for split_lanes"),
932 )
933 }
934 }
935 MergeLanes => {
936 if ctrl_type.is_dynamic_vector() {
937 Bound(
938 ctrl_type
939 .dynamic_to_vector()
940 .expect("invalid type for dynamic_to_vector")
941 .merge_lanes()
942 .expect("invalid type for merge_lanes")
943 .vector_to_dynamic()
944 .expect("invalid dynamic type"),
945 )
946 } else {
947 Bound(
948 ctrl_type
949 .merge_lanes()
950 .expect("invalid type for merge_lanes"),
951 )
952 }
953 }
954 DynamicToVector => Bound(
955 ctrl_type
956 .dynamic_to_vector()
957 .expect("invalid type for dynamic_to_vector"),
958 ),

Callers 2

result_typeMethod · 0.45

Calls 14

from_rangeFunction · 0.85
is_dynamic_vectorMethod · 0.80
vector_to_dynamicMethod · 0.80
log2_lane_bitsMethod · 0.80
lane_ofMethod · 0.45
as_truthyMethod · 0.45
expectMethod · 0.45
half_widthMethod · 0.45
double_widthMethod · 0.45
split_lanesMethod · 0.45
dynamic_to_vectorMethod · 0.45
merge_lanesMethod · 0.45

Tested by

no test coverage detected