symbol* find_typeTable (const string* key) { auto found = typeTable.find(key); if (found == typeTable.end()){ return NULL; } else { return found->second; } }
symbol* grabStructSymbol (const string* ident) { auto table_check = typeTable.find(ident); if(table_check != typeTable.end()) { return table_check->second; } fprintf(stderr, "oc: %s struct does not exist\n", ident->c_str()); return NULL; }
void affineStatement::reset_patterns( const symbol_table& new_table ) { Datum * parent; AccessPattern * new_pat; symbol_table::const_iterator it; for ( int i = 0 ; i < Reads.size() ; i++ ) { parent = Reads[i]->get_parent(); it = new_table.find(parent->get_name()); new_pat = it->second.get_pattern(Reads[i]->get_id()); Reads[i] = new_pat; } for ( int i = 0 ; i < Writes.size() ; i++ ) { parent = Writes[i]->get_parent(); it = new_table.find(parent->get_name()); new_pat = it->second.get_pattern(Writes[i]->get_id()); Writes[i] = new_pat; } }
/** Traverse block and find name of symbol */ static string traverse_block_two(symbol_table mymap,string tname){ // find in map symbol_table::iterator got = mymap.find (&tname); // if symbool found, return symbol if ( got != mymap.end() ) { string type = *(got->first); return type; } // otherwise, keep traversing return traverse_block_two(*got->second->fields,tname); }
void Statement::set_patterns( symbol_table& data ) { SgExpression * exp = myStatement->get_expression(); IO lhsIO; vector<AccessPattern*> patList; if ( !isSgBinaryOp(exp) ) { if ( isSgUnaryOp(exp) ) search_for_access_patterns( isSgUnaryOp(exp)->get_operand(), patList, INOUT ); else report_error("Unrecognized expression statement",exp); } else { lhsIO = ( isSgAssignOp(exp) ) ? OUT : INOUT; /* Left hand side */ search_for_access_patterns( isSgBinaryOp(exp)->get_lhs_operand(), patList, lhsIO ); /* Right hand side */ search_for_access_patterns( isSgBinaryOp(exp)->get_rhs_operand(), patList, IN ); } for ( int i = 0 ; i < patList.size() ; i++ ) { int dim = patList[i]->get_dim(); SgExpression * exp = patList[i]->get_refExp(); for ( int j = 0 ; j < dim ; j++ ) exp = isSgPntrArrRefExp(exp)->get_lhs_operand(); string ap_name = isSgVarRefExp(exp)->get_symbol()->get_name().getString(); symbol_table::iterator it = data.find(ap_name); it->second.add_pattern(patList[i]); add_pattern(patList[i]); } }
symbol_data lookup_string(const char * str, std::size_t length) { static symbol_table table; return table.find(str, length); }