aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2001-10-11 11:48:42 -0700
committerRichard Henderson <rth@gcc.gnu.org>2001-10-11 11:48:42 -0700
commit4a8d0c9c68d8ce12453255695bfab8b2111dd772 (patch)
tree36b169e5937e71fb76f555ec055b161e29728e84 /gcc/expr.c
parent94e091c8336b9ec8ed70f5e0b9b5b31b189f10a4 (diff)
downloadgcc-4a8d0c9c68d8ce12453255695bfab8b2111dd772.zip
gcc-4a8d0c9c68d8ce12453255695bfab8b2111dd772.tar.gz
gcc-4a8d0c9c68d8ce12453255695bfab8b2111dd772.tar.bz2
rtl.h (REG_VTABLE_REF): New.
* rtl.h (REG_VTABLE_REF): New. * rtl.c (reg_note_name): Add it. * combine.c (distribute_notes): Handle it. * final.c (final_scan_insn): Handle it. * tree.def (VTABLE_REF): New. * expr.c (expand_expr): Handle it. * varasm.c (assemble_vtable_entry, assemble_vtable_inherit): New. * output.h: Declare them. cp/ * class.c (build_vtable_entry_ref): Create a VTABLE_REF instead of an asm statement. (build_vtbl_ref_1): Split out from build_vtbl_ref. (build_vfn_ref): Use it to handle vtable descriptors before calling build_vtable_entry_ref. * decl2.c (output_vtable_inherit): Use assemble_vtable_inherit. testsuite/ * g++.old-deja/g++.other/crash18.C: Add -S to options. From-SVN: r46195
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 9457e8f..1c81f73 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7211,6 +7211,43 @@ expand_expr (exp, target, tmode, modifier)
return target;
}
+ case VTABLE_REF:
+ {
+ rtx insn, before = get_last_insn (), vtbl_ref;
+
+ /* Evaluate the interior expression. */
+ subtarget = expand_expr (TREE_OPERAND (exp, 0), target,
+ tmode, modifier);
+
+ /* Get or create an instruction off which to hang a note. */
+ if (REG_P (subtarget))
+ {
+ target = subtarget;
+ insn = get_last_insn ();
+ if (insn == before)
+ abort ();
+ if (! INSN_P (insn))
+ insn = prev_nonnote_insn (insn);
+ }
+ else
+ {
+ target = gen_reg_rtx (GET_MODE (subtarget));
+ insn = emit_move_insn (target, subtarget);
+ }
+
+ /* Collect the data for the note. */
+ vtbl_ref = XEXP (DECL_RTL (TREE_OPERAND (exp, 1)), 0);
+ vtbl_ref = plus_constant (vtbl_ref,
+ tree_low_cst (TREE_OPERAND (exp, 2), 0));
+ /* Discard the initial CONST that was added. */
+ vtbl_ref = XEXP (vtbl_ref, 0);
+
+ REG_NOTES (insn)
+ = gen_rtx_EXPR_LIST (REG_VTABLE_REF, vtbl_ref, REG_NOTES (insn));
+
+ return target;
+ }
+
/* Intended for a reference to a buffer of a file-object in Pascal.
But it's not certain that a special tree code will really be
necessary for these. INDIRECT_REF might work for them. */