Commit eb925382 authored by qinsoon's avatar qinsoon

unify emit_move_node_to_value and emit_move_value_to_value, matching

pattern  when moving floating point 0 to a register
parent 6e8dbbb9
......@@ -1031,6 +1031,16 @@ impl Value {
}
}
pub fn is_const_one(&self) -> bool {
match self.v {
Value_::Constant(Constant::Int(val)) if val == 1 => true,
Value_::Constant(Constant::IntEx(ref vec)) => {
vec[0] == 1 && vec[1..].iter().all(|x| *x == 0)
}
_ => false
}
}
/// disguises a value as another type.
/// This is usually used for treat an integer type as an integer of a different length
/// This method is unsafe
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment