summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ast/node.cpp8
-rwxr-xr-xsrc/ir_clang.cc7
-rw-r--r--src/irtools.cc1
3 files changed, 11 insertions, 5 deletions
diff --git a/src/ast/node.cpp b/src/ast/node.cpp
index dc0a913..c8a3c08 100644
--- a/src/ast/node.cpp
+++ b/src/ast/node.cpp
@@ -356,5 +356,11 @@ void chillAST_Node::gatherScalarVarDecls(vector<chillAST_VarDecl *> &decls) {
}
}
-
+chillAST_Node* chillAST_Node::findContainingStmt() {
+ chillAST_Node* p = getParent();
+ if (p->isCompoundStmt()) return this;
+ if (p->isForStmt()) return this;
+ if (p->isIfStmt()) return this;
+ return p->findContainingStmt();
+}
diff --git a/src/ir_clang.cc b/src/ir_clang.cc
index 3f70856..e667411 100755
--- a/src/ir_clang.cc
+++ b/src/ir_clang.cc
@@ -2247,10 +2247,8 @@ IR_clangCode::IR_clangCode(const char *fname, const char *proc_name) : IR_Code()
localFD->dump();
CHILL_DEBUG_END
- chillAST_Node *b = localFD->getBody(); // we do this just because it will get done next
-
CHILL_DEBUG_PRINT("calling new CG_chillBuilder() umwut?\n");
- ocg_ = new omega::CG_chillBuilder(); // ocg == omega code gen
+ ocg_ = new omega::CG_chillBuilder(localFD->getSourceFile(),localFD); // ocg == omega code gen
chillfunc = localFD;
}
@@ -2408,6 +2406,9 @@ IR_ScalarRef *IR_clangCode::CreateScalarRef(const IR_ScalarSymbol *sym) {
//return (IR_ScalarRef *)NULL;
}
+bool IR_clangCode::FromSameStmt(IR_ArrayRef *A, IR_ArrayRef *B) {
+ return ((IR_chillArrayRef*)A)->chillASE->findContainingStmt() == ((IR_chillArrayRef*)A)->chillASE->findContainingStmt();
+}
IR_ArrayRef *IR_clangCode::CreateArrayRef(const IR_ArraySymbol *sym, std::vector<omega::CG_outputRepr *> &index) {
fprintf(stderr, "IR_clangCode::CreateArrayRef() ir_clang.cc\n");
diff --git a/src/irtools.cc b/src/irtools.cc
index 68c9eac..55ef57f 100644
--- a/src/irtools.cc
+++ b/src/irtools.cc
@@ -536,7 +536,6 @@ test_data_dependences(IR_Code *ir,
//Manu:: This function tests if two references are from the same statement
-//CG_outputRepr * from_same_statement(IR_Code *ir, IR_ArrayRef *a, IR_ArrayRef *b) {
bool from_same_statement(IR_Code *ir, IR_ArrayRef *a, IR_ArrayRef *b) {
return ir->FromSameStmt(a, b);
}