public LZextTo(LVectorRef result, LVectorRef value) { if (!result.BaseType.IsIntegral() || !value.BaseType.IsIntegral()) { throw new Exception("Only integer types are allowed for zext ... to instruction." + $"Result: {result.ParseType()}, Value: {value.ParseType()}"); } if (result.Size != value.Size) { throw new Exception("Vector size of result and value set are not equal." + $"Result: {result.Size}, Value: {value.Size}"); } Result = result; Value = value; }
public LSitofpTo(LVectorRef result, LVectorRef value) { if (!result.BaseType.IsFloatingPoint() || !value.BaseType.IsIntegral()) { throw new Exception("Result must be a floating point and value an integer type for uitofp ... to instruction." + $"Result: {result.ParseType()}, Value: {value.ParseType()}"); } if (result.Size != value.Size) { throw new Exception("Vector size of result and value set are not equal." + $"Result: {result.Size}, Value: {value.Size}"); } Result = result; Value = value; }
public LFptruncTo(LVectorRef result, LVectorRef value) { if (!result.BaseType.IsFloatingPoint() || !value.BaseType.IsFloatingPoint()) { throw new Exception("Only floating point types are allowed for fptrunc ... to instruction." + $"Result: {result.ParseType()}, Value: {value.ParseType()}"); } if (result.Size != value.Size) { throw new Exception("Vector size of result and value set are not equal." + $"Result: {result.Size}, Value: {value.Size}"); } Result = result; Value = value; }
public LAnd(LVectorRef result, LVectorRef op1, LVectorRef op2) { if (result.ParseType() != op1.ParseType() || op1.ParseType() != op2.ParseType()) { throw new Exception($"Types of operands or result are not equal. Result: {result.ParseType()}" + $", Op1: {op1.ParseType()}, Op2: {op2.ParseType()}"); } if (result.BaseType.IsFloatingPoint()) { throw new Exception("Floating point types are not allowed for and."); } Result = result; Op1 = op1; Op2 = op2; }
/// <summary> /// Returns identifier of reference. /// </summary> /// <param name="reference"></param> /// <returns>identifier</returns> public static string GetIdentifierOf(LBaseRef reference) { if (reference.IsValue()) { LValueRef value = (LValueRef)reference; return(value.Identifier !); } else if (reference.IsPointer()) { LPointerRef pointer = (LPointerRef)reference; return(pointer.Identifier); } else if (reference.IsArray()) { LArrayRef array = (LArrayRef)reference; return(array.Identifier); } else if (reference.IsVector()) { LVectorRef vector = (LVectorRef)reference; return(vector.Identifier !); } throw new Exception("unknown reference."); }