public string GetTypeFormat() { if (MinPrecision == MinPrecision.None) { return(ComponentType.GetDescription()); } else { return(MinPrecision.GetDescription()); } }
public override string ToString() { switch (OperandType) { case OperandType.Immediate32: case OperandType.Immediate64: { string result = (OperandType == OperandType.Immediate64) ? "d(" : "l("; bool addSpaces = ParentType != OpcodeType.Mov && ParentType != OpcodeType.MovC && ParentType != OpcodeType.StoreStructured; for (int i = 0; i < NumComponents; i++) { var parentType = ParentType.GetNumberType(); result += (OperandType == OperandType.Immediate64) ? ImmediateValues.GetDouble(i).ToString() : ImmediateValues.GetNumber(i).ToString(parentType); if (i < NumComponents - 1) { result += ","; if (addSpaces) { result += " "; } } } result += ")"; return(result); } case OperandType.Null: { return(OperandType.GetDescription()); } default: { string index = string.Empty; switch (IndexDimension) { case OperandIndexDimension._0D: break; case OperandIndexDimension._1D: index = (Indices[0].Representation == OperandIndexRepresentation.Relative || Indices[0].Representation == OperandIndexRepresentation.Immediate32PlusRelative || !OperandType.RequiresRegisterNumberFor1DIndex()) ? string.Format("[{0}]", Indices[0]) : Indices[0].ToString(); break; case OperandIndexDimension._2D: index = (Indices[0].Representation == OperandIndexRepresentation.Relative || Indices[0].Representation == OperandIndexRepresentation.Immediate32PlusRelative || !OperandType.RequiresRegisterNumberFor2DIndex()) ? string.Format("[{0}][{1}]", Indices[0], Indices[1]) : string.Format("{0}[{1}]", Indices[0], Indices[1]); break; case OperandIndexDimension._3D: index = ParentType.IsDeclaration() ? string.Format("{0}[{1}:{2}]", Indices[0], Indices[1], Indices[2]) : string.Format("{0}[{1}][{2}]", Indices[0], Indices[1], Indices[2]); break; } string components = string.Empty; if (ParentType.OpcodeHasSwizzle()) { switch (SelectionMode) { case Operand4ComponentSelectionMode.Mask: components = ComponentMask.GetDescription(); break; case Operand4ComponentSelectionMode.Swizzle: components = Swizzles[0].GetDescription() + Swizzles[1].GetDescription() + Swizzles[2].GetDescription() + Swizzles[3].GetDescription(); break; case Operand4ComponentSelectionMode.Select1: components = Swizzles[0].GetDescription(); break; default: throw new InvalidOperationException("Unrecognised selection mode: " + SelectionMode); } if (!string.IsNullOrEmpty(components)) { components = "." + components; } } string minPrecision = MinPrecision == OperandMinPrecision.Default ? string.Empty : $" {MinPrecision.GetDescription()}"; return(Modifier.Wrap(string.Format("{0}{1}{2}{3}", GetOperandDescription(), index, components, minPrecision))); } } }