Get the definition of a value. This is either the instruction that defined it or the Block that has the value as an parameter.
(&self, v: Value)
| 399 | /// This is either the instruction that defined it or the Block that has the value as an |
| 400 | /// parameter. |
| 401 | pub fn value_def(&self, v: Value) -> ValueDef { |
| 402 | match ValueData::from(self.values[v]) { |
| 403 | ValueData::Inst { inst, num, .. } => ValueDef::Result(inst, num as usize), |
| 404 | ValueData::Param { block, num, .. } => ValueDef::Param(block, num as usize), |
| 405 | ValueData::Alias { original, .. } => { |
| 406 | // Make sure we only recurse one level. `resolve_aliases` has safeguards to |
| 407 | // detect alias loops without overrunning the stack. |
| 408 | self.value_def(self.resolve_aliases(original)) |
| 409 | } |
| 410 | ValueData::Union { x, y, .. } => ValueDef::Union(x, y), |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | /// Determine if `v` is an attached instruction result / block parameter. |
| 415 | /// |