public int GetHashCode(SizeOfPrototype obj) { var hash = EnumerableComparer.EmptyHash; hash = EnumerableComparer.FoldIntoHashCode(hash, obj.MeasuredType.GetHashCode()); hash = EnumerableComparer.FoldIntoHashCode(hash, obj.ResultType.GetHashCode()); return(hash); }
public int GetHashCode(LoadPrototype obj) { var hash = EnumerableComparer.EmptyHash; hash = EnumerableComparer.FoldIntoHashCode(hash, obj.ResultType.GetHashCode()); hash = EnumerableComparer.FoldIntoHashCode(hash, obj.IsVolatile); hash = EnumerableComparer.FoldIntoHashCode(hash, obj.Alignment); return(hash); }
public int GetHashCode(ClrModifierType obj) { var hashCode = EnumerableComparer.EmptyHash; hashCode = EnumerableComparer.FoldIntoHashCode(hashCode, obj.ElementType); hashCode = EnumerableComparer.FoldIntoHashCode(hashCode, obj.ModifierType); hashCode = EnumerableComparer.FoldIntoHashCode(hashCode, obj.IsRequired); return(hashCode); }
/// <inheritdoc/> public override int GetHashCode() { var hashCode = EnumerableComparer.HashEnumerable(Arguments); hashCode = EnumerableComparer.FoldIntoHashCode( hashCode, Target.GetHashCode()); return(hashCode); }
public int GetHashCode(NewDelegatePrototype obj) { int hashCode = EnumerableComparer.EmptyHash; hashCode = EnumerableComparer.FoldIntoHashCode(hashCode, obj.ResultType); hashCode = EnumerableComparer.FoldIntoHashCode(hashCode, obj.Callee); hashCode = EnumerableComparer.FoldIntoHashCode(hashCode, obj.HasThisArgument); hashCode = EnumerableComparer.FoldIntoHashCode(hashCode, obj.Lookup); return(hashCode); }
/// <inheritdoc/> public override int GetHashCode() { var hashCode = EnumerableComparer.EmptyHash; hashCode = EnumerableComparer.FoldIntoHashCode(hashCode, Name); foreach (var kvPair in Annotations.OrderBy(pair => pair.Key)) { hashCode = EnumerableComparer.FoldIntoHashCode(hashCode, kvPair.Key); hashCode = EnumerableComparer.FoldIntoHashCode(hashCode, kvPair.Value); } return(hashCode); }
/// <summary> /// Computes the hash code for a particular switch flow. /// </summary> /// <param name="obj">The switch flow to compute a hash code for.</param> /// <returns>A hash code.</returns> public int GetHashCode(SwitchFlow obj) { int hashCode = EnumerableComparer.HashUnorderedSet(obj.Cases); hashCode = EnumerableComparer.FoldIntoHashCode( hashCode, obj.DefaultBranch.GetHashCode()); hashCode = EnumerableComparer.FoldIntoHashCode( hashCode, obj.SwitchValue.GetHashCode()); return(hashCode); }
/// <inheritdoc/> public override int GetHashCode() { int hashCode = EnumerableComparer.EmptyHash; int argCount = Arguments.Count; for (int i = 0; i < argCount; i++) { hashCode = EnumerableComparer.FoldIntoHashCode(hashCode, Arguments[i]); } hashCode = EnumerableComparer.FoldIntoHashCode(hashCode, Prototype); return(hashCode); }
public int GetHashCode(IndirectCallPrototype obj) { int hashCode = EnumerableComparer.EmptyHash; hashCode = EnumerableComparer.FoldIntoHashCode(hashCode, obj.ResultType); var paramTypes = obj.ParameterTypes; var paramTypeCount = paramTypes.Count; for (int i = 0; i < paramTypeCount; i++) { hashCode = EnumerableComparer.FoldIntoHashCode(hashCode, paramTypes[i]); } return(hashCode); }
public int GetHashCode(InstructionPattern obj) { int hashCode = EnumerableComparer.EmptyHash; hashCode = EnumerableComparer.FoldIntoHashCode( hashCode, obj.PrototypeKind.GetHashCode()); var numbering = new Dictionary <Symbol, int>(); foreach (var arg in obj.PrototypeArgs) { hashCode = EnumerableComparer.FoldIntoHashCode( hashCode, HashArg(arg, numbering)); } return(hashCode); }
/// <summary> /// Computes a hash code for an instruction. /// </summary> /// <param name="obj">The instruction to hash.</param> /// <returns>A hash code.</returns> public int GetHashCode(Instruction obj) { // Compute a hash code for the instruction based on its // prototype and the value numbers of its arguments. // TODO: this implementation of GetHashCode will always produce // a collision for non-copyable instructions (e.g., calls). // Is there something we can do about this? int hashCode = EnumerableComparer.EmptyHash; int argCount = obj.Arguments.Count; for (int i = 0; i < argCount; i++) { hashCode = EnumerableComparer.FoldIntoHashCode( hashCode, numbering.GetNumber(obj.Arguments[i])); } hashCode = EnumerableComparer.FoldIntoHashCode(hashCode, obj.Prototype); return(hashCode); }
/// <inheritdoc/> public override int GetHashCode() { int hashCode = EnumerableComparer.EmptyHash; hashCode = EnumerableComparer.FoldIntoHashCode( hashCode, Name.GetHashCode()); hashCode = EnumerableComparer.FoldIntoHashCode( hashCode, PropertyType.GetHashCode()); foreach (var type in IndexerParameterTypes) { hashCode = EnumerableComparer.FoldIntoHashCode( hashCode, type.GetHashCode()); } return(hashCode); }
/// <inheritdoc/> public override int GetHashCode() { int hashCode = EnumerableComparer.EmptyHash; hashCode = EnumerableComparer.FoldIntoHashCode( hashCode, Name.GetHashCode()); hashCode = EnumerableComparer.FoldIntoHashCode( hashCode, GenericParameterCount); hashCode = EnumerableComparer.FoldIntoHashCode( hashCode, ReturnType.GetHashCode()); foreach (var type in ParameterTypes) { hashCode = EnumerableComparer.FoldIntoHashCode( hashCode, type.GetHashCode()); } return(hashCode); }
private static int HashArg(LNode argument, Dictionary <Symbol, int> numbering) { if (argument.IsLiteral) { return(argument.Value.GetHashCode()); } else if (argument.IsId && argument.HasSpecialName) { return(argument.Name.GetHashCode()); } else if (argument.IsCall) { int hashCode = EnumerableComparer.EmptyHash; hashCode = EnumerableComparer.FoldIntoHashCode( hashCode, argument.Name.GetHashCode()); foreach (var arg in argument.Args) { hashCode = EnumerableComparer.FoldIntoHashCode( hashCode, HashArg(arg, numbering)); } return(hashCode); } else { int number; if (!numbering.TryGetValue(argument.Name, out number)) { number = numbering.Count; numbering[argument.Name] = number; } return(number); } }
/// <inheritdoc/> public override int GetHashCode() { int hashCode = EnumerableComparer.HashUnorderedSet(Values); return(EnumerableComparer.FoldIntoHashCode(hashCode, Branch.GetHashCode())); }