void dump_symtab_node (FILE *f, symtab_node node) { if (symtab_function_p (node)) dump_cgraph_node (f, cgraph (node)); else if (symtab_variable_p (node)) dump_varpool_node (f, varpool (node)); }
enum availability symtab_node_availability (symtab_node node) { if (is_a <cgraph_node> (node)) return cgraph_function_body_availability (cgraph (node)); else return cgraph_variable_initializer_availability (varpool (node)); }
void symtab_remove_node (symtab_node node) { if (symtab_function_p (node)) cgraph_remove_node (cgraph (node)); else if (symtab_variable_p (node)) varpool_remove_node (varpool (node)); }
static bool can_remove_node_now_p (struct cgraph_node *node, struct cgraph_edge *e) { struct cgraph_node *next; if (!can_remove_node_now_p_1 (node)) return false; /* When we see same comdat group, we need to be sure that all items can be removed. */ if (!node->symbol.same_comdat_group) return true; for (next = cgraph (node->symbol.same_comdat_group); next != node; next = cgraph (next->symbol.same_comdat_group)) if ((next->callers && next->callers != e) || !can_remove_node_now_p_1 (next)) return false; return true; }
int partition(const vector<int> &ENList, const vector<int> &surface_nids, const int& dim, int nloc, int nnodes, vector<int>& npartitions, int partition_method, vector<int> &decomp){ int num_elems = ENList.size()/nloc; set<int> surface_nodes; for(vector<int>::const_iterator it=surface_nids.begin(); it!=surface_nids.end(); ++it){ surface_nodes.insert(*it); } // Build graph map<int, set<int> > graph; switch (dim){ case 3: switch (nloc){ case 4: for(int i=0;i<num_elems;i++){ for(int j=0;j<nloc;j++){ if(surface_nodes.find(ENList[i*nloc+j])!=surface_nodes.end()) for(int k=0;k<nloc;k++){ if((j!=k)&&(surface_nodes.find(ENList[i*nloc+k])!=surface_nodes.end())) graph[ENList[i*nloc+j]].insert(ENList[i*nloc+k]); } } } break; case 8: cerr<<"ERROR: Extrude support not implemented for hex's\n"; exit(-1); default: cerr<<"ERROR: element type not recognised - dim = "<<dim<<", nloc = "<<nloc<<endl; return -1; } break; default: cerr<<"ERROR: element type not recognised - dim = "<<dim<<", nloc = "<<nloc<<endl; return -1; } int snnodes = graph.size(); vector< set<int> > cgraph(snnodes); for(map<int, set<int> >::const_iterator it=graph.begin(); it!=graph.end(); ++it) for(set<int>::const_iterator jt=it->second.begin(); jt!=it->second.end(); ++jt){ cgraph[surface_nids[it->first-1]-1].insert(surface_nids[*jt-1]); } vector<int> sdecomp(snnodes); int edgecut = hpartition(cgraph, npartitions, partition_method, sdecomp); // Map 2D decomposition onto 3D mesh. decomp.resize(nnodes); for(int i=0;i<nnodes;i++) decomp[i] = sdecomp[surface_nids[i]-1]; return edgecut; }
enum symbol_partitioning_class symtab_get_symbol_partitioning_class (symtab_node *node) { /* Inline clones are always duplicated. This include external delcarations. */ cgraph_node *cnode = dyn_cast <cgraph_node> (node); if (DECL_ABSTRACT (node->decl)) return SYMBOL_EXTERNAL; if (cnode && cnode->global.inlined_to) return SYMBOL_DUPLICATE; /* Weakref aliases are always duplicated. */ if (node->weakref) return SYMBOL_DUPLICATE; /* External declarations are external. */ if (DECL_EXTERNAL (node->decl)) return SYMBOL_EXTERNAL; if (varpool_node *vnode = dyn_cast <varpool_node> (node)) { /* Constant pool references use local symbol names that can not be promoted global. We should never put into a constant pool objects that can not be duplicated across partitions. */ if (DECL_IN_CONSTANT_POOL (node->decl)) return SYMBOL_DUPLICATE; gcc_checking_assert (vnode->definition); } /* Functions that are cloned may stay in callgraph even if they are unused. Handle them as external; compute_ltrans_boundary take care to make proper things to happen (i.e. to make them appear in the boundary but with body streamed, so clone can me materialized). */ else if (!cgraph (node)->definition) return SYMBOL_EXTERNAL; /* Linker discardable symbols are duplicated to every use unless they are keyed. Keyed symbols or those. */ if (DECL_ONE_ONLY (node->decl) && !node->force_output && !node->forced_by_abi && !symtab_used_from_object_file_p (node)) return SYMBOL_DUPLICATE; return SYMBOL_PARTITION; }
DEBUG_FUNCTION void verify_symtab_node (symtab_node node) { if (seen_error ()) return; timevar_push (TV_CGRAPH_VERIFY); if (symtab_function_p (node)) verify_cgraph_node (cgraph (node)); else if (verify_symtab_base (node)) { dump_symtab_node (stderr, node); internal_error ("verify_symtab_node failed"); } timevar_pop (TV_CGRAPH_VERIFY); }
void symtab_unregister_node (symtab_node node) { void **slot; ipa_remove_all_references (&node->symbol.ref_list); ipa_remove_all_referring (&node->symbol.ref_list); if (node->symbol.same_comdat_group) { symtab_node prev; for (prev = node->symbol.same_comdat_group; prev->symbol.same_comdat_group != node; prev = prev->symbol.same_comdat_group) ; if (node->symbol.same_comdat_group == prev) prev->symbol.same_comdat_group = NULL; else prev->symbol.same_comdat_group = node->symbol.same_comdat_group; node->symbol.same_comdat_group = NULL; } if (node->symbol.previous) node->symbol.previous->symbol.next = node->symbol.next; else symtab_nodes = node->symbol.next; if (node->symbol.next) node->symbol.next->symbol.previous = node->symbol.previous; node->symbol.next = NULL; node->symbol.previous = NULL; slot = htab_find_slot (symtab_hash, node, NO_INSERT); if (*slot == node) { symtab_node replacement_node = NULL; if (symtab_function_p (node)) replacement_node = (symtab_node)cgraph_find_replacement_node (cgraph (node)); if (!replacement_node) htab_clear_slot (symtab_hash, slot); else *slot = replacement_node; } unlink_from_assembler_name_hash (node); }
static void lto_symtab_merge_symbols_1 (symtab_node prevailing) { symtab_node e, next; /* Replace the cgraph node of each entry with the prevailing one. */ for (e = prevailing->symbol.next_sharing_asm_name; e; e = next) { next = e->symbol.next_sharing_asm_name; if (!lto_symtab_symbol_p (e)) continue; cgraph_node *ce = dyn_cast <cgraph_node> (e); if (ce && !DECL_BUILT_IN (e->symbol.decl)) lto_cgraph_replace_node (ce, cgraph (prevailing)); if (varpool_node *ve = dyn_cast <varpool_node> (e)) lto_varpool_replace_node (ve, varpool (prevailing)); } return; }
void dofile( /* plot a file */ int optc, char *optv[], char *file ) { int width = 79; int length = 21; char stmp[256]; int i; /* start fresh */ mgclearall(); /* load file */ mgload(file); /* do options */ for (i = 0; i < optc; i += 2) if (optv[i][0] == '+') { sprintf(stmp, "%s=%s", optv[i]+1, optv[i+1]); setmgvar("command line", stdin, stmp); } else switch (optv[i][1]) { case 'w': width = atoi(optv[i+1]); break; case 'l': length = atoi(optv[i+1]); break; default: fprintf(stderr, "%s: unknown option: %s\n", progname, optv[i]); quit(1); } /* graph it */ cgraph(width, length); }