LEFT | RIGHT |
1 /* Callgraph construction. | 1 /* Callgraph construction. |
2 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 | 2 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
3 Free Software Foundation, Inc. | 3 Free Software Foundation, Inc. |
4 Contributed by Jan Hubicka | 4 Contributed by Jan Hubicka |
5 | 5 |
6 This file is part of GCC. | 6 This file is part of GCC. |
7 | 7 |
8 GCC is free software; you can redistribute it and/or modify it under | 8 GCC is free software; you can redistribute it and/or modify it under |
9 the terms of the GNU General Public License as published by the Free | 9 the terms of the GNU General Public License as published by the Free |
10 Software Foundation; either version 3, or (at your option) any later | 10 Software Foundation; either version 3, or (at your option) any later |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "tree-flow.h" | 27 #include "tree-flow.h" |
28 #include "langhooks.h" | 28 #include "langhooks.h" |
29 #include "pointer-set.h" | 29 #include "pointer-set.h" |
30 #include "cgraph.h" | 30 #include "cgraph.h" |
31 #include "intl.h" | 31 #include "intl.h" |
32 #include "gimple.h" | 32 #include "gimple.h" |
33 #include "tree-pass.h" | 33 #include "tree-pass.h" |
34 #include "ipa-utils.h" | 34 #include "ipa-utils.h" |
35 #include "except.h" | 35 #include "except.h" |
36 #include "ipa-inline.h" | 36 #include "ipa-inline.h" |
| 37 #include "target.h" |
37 | 38 |
38 /* Context of record_reference. */ | 39 /* Context of record_reference. */ |
39 struct record_reference_ctx | 40 struct record_reference_ctx |
40 { | 41 { |
41 bool only_vars; | 42 bool only_vars; |
42 struct varpool_node *varpool_node; | 43 struct varpool_node *varpool_node; |
43 }; | 44 }; |
44 | 45 |
45 /* Walk tree and record all calls and references to functions/variables. | 46 /* Walk tree and record all calls and references to functions/variables. |
46 Called via walk_tree: TP is pointer to tree to be examined. | 47 Called via walk_tree: TP is pointer to tree to be examined. |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) | 309 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) |
309 { | 310 { |
310 gimple stmt = gsi_stmt (gsi); | 311 gimple stmt = gsi_stmt (gsi); |
311 tree decl; | 312 tree decl; |
312 | 313 |
313 if (is_gimple_call (stmt)) | 314 if (is_gimple_call (stmt)) |
314 { | 315 { |
315 int freq = compute_call_stmt_bb_frequency (current_function_decl, | 316 int freq = compute_call_stmt_bb_frequency (current_function_decl, |
316 bb); | 317 bb); |
317 decl = gimple_call_fndecl (stmt); | 318 decl = gimple_call_fndecl (stmt); |
318 » /* If a call to a multiversioned function dispatcher is found, | 319 » if (decl) |
319 » » generate the body to dispatch the right function | |
320 » » at run-time. */ | |
321 » if (decl && cgraph_get_node (decl) | |
322 » » && cgraph_get_node (decl)->dispatcher_function) | |
323 { | 320 { |
324 » » tree resolver_decl; | 321 » » struct cgraph_node *callee = cgraph_get_create_node (decl); |
325 » » struct cgraph_node *curr_node = cgraph_get_node (decl); | 322 » /* If a call to a multiversioned function dispatcher is |
326 » » gcc_assert (curr_node->next_function_version); | 323 » » found, generate the body to dispatch the right function |
327 » » resolver_decl | 324 » » at run-time. */ |
328 » » = build_resolver_for_function_versions (curr_node); | 325 » » if (callee->dispatcher_function) |
329 » » gcc_assert (resolver_decl); | 326 » » { |
330 » » } | 327 » » tree resolver_decl; |
331 | 328 » » gcc_assert (callee->next_function_version); |
332 » if (decl) | 329 » » resolver_decl |
333 » » cgraph_create_edge (node, cgraph_get_create_node (decl), | 330 » » » = targetm.generate_version_dispatcher_body (callee); |
334 » » » » stmt, bb->count, freq); | 331 » » gcc_assert (resolver_decl != NULL_TREE); |
| 332 » » } |
| 333 » » cgraph_create_edge (node, callee, stmt, bb->count, freq); |
| 334 » } |
335 else | 335 else |
336 cgraph_create_indirect_edge (node, stmt, | 336 cgraph_create_indirect_edge (node, stmt, |
337 gimple_call_flags (stmt), | 337 gimple_call_flags (stmt), |
338 bb->count, freq); | 338 bb->count, freq); |
339 } | 339 } |
340 walk_stmt_load_store_addr_ops (stmt, node, mark_load, | 340 walk_stmt_load_store_addr_ops (stmt, node, mark_load, |
341 mark_store, mark_address); | 341 mark_store, mark_address); |
342 if (gimple_code (stmt) == GIMPLE_OMP_PARALLEL | 342 if (gimple_code (stmt) == GIMPLE_OMP_PARALLEL |
343 && gimple_omp_parallel_child_fn (stmt)) | 343 && gimple_omp_parallel_child_fn (stmt)) |
344 { | 344 { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 NULL, /* next */ | 533 NULL, /* next */ |
534 0, /* static_pass_number */ | 534 0, /* static_pass_number */ |
535 TV_NONE, /* tv_id */ | 535 TV_NONE, /* tv_id */ |
536 0, /* properties_required */ | 536 0, /* properties_required */ |
537 0, /* properties_provided */ | 537 0, /* properties_provided */ |
538 0, /* properties_destroyed */ | 538 0, /* properties_destroyed */ |
539 0, /* todo_flags_start */ | 539 0, /* todo_flags_start */ |
540 0, /* todo_flags_finish */ | 540 0, /* todo_flags_finish */ |
541 } | 541 } |
542 }; | 542 }; |
LEFT | RIGHT |