/// <summary> /// Determines whether the <paramref name="other"/> instruction stops /// the current instruction from being inlined. /// </summary> public bool HasConflictingState(IntermediateInstruction other, StateKind kinds = StateKind.All) { for (int i = 1; i < byte.MaxValue; i <<= 1) { StateKind kind = (StateKind)i; if (!kinds.HasFlag(kind)) { continue; } bool thisRead = ReadsState.HasFlag(kind); bool thisWrite = ModifiesState.HasFlag(kind); bool otherRead = other.ReadsState.HasFlag(kind); bool otherWrite = other.ModifiesState.HasFlag(kind); bool thisAccess = thisRead || thisWrite; bool otherAccess = otherRead || otherWrite; if (!thisAccess || !otherAccess) { continue; } if (!thisWrite && !otherWrite) { continue; } Debug.Assert(thisRead && otherWrite || thisWrite && otherRead || thisWrite && otherWrite); return(true); } return(false); }