public IRLinearizedLocation(IRLinearizedLocation pLinearizedTarget) { Type = pLinearizedTarget.Type; switch (Type) { case IRLinearizedLocationType.Null: break; case IRLinearizedLocationType.Local: Local = pLinearizedTarget.Local; break; case IRLinearizedLocationType.LocalAddress: LocalAddress = pLinearizedTarget.LocalAddress; break; case IRLinearizedLocationType.Parameter: Parameter = pLinearizedTarget.Parameter; break; case IRLinearizedLocationType.ParameterAddress: ParameterAddress = pLinearizedTarget.ParameterAddress; break; case IRLinearizedLocationType.ConstantI4: ConstantI4 = pLinearizedTarget.ConstantI4; break; case IRLinearizedLocationType.ConstantI8: ConstantI8 = pLinearizedTarget.ConstantI8; break; case IRLinearizedLocationType.ConstantR4: ConstantR4 = pLinearizedTarget.ConstantR4; break; case IRLinearizedLocationType.ConstantR8: ConstantR8 = pLinearizedTarget.ConstantR8; break; case IRLinearizedLocationType.Field: Field = pLinearizedTarget.Field; break; case IRLinearizedLocationType.FieldAddress: FieldAddress = pLinearizedTarget.FieldAddress; break; case IRLinearizedLocationType.StaticField: StaticField = pLinearizedTarget.StaticField; break; case IRLinearizedLocationType.StaticFieldAddress: StaticFieldAddress = pLinearizedTarget.StaticFieldAddress; break; case IRLinearizedLocationType.Indirect: Indirect = pLinearizedTarget.Indirect; break; case IRLinearizedLocationType.SizeOf: SizeOf = pLinearizedTarget.SizeOf; break; case IRLinearizedLocationType.ArrayElement: ArrayElement = pLinearizedTarget.ArrayElement; break; case IRLinearizedLocationType.ArrayElementAddress: ArrayElementAddress = pLinearizedTarget.ArrayElementAddress; break; case IRLinearizedLocationType.ArrayLength: ArrayLength = pLinearizedTarget.ArrayLength; break; case IRLinearizedLocationType.FunctionAddress: FunctionAddress = pLinearizedTarget.FunctionAddress; break; case IRLinearizedLocationType.RuntimeHandle: RuntimeHandle = pLinearizedTarget.RuntimeHandle; break; case IRLinearizedLocationType.String: String = pLinearizedTarget.String; break; default: throw new ArgumentException("Type"); } }
public IRLinearizedLocation(IRInstruction pParentInstruction, IRLinearizedLocation pLinearizedTarget) { mTempID = sTempID++; ParentInstruction = pParentInstruction; Type = pLinearizedTarget.Type; switch (Type) { case IRLinearizedLocationType.Null: break; case IRLinearizedLocationType.Local: Local = pLinearizedTarget.Local; break; case IRLinearizedLocationType.LocalAddress: LocalAddress = pLinearizedTarget.LocalAddress; break; case IRLinearizedLocationType.Parameter: Parameter = pLinearizedTarget.Parameter; break; case IRLinearizedLocationType.ParameterAddress: ParameterAddress = pLinearizedTarget.ParameterAddress; break; case IRLinearizedLocationType.ConstantI4: ConstantI4 = pLinearizedTarget.ConstantI4; break; case IRLinearizedLocationType.ConstantI8: ConstantI8 = pLinearizedTarget.ConstantI8; break; case IRLinearizedLocationType.ConstantR4: ConstantR4 = pLinearizedTarget.ConstantR4; break; case IRLinearizedLocationType.ConstantR8: ConstantR8 = pLinearizedTarget.ConstantR8; break; case IRLinearizedLocationType.Field: Field = pLinearizedTarget.Field; Field.FieldLocation = pLinearizedTarget.Field.FieldLocation.Clone(pParentInstruction); break; case IRLinearizedLocationType.FieldAddress: FieldAddress = pLinearizedTarget.FieldAddress; FieldAddress.FieldLocation = pLinearizedTarget.FieldAddress.FieldLocation.Clone(pParentInstruction); break; case IRLinearizedLocationType.StaticField: StaticField = pLinearizedTarget.StaticField; break; case IRLinearizedLocationType.StaticFieldAddress: StaticFieldAddress = pLinearizedTarget.StaticFieldAddress; break; case IRLinearizedLocationType.Indirect: Indirect = pLinearizedTarget.Indirect; Indirect.AddressLocation = pLinearizedTarget.Indirect.AddressLocation.Clone(pParentInstruction); break; case IRLinearizedLocationType.SizeOf: SizeOf = pLinearizedTarget.SizeOf; break; case IRLinearizedLocationType.ArrayElement: ArrayElement = pLinearizedTarget.ArrayElement; ArrayElement.ArrayLocation = pLinearizedTarget.ArrayElement.ArrayLocation.Clone(pParentInstruction); ArrayElement.IndexLocation = pLinearizedTarget.ArrayElement.IndexLocation.Clone(pParentInstruction); break; case IRLinearizedLocationType.ArrayElementAddress: ArrayElementAddress = pLinearizedTarget.ArrayElementAddress; ArrayElementAddress.ArrayLocation = pLinearizedTarget.ArrayElementAddress.ArrayLocation.Clone(pParentInstruction); ArrayElementAddress.IndexLocation = pLinearizedTarget.ArrayElementAddress.IndexLocation.Clone(pParentInstruction); break; case IRLinearizedLocationType.ArrayLength: ArrayLength = pLinearizedTarget.ArrayLength; ArrayLength.ArrayLocation = pLinearizedTarget.ArrayLength.ArrayLocation.Clone(pParentInstruction); break; case IRLinearizedLocationType.FunctionAddress: FunctionAddress = pLinearizedTarget.FunctionAddress; if (FunctionAddress.InstanceLocation != null) FunctionAddress.InstanceLocation = pLinearizedTarget.FunctionAddress.InstanceLocation.Clone(pParentInstruction); break; case IRLinearizedLocationType.RuntimeHandle: RuntimeHandle = pLinearizedTarget.RuntimeHandle; break; case IRLinearizedLocationType.String: String = pLinearizedTarget.String; break; case IRLinearizedLocationType.Phi: Phi = pLinearizedTarget.Phi; Phi.SourceLocations = new List<IRLinearizedLocation>(pLinearizedTarget.Phi.SourceLocations.Count); pLinearizedTarget.Phi.SourceLocations.ForEach(l => Phi.SourceLocations.Add(l.Clone(pParentInstruction))); break; default: throw new ArgumentException("Type"); } }