summaryrefslogtreecommitdiff
path: root/src/ir_chill.cc
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2016-10-11 00:34:42 -0600
committerTuowen Zhao <ztuowen@gmail.com>2016-10-11 00:34:42 -0600
commit4e22699cb200c413a46f1affc38c89559a20c9e0 (patch)
tree7c8c98ac54f17592094958e496f4e87469dca40c /src/ir_chill.cc
parente142c6b56473fac13527225701ec68d4e47b8951 (diff)
downloadchill-4e22699cb200c413a46f1affc38c89559a20c9e0.tar.gz
chill-4e22699cb200c413a46f1affc38c89559a20c9e0.tar.bz2
chill-4e22699cb200c413a46f1affc38c89559a20c9e0.zip
working if
Diffstat (limited to 'src/ir_chill.cc')
-rwxr-xr-xsrc/ir_chill.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/ir_chill.cc b/src/ir_chill.cc
index 0769385..620bfa4 100755
--- a/src/ir_chill.cc
+++ b/src/ir_chill.cc
@@ -1210,6 +1210,18 @@ void IR_clangCode::ReplaceExpression(IR_Ref *old, omega::CG_outputRepr *repr) {
// TODO
IR_CONDITION_TYPE IR_clangCode::QueryBooleanExpOperation(const omega::CG_outputRepr *repr) const {
+ CG_chillRepr *crepr = (CG_chillRepr *)repr;
+ chillAST_Node *node = crepr->chillnodes[0];
+ if (!node->isBinaryOperator())
+ return IR_COND_UNKNOWN;
+ chillAST_BinaryOperator *bin = (chillAST_BinaryOperator*)node;
+ const char * opstring = bin->getOp();
+ if (!strcmp(opstring, "==")) return IR_COND_EQ;
+ if (!strcmp(opstring, "<=")) return IR_COND_LE;
+ if (!strcmp(opstring, "<")) return IR_COND_LT;
+ if (!strcmp(opstring, ">")) return IR_COND_GT;
+ if (!strcmp(opstring, ">=")) return IR_COND_GE;
+ if (!strcmp(opstring, "!=")) return IR_COND_NE;
return IR_COND_UNKNOWN;
}
@@ -1307,12 +1319,9 @@ std::vector<omega::CG_outputRepr *> IR_clangCode::QueryExpOperand(const omega::C
char *op = bop->op; // TODO enum for operator types
if (!strcmp(op, "=")) {
v.push_back(new omega::CG_chillRepr(bop->getRHS())); // for assign, return RHS
- } else if (!strcmp(op, "+") || !strcmp(op, "-") || !strcmp(op, "*") || !strcmp(op, "/")) {
+ } else {
v.push_back(new omega::CG_chillRepr(bop->getLHS())); // for +*-/ return both lhs and rhs
v.push_back(new omega::CG_chillRepr(bop->getRHS()));
- } else {
- CHILL_ERROR("Binary Operator UNHANDLED op (%s)\n", op);
- exit(-1);
}
} // BinaryOperator
else if (e->isUnaryOperator()) {