/// <summary> /// Returns a <see cref="System.String" /> that represents this instance. /// </summary> /// <param name="node">The context.</param> /// <returns> /// A <see cref="System.String" /> that represents this instance. /// </returns> public string ToString(InstructionNode node) { var sb = new StringBuilder(); sb.AppendFormat("L_{0:X4}", node.Label); if (node.Marked) sb.Append('*'); else sb.Append(' '); sb.Append(ToString()); var size = GetSizeString(node.Size); if (size != string.Empty) sb.Append("/" + size); if (node.ConditionCode != ConditionCode.Undefined) { sb.Append(" ["); sb.Append(GetConditionString(node.ConditionCode)); sb.Append("]"); } if (node.MosaType != null) { sb.Append(" [["); sb.Append(node.MosaType.FullName); sb.Append("]]"); } if (node.MosaField != null) { sb.Append(" [["); sb.Append(node.MosaField.FullName); sb.Append("]]"); } string mod = GetModifier(node); if (mod != null) { sb.Append(" ["); sb.Append(mod); sb.Append("]"); } for (int i = 0; i < node.ResultCount; i++) { var op = node.GetResult(i); sb.Append(" "); sb.Append(op == null ? "[NULL]" : op.ToString()); sb.Append(","); } if (node.ResultCount > 0) { sb.Length = sb.Length - 1; } if (node.ResultCount > 0 && node.OperandCount > 0) { sb.Append(" <="); } for (int i = 0; i < node.OperandCount; i++) { var op = node.GetOperand(i); sb.Append(" "); sb.Append(op == null ? "[NULL]" : op.ToString()); sb.Append(","); } if (node.OperandCount > 0) { sb.Length = sb.Length - 1; } if (node.BranchTargets != null) { sb.Append(' '); for (int i = 0; (i < 2) && (i < node.BranchTargetsCount); i++) { if (i != 0) { sb.Append(", "); } sb.Append(node.BranchTargets[i].ToString()); } if (node.BranchTargetsCount > 2) { sb.Append(", [more]"); } } if (node.InvokeMethod != null) { sb.Append(" {"); sb.Append(node.InvokeMethod.FullName); sb.Append("}"); } if (node.MosaField != null) { sb.Append(" {"); sb.Append(node.MosaField.FullName); sb.Append("}"); } return sb.ToString(); }
/// <summary> /// Returns a <see cref="System.String" /> that represents this instance. /// </summary> /// <param name="node">The context.</param> /// <returns> /// A <see cref="System.String" /> that represents this instance. /// </returns> public string ToString(InstructionNode node) { var sb = new StringBuilder(); sb.AppendFormat("L_{0:X4}", node.Label); if (node.Marked) { sb.Append('*'); } else { sb.Append(' '); } sb.Append(ToString()); var size = GetSizeString(node.Size); if (size != string.Empty) { sb.Append("/" + size); } if (node.ConditionCode != ConditionCode.Undefined) { sb.Append(" ["); sb.Append(GetConditionString(node.ConditionCode)); sb.Append("]"); } if (node.MosaType != null) { sb.Append(" [["); sb.Append(node.MosaType.FullName); sb.Append("]]"); } if (node.MosaField != null) { sb.Append(" [["); sb.Append(node.MosaField.FullName); sb.Append("]]"); } string mod = GetModifier(node); if (mod != null) { sb.Append(" ["); sb.Append(mod); sb.Append("]"); } for (int i = 0; i < node.ResultCount; i++) { var op = node.GetResult(i); sb.Append(" "); sb.Append(op == null ? "[NULL]" : op.ToString()); sb.Append(","); } if (node.ResultCount > 0) { sb.Length = sb.Length - 1; } if (node.ResultCount > 0 && node.OperandCount > 0) { sb.Append(" <="); } for (int i = 0; i < node.OperandCount; i++) { var op = node.GetOperand(i); sb.Append(" "); sb.Append(op == null ? "[NULL]" : op.ToString()); sb.Append(","); } if (node.OperandCount > 0) { sb.Length = sb.Length - 1; } if (node.BranchTargets != null) { sb.Append(' '); for (int i = 0; (i < 2) && (i < node.BranchTargetsCount); i++) { if (i != 0) { sb.Append(", "); } sb.Append(node.BranchTargets[i].ToString()); } if (node.BranchTargetsCount > 2) { sb.Append(", [more]"); } } if (node.InvokeMethod != null) { sb.Append(" {"); sb.Append(node.InvokeMethod.FullName); sb.Append("}"); } if (node.MosaField != null) { sb.Append(" {"); sb.Append(node.MosaField.FullName); sb.Append("}"); } return(sb.ToString()); }