public string Convert(Instruction instruction, MethodTranslateContext methodContext) { Instruction to = instruction.Operand as Instruction; var op = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; return($"if(!RTCLI::Cond({op})) goto {to.GetLabel()};"); }
public string Convert(Instruction instruction, MethodTranslateContext methodContext) { var op1 = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; return($"auto {(methodContext as CXXMethodTranslateContext).CmptStackPushObject}" + $" = RTCLI::Ckfinite({op1});"); }
public string Convert(Instruction instruction, MethodTranslateContext methodContext) { var typeReference = instruction.Operand as TypeReference; TypeInformation typeInformation = methodContext.TranslateContext.MetadataContext.GetTypeInformation(typeReference); return(StelemConvert.Convert(instruction, methodContext, typeInformation.CXXTypeName)); }
public static string Convert(Instruction instruction, MethodTranslateContext methodContext, string type) { var op1 = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; var op2 = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; return($"RTCLI::Deref<{type}>({op1}) = {op2};"); }
public static string Convert(Instruction instruction, MethodTranslateContext methodContext, bool Virt) { var mtd = (instruction.Operand as MethodReference); string args = ""; for (int i = 1; i <= mtd.Parameters.Count; i++) { args += $"{(methodContext as CXXMethodTranslateContext).CmptStackPopObject}" + (i == mtd.Parameters.Count ? "" : ", "); } var methodInformation = mtd.GetMetaInformation(methodContext.MetadataContext); if (!methodInformation.IsStatic) { string caller = $"(({GetMethodOwner(mtd, methodContext)}&)" // Caster: ((DeclaringType&) + $"{(methodContext as CXXMethodTranslateContext).CmptStackPopObject})."; // Caller: caller) string callBody = $"{caller}{mtd.GetMetaInformation(methodContext.MetadataContext).CXXMethodNameShort}({args});"; // Method Call body. return((mtd.ReturnType.FullName != "System.Void" ? $"auto {(methodContext as CXXMethodTranslateContext).CmptStackPushObject} = " : "") + callBody); } if (methodInformation.IsStatic) { string callBody = $"{mtd.GetMetaInformation(methodContext.MetadataContext).CXXMethodName}({args});"; // Method Call body. return((mtd.ReturnType.FullName != "System.Void" ? $"auto {(methodContext as CXXMethodTranslateContext).CmptStackPushObject} = " : "") + callBody); } return("ERROR_METHOD_NAME"); }
public string Convert(Instruction instruction, MethodTranslateContext methodContext) { var val = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; var obj = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; return($"{obj}.{(instruction.Operand as FieldReference).Name} = {val};"); }
public string Convert(Instruction instruction, MethodTranslateContext methodContext) { var typeReference = instruction.Operand as TypeReference; TypeInformation typeInformation = methodContext.TranslateContext.MetadataContext.GetTypeInformation(typeReference); return($"RTCLI::initialize_object<{typeInformation.CXXTypeName}>({(methodContext as CXXMethodTranslateContext).CmptStackPopObject});"); }
public string Convert(Instruction instruction, MethodTranslateContext methodContext) { var type = instruction.Operand as TypeReference; TypeInformation typeInformation = methodContext.TranslateContext.MetadataContext.GetTypeInformation(type); var arg = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; return($"auto {(methodContext as CXXMethodTranslateContext).CmptStackPushObject} = RTCLI::UnBox<{typeInformation.CXXTypeName}_V>({arg});"); }
public string Convert(Instruction instruction, MethodTranslateContext methodContext) { var op2 = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; var op1 = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; Instruction to = instruction.Operand as Instruction; return($"if(RTCLI::Clt_Un({op1}, {op2})) goto {to.GetLabel()};"); }
public static string Convert(Instruction instruction, MethodTranslateContext methodContext, string type) { var op2 = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; var op1 = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; return($"auto {(methodContext as CXXMethodTranslateContext).CmptStackPushObject}" + $" = RTCLI::ArrayGet<{type}>({op1}, {op2});"); }
public string Convert(Instruction instruction, MethodTranslateContext methodContext) { var method = instruction.Operand as MethodReference; TypeInformation typeInformation = methodContext.TranslateContext.MetadataContext.GetTypeInformation(method.DeclaringType); var methodInformation = typeInformation.Methods.Find(m => m.Definition == method); return($"auto {(methodContext as CXXMethodTranslateContext).CmptStackPushObject} = &{methodInformation.CXXMethodCallName(typeInformation)};"); }
public string Convert(Instruction instruction, MethodTranslateContext methodContext) { var fld = instruction.Operand as FieldReference; TypeInformation typeInformation = methodContext.TranslateContext.MetadataContext.GetTypeInformation(fld.DeclaringType); return(typeInformation.CallStaticConstructor(methodContext) + $"{typeInformation.CXXTypeName}::{Utilities.GetCXXValidTokenString(fld.Name)} = {(methodContext as CXXMethodTranslateContext).CmptStackPopObject};"); }
public string Convert(Instruction instruction, MethodTranslateContext methodContext) { var op3 = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; var op2 = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; var op1 = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; return($"RTCLI::cpblk({op1}, {op2}, {op3});"); }
public string Convert(Instruction instruction, MethodTranslateContext methodContext) { var op2 = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; var op1 = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; return($"RTCLI::i32 {(methodContext as CXXMethodTranslateContext).CmptStackPushObject}" + $" = RTCLI::Cgt_Un({op1}, {op2});"); }
public string Convert(Instruction instruction, MethodTranslateContext methodContext) { var typeReference = instruction.Operand as TypeReference; TypeInformation typeInformation = methodContext.TranslateContext.MetadataContext.GetTypeInformation(typeReference); \ var Arg = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; return($"auto {(methodContext as CXXMethodTranslateContext).CmptStackPushObject} = \n" + $"\t\tRTCLI::Castclass<{typeInformation.CXXTypeName}>({Arg});"); }
public string Convert(Instruction instruction, MethodTranslateContext methodContext) { var typeReference = instruction.Operand as TypeReference; TypeInformation typeInformation = methodContext.TranslateContext.MetadataContext.GetTypeInformation(typeReference); var op2 = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; var op1 = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; return($"RTCLI::stobj<{typeInformation.CXXTypeName}>({op1}, {op2});"); }
public string Convert(Instruction instruction, MethodTranslateContext methodContext) { var typeReference = instruction.Operand as TypeReference; var len = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; TypeInformation typeInformation = methodContext.TranslateContext.MetadataContext.GetTypeInformation(typeReference); return($"RTCLI::System::ElementArray<{typeInformation.CXXTypeName}>& {(methodContext as CXXMethodTranslateContext).CmptStackPushObject} = \n" + $"\t\tRTCLI::new_array<{typeInformation.CXXTypeName}>({len});"); }
private string ParseParams(Instruction instruction, MethodTranslateContext methodContext) { MethodReference calledMethod = instruction.Operand as MethodReference; var typeReference = calledMethod.DeclaringType; TypeInformation typeInformation = methodContext.TranslateContext.MetadataContext.GetTypeInformation(typeReference); string paramSequenceCXX = string.Join(',', calledMethod.Parameters.Select(_ => (methodContext as CXXMethodTranslateContext).CmptStackPopObject).Reverse()); return($"{typeInformation.CXXTypeName}& {(methodContext as CXXMethodTranslateContext).CmptStackPushObject} = \n\t\tRTCLI::new_object<{typeInformation.CXXTypeName}>({paramSequenceCXX});"); }
private string ParseParams(Instruction instruction, MethodTranslateContext methodContext) { MethodReference calledMethod = instruction.Operand as MethodReference; var typeReference = calledMethod.DeclaringType; TypeInformation typeInformation = methodContext.TranslateContext.MetadataContext.GetTypeInformation(typeReference); string paramSequenceCXX = "stack"; foreach (var param in calledMethod.Parameters) { paramSequenceCXX = paramSequenceCXX + ", " + (methodContext as CXXMethodTranslateContext).CmptStackPopObject; } return($"{typeInformation.CXXTypeName}& {(methodContext as CXXMethodTranslateContext).CmptStackPushObject} = \n\t\t*RTCLI::newobj<{typeInformation.CXXTypeName}>({paramSequenceCXX});"); }
public static string Convert(MethodTranslateContext methodContext, int index) { if (!methodContext.MethodInfo.IsStatic) { index -= 1; } if (index < 0) { return($"auto& {(methodContext as CXXMethodTranslateContext).CmptStackPushObject} = *this;"); } else { return($"auto& {(methodContext as CXXMethodTranslateContext).CmptStackPushObject} = {methodContext.MethodInfo.Parameters[index].Name};"); } }
public string Convert(Instruction instruction, MethodTranslateContext methodContext) { var val = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; var obj = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; var op = instruction.Operand; if (op is PropertyReference prop) { return("RTCLI::unimplemented_il(\"stfld prop\");"); } else if (op is FieldReference fld) { return($"{obj}.{Utilities.GetCXXValidTokenString(fld.Name)} = {val};"); } return(""); }
public string Convert(Instruction instruction, MethodTranslateContext methodContext) { var obj = (methodContext as CXXMethodTranslateContext).CmptStackPopObject; var op = instruction.Operand; if (op is PropertyReference prop) { return("RTCLI::unimplemented_il(\"ldfld prop\");"); } else if (op is FieldReference fld) { var name = (methodContext as CXXMethodTranslateContext).CmptStackPushObject; return($"auto& {name} = {obj}.{Utilities.GetCXXValidTokenString(fld.Name)}{(fld.FieldType.IsValueType?"":".Get()")};"); } return(""); }
public static string Convert(Instruction instruction, MethodTranslateContext methodContext, bool Virt) { var mtd = (instruction.Operand as MethodReference); string args = ""; List <string> argList = new List <string>(); for (int i = 1; i <= mtd.Parameters.Count; i++) { argList.Add((methodContext as CXXMethodTranslateContext).CmptStackPopObject); } argList.Reverse(); args = string.Join(',', argList); if (mtd.FullName.StartsWith("!!0")) { var garg = (mtd as GenericInstanceMethod).GenericArguments[0]; var type = methodContext.MetadataContext.GetTypeInformation(garg); return($"{type.CXXTypeName}& {(methodContext as CXXMethodTranslateContext).CmptStackPushObject} = \n\t\tRTCLI::new_object<{type.CXXTypeName}>({args});"); } var methodInformation = mtd.GetMetaInformation(methodContext.MetadataContext); string genericArgs = ""; if (mtd is GenericInstanceMethod gmtd) { genericArgs = $"<{string.Join(',', gmtd.GenericArguments.Select(a => methodContext.MetadataContext.GetTypeInformation(a).CXXTypeName))}>"; } if (!methodInformation.IsStatic) { string caller = $"(({GetMethodOwner(mtd, methodContext)}&)" // Caster: ((DeclaringType&) + $"{(methodContext as CXXMethodTranslateContext).CmptStackPopObject})."; // Caller: caller) string callBody = $"{caller}" + (Virt ? "" : $"{GetMethodOwner(mtd, methodContext)}::") + $"{methodInformation.CXXMethodNameShort + genericArgs}({args});"; // Method Call body. return((mtd.ReturnType.FullName != "System.Void" ? $"auto {(methodContext as CXXMethodTranslateContext).CmptStackPushObject} = " : "") + callBody); } if (methodInformation.IsStatic) { var type = methodContext.MetadataContext.GetTypeInformation(mtd.DeclaringType); string callBody = $"{methodInformation.CXXMethodCallName(type) + genericArgs}({args});"; // Method Call body. return(type.CallStaticConstructor(methodContext) + (mtd.ReturnType.FullName != "System.Void" ? $"auto {(methodContext as CXXMethodTranslateContext).CmptStackPushObject} = " : "") + callBody); } return("ERROR_METHOD_NAME"); }
public string Convert(Instruction instruction, MethodTranslateContext methodContext) { var op = instruction.Operand; if (op is TypeDefinition typeDefinition) { return("RTCLI::unimplemented_il(\"sizeof typedef\");"); } else if (op is TypeReference typeReference) { TypeInformation typeInformation = methodContext.TranslateContext.MetadataContext.GetTypeInformation(typeReference); return($"auto {(methodContext as CXXMethodTranslateContext).CmptStackPushObject} = RTCLI_SIZEOF({typeInformation.CXXTypeName});"); } else { return(""); } }
public string Convert(Instruction instruction, MethodTranslateContext methodContext) => StelemConvert.Convert(instruction, methodContext, "RTCLI::System::Double");
public string Convert(Instruction instruction, MethodTranslateContext methodContext) => StelemConvert.Convert(instruction, methodContext, "int");
public string Convert(Instruction instruction, MethodTranslateContext methodContext) => $"auto& {(methodContext as CXXMethodTranslateContext).CmptStackPushObject} = RTCLI_ADDRESSOF(v{(instruction.Operand as VariableDefinition).Index});";
public string Convert(Instruction instruction, MethodTranslateContext methodContext) => LdlocOnvert.Convert(instruction, methodContext, (instruction.Operand as VariableDefinition).Index);
public string Convert(Instruction instruction, MethodTranslateContext methodContext) => LdlocOnvert.Convert(instruction, methodContext, 3);
public static string Convert(Instruction instruction, MethodTranslateContext methodContext, int index) { var type = methodContext.MethodInfo.LocalVariables[index].Type; return($"auto& {(methodContext as CXXMethodTranslateContext).CmptStackPushObject} = v{index}{(type.IsValueType ? "" : ".Get()")};"); }