/// <summary> /// </summary> /// <param name="methodInfo"> /// </param> /// <param name="writer"> /// </param> public static void WriteFunctionCallAttributes(this IMethod methodInfo, LlvmIndentedTextWriter writer) { if (methodInfo.DllImportData != null && methodInfo.DllImportData.CallingConvention == CallingConvention.StdCall) { writer.Write("x86_stdcallcc "); } }
/// <summary> /// </summary> /// <param name="writer"> /// </param> /// <param name="tryClause"> /// </param> public static void WriteFunctionCall(this LlvmIndentedTextWriter writer, TryClause tryClause) { if (tryClause != null) { writer.Write("invoke "); } else { writer.Write("call "); } }
/// <summary> /// </summary> /// <param name="type"> /// </param> /// <param name="writer"> /// </param> /// <param name="isPointer"> /// </param> public static void WriteTypeName(this IType type, LlvmIndentedTextWriter writer, bool isPointer) { var typeBaseName = type.TypeToCType(isPointer); // clean name if (typeBaseName.EndsWith("&")) { typeBaseName = typeBaseName.Substring(0, typeBaseName.Length - 1); } writer.Write(typeBaseName); }
/// <summary> /// </summary> /// <param name="type"> /// </param> /// <param name="writer"> /// </param> public static void WriteTypeWithoutModifiers(this IType type, LlvmIndentedTextWriter writer, bool isPointer = false) { var effectiveType = type; if (effectiveType.IsPointer) { effectiveType.GetElementType().WriteTypeWithoutModifiers(writer, type.IsPointer); return; } if (!type.IsArray) { if (type.UseAsClass || !effectiveType.IsPrimitiveType() && !effectiveType.IsVoid() && !effectiveType.IsEnum) { writer.Write('%'); } // write base name effectiveType.WriteTypeName(writer, isPointer); } else if (!type.IsMultiArray) { writer.Write("{1} {2}, [ {0} x ", 0, "{", ArraySingleDimensionGen.GetArrayPrefixDataType()); effectiveType = type; if (effectiveType.IsByRef) { effectiveType = effectiveType.GetElementType(); } effectiveType.GetElementType().WriteTypePrefix(writer); writer.Write(" ] }"); } else { type.BaseType.WriteTypeWithoutModifiers(writer); } }
/// <summary> /// </summary> /// <param name="writer"> /// </param> public abstract void WriteTo(LlvmIndentedTextWriter writer);
/// <summary> /// </summary> /// <param name="writer"> /// </param> public override void WriteTo(LlvmIndentedTextWriter writer) { }
/// <summary> /// </summary> /// <param name="writer"> /// </param> public abstract void WriteTo(LlvmIndentedTextWriter writer);
/// <summary> /// </summary> /// <param name="type"> /// </param> /// <param name="writer"> /// </param> /// <param name="asReference"> /// </param> public static void WriteTypePrefix(this IType type, LlvmIndentedTextWriter writer, bool asReference = false) { type.WriteTypeWithoutModifiers(writer); type.WriteTypeModifiers(writer, asReference); }
/// <summary> /// </summary> /// <param name="writer"> /// </param> public override void WriteTo(LlvmIndentedTextWriter writer) { base.WriteTo(writer); }
/// <summary> /// </summary> /// <param name="methodInfo"> /// </param> /// <param name="writer"> /// </param> public static void WriteFunctionCallAttributes(this IMethod methodInfo, LlvmIndentedTextWriter writer) { if (methodInfo.DllImportData != null && methodInfo.DllImportData.CallingConvention == CallingConvention.StdCall) { writer.Write("x86_stdcallcc "); } }
/// <summary> /// </summary> /// <param name="type"> /// </param> /// <param name="writer"> /// </param> public static void WriteTypeWithoutModifiers(this IType type, LlvmIndentedTextWriter writer, bool isPointer = false) { var effectiveType = type; if (effectiveType.IsPointer) { effectiveType.GetElementType().WriteTypeWithoutModifiers(writer, type.IsPointer); return; } if (!type.IsArray) { if (type.UseAsClass || !effectiveType.IsPrimitiveType() && !effectiveType.IsVoid() && !effectiveType.IsEnum) { writer.Write('%'); } // write base name effectiveType.WriteTypeName(writer, isPointer); } else if (!type.IsMultiArray) { writer.Write("{1} {2}, [ {0} x ", 0, "{", ArraySingleDimensionGen.GetArrayPrefixDataType()); effectiveType = type; if (effectiveType.IsByRef) { effectiveType = effectiveType.GetElementType(); } effectiveType.GetElementType().WriteTypePrefix(writer); writer.Write(" ] }"); } else { type.BaseType.WriteTypeWithoutModifiers(writer); } }
/// <summary> /// </summary> /// <param name="type"> /// </param> /// <param name="writer"> /// </param> /// <param name="asReference"> /// </param> public static void WriteTypePrefix(this IType type, LlvmIndentedTextWriter writer, bool asReference = false) { type.WriteTypeWithoutModifiers(writer); type.WriteTypeModifiers(writer, asReference); }
/// <summary> /// </summary> /// <param name="type"> /// </param> /// <param name="writer"> /// </param> /// <param name="isPointer"> /// </param> public static void WriteTypeName(this IType type, LlvmIndentedTextWriter writer, bool isPointer) { var typeBaseName = type.TypeToCType(isPointer); // clean name if (typeBaseName.EndsWith("&")) { typeBaseName = typeBaseName.Substring(0, typeBaseName.Length - 1); } writer.Write(typeBaseName); }