public static string Parse(this LICondition self) { return(self switch { LICondition.eq => LKeywords.Eq, LICondition.ne => LKeywords.Ne, LICondition.ugt => LKeywords.Ugt, LICondition.uge => LKeywords.Uge, LICondition.ult => LKeywords.Ult, LICondition.ule => LKeywords.Ule, LICondition.sgt => LKeywords.Sgt, LICondition.sge => LKeywords.Sge, LICondition.slt => LKeywords.Slt, LICondition.sle => LKeywords.Sle, _ => throw new NotImplementedException("Unknown condition."), });
public LIcmp(LVectorRef result, LICondition condition, 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 icmp."); } Result = result; Condition = condition; Op1 = op1; Op2 = op2; }