~Sqlite() { while(list){ removeStatement(list); } close(); }
//! Translate generated Pragma Attributes one by one void translatePragmas (std::vector <MPI_PragmaAttribute*>& Attribute_List) { std::vector<MPI_PragmaAttribute*>::iterator iter; for (iter = Attribute_List.begin(); iter!=Attribute_List.end(); iter ++) { MPI_PragmaAttribute* cur_attr = *iter; cout<<"Translating ..." << cur_attr->toString() <<endl; SgScopeStatement* scope = cur_attr->pragma_node ->get_scope(); ROSE_ASSERT (scope != NULL); // simply obtain the default value and remove the pragma if (cur_attr-> pragma_type == pragma_mpi_device_default) { mpi_device_default_choice = cur_attr->default_semantics; // no automatic handling of attached preprocessed info. for now removeStatement(cur_attr->pragma_node, false); } // find omp target device(mpi:all) begin else if (cur_attr-> pragma_type == pragma_mpi_device_all_begin) { iter ++; // additional increment once MPI_PragmaAttribute* end_attribute = *iter; ROSE_ASSERT (end_attribute->pragma_type = pragma_mpi_device_all_end); removeStatement(cur_attr->pragma_node, false); removeStatement(end_attribute ->pragma_node, false); } else if (cur_attr-> pragma_type == pragma_mpi_device_master_begin) { // TODO refactor into a function iter ++; // additional increment once MPI_PragmaAttribute* end_attribute = *iter; ROSE_ASSERT (end_attribute->pragma_type = pragma_mpi_device_master_end); //insert a if (rank) .. after the end pragma SgIfStmt * ifstmt = buildIfStmt (buildEqualityOp(buildVarRefExp("_xomp_rank", scope), buildIntVal(0)), buildBasicBlock(), NULL); insertStatementAfter (end_attribute->pragma_node, ifstmt); SgBasicBlock * bb = isSgBasicBlock(ifstmt->get_true_body()); SgStatement* next_stmt = getNextStatement(cur_attr->pragma_node); // the next stmt is BB, skip it by starting the search from it ROSE_ASSERT (next_stmt != NULL); // normalize all declarations while ( next_stmt != end_attribute ->pragma_node) { // save current stmt before getting next one SgStatement* cur_stmt = next_stmt; next_stmt = getNextStatement (next_stmt); ROSE_ASSERT (next_stmt != NULL); if (SgVariableDeclaration* decl = isSgVariableDeclaration (cur_stmt)) splitVariableDeclaration (decl); } // move all non-declaration statements in between into the block next_stmt = getNextStatement(cur_attr->pragma_node); //reset from the beginning while ( next_stmt != end_attribute ->pragma_node) { // save current stmt before getting next one SgStatement* cur_stmt = next_stmt; next_stmt = getNextStatement (next_stmt); ROSE_ASSERT (next_stmt != NULL); if (!isSgVariableDeclaration(cur_stmt)) { // now remove the current stmt removeStatement (cur_stmt, false); appendStatement(cur_stmt, bb); } } // remove pragmas removeStatement(cur_attr->pragma_node, false); removeStatement(end_attribute ->pragma_node, false); } } // end for } // end translatePragmas ()