public void Translate(IRInstruction instr, ILTranslator tr) { tr.PushOperand(instr.Operand2); switch (instr.Operand2.Type) { case ASTType.R4: Debug.Assert(instr.Operand1.Type == ASTType.R8); tr.Instructions.Add(new ILInstruction(ILOpCode.FCONV_R32_R64)); break; case ASTType.R8: Debug.Assert(instr.Operand1.Type == ASTType.R4); tr.Instructions.Add(new ILInstruction(ILOpCode.FCONV_R64_R32)); break; default: Debug.Assert(instr.Operand2.Type == ASTType.I8); switch (instr.Operand1.Type) { case ASTType.R4: tr.Instructions.Add(new ILInstruction(ILOpCode.FCONV_R32)); break; case ASTType.R8: tr.Instructions.Add(new ILInstruction(ILOpCode.FCONV_R64)); break; default: throw new NotSupportedException(); } break; } tr.PopOperand(instr.Operand1); }
public void Translate(IRInstruction instr, ILTranslator tr) { tr.PushOperand(instr.Operand2); switch (instr.Operand1.Type) { case ASTType.I4: if (instr.Operand1 is IRVariable) { var rawType = ((IRVariable)instr.Operand1).RawType.ElementType; if (rawType == ElementType.I2) { tr.Instructions.Add(new ILInstruction(ILOpCode.SX_WORD)); } } tr.Instructions.Add(new ILInstruction(ILOpCode.SX_BYTE)); break; case ASTType.I8: tr.Instructions.Add(new ILInstruction(ILOpCode.SX_DWORD)); break; default: throw new NotSupportedException(); } tr.PopOperand(instr.Operand1); }
public void Translate(IRInstruction instr, ILTranslator tr) { tr.PushOperand(instr.Operand1); tr.PushOperand(instr.Operand2); var type = TypeInference.InferBinaryOp(instr.Operand1.Type, instr.Operand2.Type); switch (type) { case ASTType.I4: tr.Instructions.Add(new ILInstruction(ILOpCode.REM_DWORD)); break; case ASTType.I8: case ASTType.Ptr: tr.Instructions.Add(new ILInstruction(ILOpCode.REM_QWORD)); break; case ASTType.R4: tr.Instructions.Add(new ILInstruction(ILOpCode.REM_R32)); break; case ASTType.R8: tr.Instructions.Add(new ILInstruction(ILOpCode.REM_R64)); break; default: throw new NotSupportedException(); } tr.PopOperand(instr.Operand1); }
public void Translate(IRInstruction instr, ILTranslator tr) { tr.PushOperand(instr.Operand1); var rawType = ((PointerInfo)instr.Annotation).PointerType.ToTypeSig(); tr.Instructions.Add(new ILInstruction(TranslationHelpers.GetLIND(instr.Operand2.Type, rawType))); tr.PopOperand(instr.Operand2); }
public void Translate(IRInstruction instr, ILTranslator tr) { tr.PushOperand(instr.Operand2); tr.PopOperand(instr.Operand1); }
public void Translate(IRInstruction instr, ILTranslator tr) => tr.PopOperand(instr.Operand1);