summaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-17 19:43:40 +0000
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-17 19:43:40 +0000
commit6378ffb3e243f7ec668341240c3771873da4b8d2 (patch)
treed4ffa63f0aba29db3e92721d1dacf6c42dba6490 /gcc/tree.c
parentb823b0c64afba9f22c659014d67843f440f886db (diff)
downloadgcc-6378ffb3e243f7ec668341240c3771873da4b8d2.tar.gz
2010-05-17 Martin Jambor <mjambor@suse.cz>
* cgraph.h (cgraph_indirect_call_info): New fields anc_offset, otr_token and polymorphic. * cgraph.c (cgraph_create_indirect_edge): Inilialize the above fields. (cgraph_clone_edge): Copy the above fields. * tree.c (get_binfo_at_offset): New function. * tree.h (get_binfo_at_offset): Declare. * ipa-prop.h (enum jump_func_type): Added known_type jump function type, reordered items, updated comments. (union jump_func_value): Added base_type field, reordered fields. (enum ipa_lattice_type): Moved down in the file. (struct ipa_param_descriptor): New field polymorphic. (ipa_is_param_polymorphic): New function. * ipa-prop.c: Include gimple.h and gimple-fold.h. (ipa_print_node_jump_functions): Print known type jump functions. (compute_complex_pass_through): Renamed to... (compute_complex_assign_jump_func): this. (compute_complex_ancestor_jump_func): New function. (compute_known_type_jump_func): Likewise. (compute_scalar_jump_functions): Create known type and complex ancestor jump functions. (ipa_note_param_call): New parameter polymorphic, set the corresponding flag in the call note accordingly. (ipa_analyze_call_uses): Renamed to... (ipa_analyze_indirect_call_uses): this. New parameter target, define variable var only in the block where it is used. (ipa_analyze_virtual_call_uses): New function. (ipa_analyze_call_uses): Likewise. (combine_known_type_and_ancestor_jfs): Likewise. (update_jump_functions_after_inlining): Implemented handling of a number of new jump function types combination. (print_edge_addition_message): Removed. (make_edge_direct_to_target): New function. (try_make_edge_direct_simple_call): Likewise. (try_make_edge_direct_virtual_call): Likewise. (update_call_notes_after_inlining): Renamed to... (update_indirect_edges_after_inlining): this. Moved edge creation for indirect calls to try_make_edge_direct_simple_call, also calls try_make_edge_direct_virtual_call for virtual calls. (ipa_print_node_params): Changed the header message. (ipa_write_jump_function): Stream also known type jump functions. (ipa_read_jump_function): Likewise. (ipa_write_indirect_edge_info): Stream new fields in cgraph_indirect_call_info. (ipa_read_indirect_edge_info): Likewise. * Makefile.in (ipa-prop.o): Add dependency to GIMPLE_H and GIMPLE_FOLD_H. * testsuite/g++.dg/ipa/ivinline-1.C: New test. * testsuite/g++.dg/ipa/ivinline-2.C: New test. * testsuite/g++.dg/ipa/ivinline-3.C: New test. * testsuite/g++.dg/ipa/ivinline-4.C: New test. * testsuite/g++.dg/ipa/ivinline-5.C: New test. * testsuite/g++.dg/ipa/ivinline-6.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159507 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 8c0ed4e0e15..f00f82e9995 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -10779,4 +10779,60 @@ lhd_gcc_personality (void)
return gcc_eh_personality_decl;
}
+/* Try to find a base info of BINFO that would have its field decl at offset
+ OFFSET within the BINFO type and which is of EXPECTED_TYPE. If it can be
+ found, return, otherwise return NULL_TREE. */
+
+tree
+get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type)
+{
+ tree type;
+
+ if (offset == 0)
+ return binfo;
+
+ type = TREE_TYPE (binfo);
+ while (offset > 0)
+ {
+ tree base_binfo, found_binfo;
+ HOST_WIDE_INT pos, size;
+ tree fld;
+ int i;
+
+ if (TREE_CODE (type) != RECORD_TYPE)
+ return NULL_TREE;
+
+ for (fld = TYPE_FIELDS (type); fld; fld = TREE_CHAIN (fld))
+ {
+ if (TREE_CODE (fld) != FIELD_DECL)
+ continue;
+
+ pos = int_bit_position (fld);
+ size = tree_low_cst (DECL_SIZE (fld), 1);
+ if (pos <= offset && (pos + size) > offset)
+ break;
+ }
+ if (!fld)
+ return NULL_TREE;
+
+ found_binfo = NULL_TREE;
+ for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
+ if (TREE_TYPE (base_binfo) == TREE_TYPE (fld))
+ {
+ found_binfo = base_binfo;
+ break;
+ }
+
+ if (!found_binfo)
+ return NULL_TREE;
+
+ type = TREE_TYPE (fld);
+ binfo = found_binfo;
+ offset -= pos;
+ }
+ if (type != expected_type)
+ return NULL_TREE;
+ return binfo;
+}
+
#include "gt-tree.h"