This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
A slight cleanup of the previous patch. Tested x86_64-pc-linux-gnu, applied to trunk. 2004-05-18 Jason Merrill <jason@redhat.com> * class.c (build_base_path): Tidy a bit.
*** class.c.~1~ 2004-05-18 15:17:57.000000000 -0400 --- class.c 2004-05-18 15:23:02.000000000 -0400 *************** build_base_path (enum tree_code code, *** 255,260 **** --- 255,261 ---- int fixed_type_p; int want_pointer = TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE; bool has_empty = false; + bool virtual_access; if (expr == error_mark_node || binfo == error_mark_node || !binfo) return error_mark_node; *************** build_base_path (enum tree_code code, *** 296,316 **** offset = BINFO_OFFSET (binfo); fixed_type_p = resolves_to_fixed_type_p (expr, &nonnull); ! if (want_pointer && !nonnull ! && (!integer_zerop (offset) || (v_binfo && fixed_type_p <= 0))) null_test = error_mark_node; ! if (TREE_SIDE_EFFECTS (expr) ! && (null_test || (v_binfo && fixed_type_p <= 0))) expr = save_expr (expr); if (null_test) null_test = fold (build2 (NE_EXPR, boolean_type_node, expr, integer_zero_node)); /* If this is a simple base reference, express it as a COMPONENT_REF. */ ! if (code == PLUS_EXPR ! && (v_binfo == NULL_TREE || fixed_type_p > 0) /* We don't build base fields for empty bases, and they aren't very interesting to the optimizers anyway. */ && !has_empty) --- 297,320 ---- offset = BINFO_OFFSET (binfo); fixed_type_p = resolves_to_fixed_type_p (expr, &nonnull); ! /* Do we need to look in the vtable for the real offset? */ ! virtual_access = (v_binfo && fixed_type_p <= 0); ! ! /* Do we need to check for a null pointer? */ ! if (want_pointer && !nonnull && (virtual_access || !integer_zerop (offset))) null_test = error_mark_node; ! /* Protect against multiple evaluation if necessary. */ ! if (TREE_SIDE_EFFECTS (expr) && (null_test || virtual_access)) expr = save_expr (expr); + /* Now that we've saved expr, build the real null test. */ if (null_test) null_test = fold (build2 (NE_EXPR, boolean_type_node, expr, integer_zero_node)); /* If this is a simple base reference, express it as a COMPONENT_REF. */ ! if (code == PLUS_EXPR && !virtual_access /* We don't build base fields for empty bases, and they aren't very interesting to the optimizers anyway. */ && !has_empty) *************** build_base_path (enum tree_code code, *** 323,329 **** goto out; } ! if (v_binfo && fixed_type_p <= 0) { /* Going via virtual base V_BINFO. We need the static offset from V_BINFO to BINFO, and the dynamic offset from D_BINFO to --- 327,333 ---- goto out; } ! if (virtual_access) { /* Going via virtual base V_BINFO. We need the static offset from V_BINFO to BINFO, and the dynamic offset from D_BINFO to
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |