Value* LessThanEqualExpression::getValue() { assert(leftExpression != NULL); assert(rightExpression != NULL); assert(leftExpression->getType() == rightExpression->getType()); IRBuilder<>* builder = codegen::getBuilder(); int c; if(leftExpression->getType() != COLEXPRESSION) { c = leftExpression->getType(); } else { c = convertDTtoET(leftExpression->getDataType()); } switch(c) { case LONGVALUEEXPRESSION: return builder->CreateICmpSLE(leftExpression->getValue(), rightExpression->getValue()); case DOUBLEVALUEEXPRESSION: return builder->CreateFCmpOLE(leftExpression->getValue(), rightExpression->getValue()); case STRINGVALUEEXPRESSION: case DATEVALUEEXPRESSION: return codegen::stringCmp(leftExpression->getValue(), rightExpression->getValue(), LESSTHANEQUALEXPRESSION); default: cout << "Unknown expression type!" << endl; exit(-1); } return NULL; }
static Value* emitCond(IRBuilder<>& builder, Value* arg) { return builder.CreateICmpSLE(arg, builder.getInt64(0)); }