Rename the VOID type to INVALID and clean up obsolete comments.
The VOID type isn't used for anything resembling what "void" means in C, so rename it to INVALID to avoid confusion.
This commit is contained in:
@@ -157,7 +157,7 @@ pub struct Values<'a> {
|
||||
/// Check for non-values
|
||||
fn valid_valuedata(data: &ValueData) -> bool {
|
||||
if let &ValueData::Alias {
|
||||
ty: types::VOID,
|
||||
ty: types::INVALID,
|
||||
original,
|
||||
} = data
|
||||
{
|
||||
@@ -288,7 +288,7 @@ impl DataFlowGraph {
|
||||
self.value_type(dest),
|
||||
ty
|
||||
);
|
||||
debug_assert_ne!(ty, types::VOID);
|
||||
debug_assert_ne!(ty, types::INVALID);
|
||||
|
||||
self.values[dest] = ValueData::Alias { ty, original };
|
||||
}
|
||||
@@ -332,7 +332,7 @@ impl DataFlowGraph {
|
||||
self.value_type(dest),
|
||||
ty
|
||||
);
|
||||
debug_assert_ne!(ty, types::VOID);
|
||||
debug_assert_ne!(ty, types::INVALID);
|
||||
|
||||
self.values[dest] = ValueData::Alias { ty, original };
|
||||
}
|
||||
@@ -461,7 +461,7 @@ impl DataFlowGraph {
|
||||
///
|
||||
/// The result value types are determined from the instruction's value type constraints and the
|
||||
/// provided `ctrl_typevar` type for polymorphic instructions. For non-polymorphic
|
||||
/// instructions, `ctrl_typevar` is ignored, and `VOID` can be used.
|
||||
/// instructions, `ctrl_typevar` is ignored, and `INVALID` can be used.
|
||||
///
|
||||
/// The type of the first result value is also set, even if it was already set in the
|
||||
/// `InstructionData` passed to `make_inst`. If this function is called with a single-result
|
||||
@@ -679,12 +679,12 @@ impl DataFlowGraph {
|
||||
})
|
||||
}
|
||||
|
||||
/// Get the controlling type variable, or `VOID` if `inst` isn't polymorphic.
|
||||
/// Get the controlling type variable, or `INVALID` if `inst` isn't polymorphic.
|
||||
pub fn ctrl_typevar(&self, inst: Inst) -> Type {
|
||||
let constraints = self[inst].opcode().constraints();
|
||||
|
||||
if !constraints.is_polymorphic() {
|
||||
types::VOID
|
||||
types::INVALID
|
||||
} else if constraints.requires_typevar_operand() {
|
||||
// Not all instruction formats have a designated operand, but in that case
|
||||
// `requires_typevar_operand()` should never be true.
|
||||
@@ -897,7 +897,7 @@ impl<'a> fmt::Display for DisplayInst<'a> {
|
||||
}
|
||||
|
||||
let typevar = dfg.ctrl_typevar(inst);
|
||||
if typevar.is_void() {
|
||||
if typevar.is_invalid() {
|
||||
write!(f, "{}", dfg[inst].opcode())?;
|
||||
} else {
|
||||
write!(f, "{}.{}", dfg[inst].opcode(), typevar)?;
|
||||
@@ -914,7 +914,7 @@ impl DataFlowGraph {
|
||||
fn set_value_type_for_parser(&mut self, v: Value, t: Type) {
|
||||
assert_eq!(
|
||||
self.value_type(v),
|
||||
types::VOID,
|
||||
types::INVALID,
|
||||
"this function is only for assigning types to previously invalid values"
|
||||
);
|
||||
match self.values[v] {
|
||||
@@ -980,9 +980,9 @@ impl DataFlowGraph {
|
||||
let ty = if self.values.is_valid(src) {
|
||||
self.value_type(src)
|
||||
} else {
|
||||
// As a special case, if we can't resolve the aliasee yet, use VOID
|
||||
// As a special case, if we can't resolve the aliasee yet, use INVALID
|
||||
// temporarily. It will be resolved later in parsing.
|
||||
types::VOID
|
||||
types::INVALID
|
||||
};
|
||||
let data = ValueData::Alias { ty, original: src };
|
||||
self.values[dest] = data;
|
||||
@@ -1007,7 +1007,7 @@ impl DataFlowGraph {
|
||||
if let Some(resolved) = maybe_resolve_aliases(&self.values, v) {
|
||||
let old_ty = self.value_type(v);
|
||||
let new_ty = self.value_type(resolved);
|
||||
if old_ty == types::VOID {
|
||||
if old_ty == types::INVALID {
|
||||
self.set_value_type_for_parser(v, new_ty);
|
||||
} else {
|
||||
assert_eq!(old_ty, new_ty);
|
||||
@@ -1023,7 +1023,7 @@ impl DataFlowGraph {
|
||||
#[cold]
|
||||
pub fn make_invalid_value_for_parser(&mut self) {
|
||||
let data = ValueData::Alias {
|
||||
ty: types::VOID,
|
||||
ty: types::INVALID,
|
||||
original: Value::reserved_value(),
|
||||
};
|
||||
self.make_value(data);
|
||||
@@ -1037,7 +1037,7 @@ impl DataFlowGraph {
|
||||
return false;
|
||||
}
|
||||
if let ValueData::Alias { ty, .. } = self.values[v] {
|
||||
ty != types::VOID
|
||||
ty != types::INVALID
|
||||
} else {
|
||||
true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user