re PR c/10320 (gcc 3.4 gets rid of static inline function that does not get inlined)

* gcse.c (insert_store): Ignore fake edges.

	* c-common.c (flag_vtable_gc): Kill.
	* c-common.g (flag_vtable_gc): Kill.
	* c-opts (c_common_handle_option): Kill.
	* c.opt (fvtable-gc): Kill.
	* final.c (final_scan_insn): Do not call assemble_vtable_entry.
	* output.h (assemble_vtable_entry, assemble_vtable_inherit): Kill.
	* varasm.c (assemble_vtable_entry, assemble_vtable_inherit): Kill.

	* invoke.texi (-ftable-gc): Kill documentation.

	PR C/10320
	* tree-inline.c (inlinable_function_p): Don't set DECL_UNINLINABLE
	just because function body is missing.

	* i386.c (pic_symbolic_operand): Properly detect RIP relative unspecs.

	* class.c (build_vtable_entry_ref): Kill.
	(build_vtbl_ref_1): Do not call build_vtable_entry_ref.
	(build_vfn_ref): Do not call build_vtable_entry_ref.
	* cp-lang.c (LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE): Kill.
	* cp-tree.h (prepare_assemble_variable): Kill.
	* cp-decl.c (prepare_assemble_variable): Kill.

From-SVN: r69964
This commit is contained in:
Jan Hubicka 2003-07-30 19:27:17 +02:00 committed by Jan Hubicka
parent 1051c718b1
commit a0c8285b03
18 changed files with 56 additions and 271 deletions

View File

@ -1,3 +1,22 @@
Wed Jul 30 19:12:10 CEST 2003 Jan Hubicka <jh@suse.cz>
* gcse.c (insert_store): Ignore fake edges.
* c-common.c (flag_vtable_gc): Kill.
* c-common.g (flag_vtable_gc): Kill.
* c-opts (c_common_handle_option): Kill.
* c.opt (fvtable-gc): Kill.
* final.c (final_scan_insn): Do not call assemble_vtable_entry.
* output.h (assemble_vtable_entry, assemble_vtable_inherit): Kill.
* varasm.c (assemble_vtable_entry, assemble_vtable_inherit): Kill.
* invoke.texi (-ftable-gc): Kill documentation.
* tree-inline.c (inlinable_function_p): Don't set DECL_UNINLINABLE
just because function body is missing.
* i386.c (pic_symbolic_operand): Properly detect RIP relative unspecs.
2003-07-30 Ranjit Mathew <rmathew@hotmail.com>
* unwind-sjlj.c: Fix typo in file description.

View File

@ -569,10 +569,6 @@ int flag_weak = 1;
int flag_use_cxa_atexit = DEFAULT_USE_CXA_ATEXIT;
/* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc. */
int flag_vtable_gc;
/* Nonzero means make the default pedwarns warnings instead of errors.
The value of this flag is ignored if -pedantic is specified. */

View File

@ -743,10 +743,6 @@ extern int flag_weak;
extern int flag_use_cxa_atexit;
/* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc. */
extern int flag_vtable_gc;
/* Nonzero means make the default pedwarns warnings instead of errors.
The value of this flag is ignored if -pedantic is specified. */

View File

@ -675,6 +675,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
case OPT_fthis_is_variable:
case OPT_fvtable_thunks:
case OPT_fxref:
case OPT_fvtable_gc:
warning ("switch \"%s\" is no longer supported", option->opt_text);
break;
@ -896,10 +897,6 @@ c_common_handle_option (size_t scode, const char *arg, int value)
max_tinst_depth = value;
break;
case OPT_fvtable_gc:
flag_vtable_gc = value;
break;
case OPT_fuse_cxa_atexit:
flag_use_cxa_atexit = value;
break;

View File

@ -3410,7 +3410,12 @@ pic_symbolic_operand (register rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
op = XEXP (op, 0);
if (TARGET_64BIT)
{
if (GET_CODE (XEXP (op, 0)) == UNSPEC)
if (GET_CODE (op) == UNSPEC
&& XINT (op, 1) == UNSPEC_GOTPCREL)
return 1;
if (GET_CODE (op) == PLUS
&& XINT (XEXP (op, 0), 1) == UNSPEC_GOTPCREL
&& GET_CODE (XEXP (op, 0)) == UNSPEC)
return 1;
}
else

View File

@ -1,3 +1,12 @@
Wed Jul 30 19:12:48 CEST 2003 Jan Hubicka <jh@suse.cz>
* class.c (build_vtable_entry_ref): Kill.
(build_vtbl_ref_1): Do not call build_vtable_entry_ref.
(build_vfn_ref): Do not call build_vtable_entry_ref.
* cp-lang.c (LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE): Kill.
* cp-tree.h (prepare_assemble_variable): Kill.
* cp-decl.c (prepare_assemble_variable): Kill.
2003-07-29 Geoffrey Keating <geoffk@apple.com>
* parser.c (cp_lexer_new_main): Use c_common_no_more_pch instead

View File

@ -131,7 +131,6 @@ static void add_implicitly_declared_members (tree, int, int, int);
static tree fixed_type_or_null (tree, int *, int *);
static tree resolve_address_of_overloaded_function (tree, tree, int,
int, int, tree);
static tree build_vtable_entry_ref (tree, tree, tree);
static tree build_vtbl_ref_1 (tree, tree);
static tree build_vtbl_initializer (tree, tree, tree, tree, int *);
static int count_fields (tree);
@ -421,32 +420,6 @@ convert_to_base_statically (tree expr, tree base)
}
/* Virtual function things. */
static tree
build_vtable_entry_ref (tree array_ref, tree instance, tree idx)
{
tree i, i2, vtable, first_fn, basetype;
basetype = non_reference (TREE_TYPE (instance));
vtable = get_vtbl_decl_for_binfo (TYPE_BINFO (basetype));
first_fn = TYPE_BINFO_VTABLE (basetype);
i = fold (build_array_ref (first_fn, idx));
i = fold (build_c_cast (ptrdiff_type_node,
build_unary_op (ADDR_EXPR, i, 0)));
i2 = fold (build_array_ref (vtable, build_int_2 (0,0)));
i2 = fold (build_c_cast (ptrdiff_type_node,
build_unary_op (ADDR_EXPR, i2, 0)));
i = fold (cp_build_binary_op (MINUS_EXPR, i, i2));
if (TREE_CODE (i) != INTEGER_CST)
abort ();
return build (VTABLE_REF, TREE_TYPE (array_ref), array_ref, vtable, i);
}
/* Given an object INSTANCE, return an expression which yields the
vtable element corresponding to INDEX. There are many special
cases for INSTANCE which we take care of here, mainly to avoid
@ -490,9 +463,6 @@ build_vtbl_ref (tree instance, tree idx)
{
tree aref = build_vtbl_ref_1 (instance, idx);
if (flag_vtable_gc)
aref = build_vtable_entry_ref (aref, instance, idx);
return aref;
}
@ -510,9 +480,6 @@ build_vfn_ref (tree instance, tree idx)
aref = build1 (NOP_EXPR, TREE_TYPE (aref),
build_unary_op (ADDR_EXPR, aref, /*noconvert=*/1));
if (flag_vtable_gc)
aref = build_vtable_entry_ref (aref, instance, idx);
return aref;
}

View File

@ -153,9 +153,6 @@ static bool cp_var_mod_type_p (tree);
#undef LANG_HOOKS_EXPR_SIZE
#define LANG_HOOKS_EXPR_SIZE cp_expr_size
#undef LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE
#define LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE prepare_assemble_variable
#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION expand_body
#undef LANG_HOOKS_CALLGRAPH_LOWER_FUNCTION

View File

@ -3826,7 +3826,6 @@ extern tree build_artificial_parm (tree, tree);
extern tree get_guard (tree);
extern tree get_guard_cond (tree);
extern tree set_guard (tree);
extern void prepare_assemble_variable (tree);
extern void lower_function (tree);
/* XXX Not i18n clean. */

View File

@ -1626,36 +1626,6 @@ import_export_class (tree ctype)
CLASSTYPE_INTERFACE_ONLY (ctype) = (import_export < 0);
}
}
/* We need to describe to the assembler the relationship between
a vtable and the vtable of the parent class. */
void
prepare_assemble_variable (tree vars)
{
tree parent;
rtx child_rtx, parent_rtx;
if (!flag_vtable_gc || TREE_CODE (vars) != VAR_DECL
|| !DECL_VTABLE_OR_VTT_P (vars))
return;
child_rtx = XEXP (DECL_RTL (vars), 0); /* strip the mem ref */
parent = binfo_for_vtable (vars);
if (parent == TYPE_BINFO (DECL_CONTEXT (vars)))
parent_rtx = const0_rtx;
else if (parent)
{
parent = get_vtbl_decl_for_binfo (TYPE_BINFO (BINFO_TYPE (parent)));
parent_rtx = XEXP (DECL_RTL (parent), 0); /* strip the mem ref */
}
else
abort ();
assemble_vtable_inherit (child_rtx, parent_rtx);
}
/* If necessary, write out the vtables for the dynamic class CTYPE.
Returns true if any vtables were emitted. */

View File

@ -183,7 +183,7 @@ in the following sections.
-fno-nonansi-builtins -fno-operator-names @gol
-fno-optional-diags -fpermissive @gol
-frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol
-fuse-cxa-atexit -fvtable-gc -fno-weak -nostdinc++ @gol
-fuse-cxa-atexit -fno-weak -nostdinc++ @gol
-fno-default-inline -Wabi -Wctor-dtor-privacy @gol
-Wnon-virtual-dtor -Wreorder @gol
-Weffc++ -Wno-deprecated @gol
@ -1456,17 +1456,6 @@ This option is required for fully standards-compliant handling of static
destructors, but will only work if your C library supports
@code{__cxa_atexit}.
@item -fvtable-gc
@opindex fvtable-gc
Emit special relocations for vtables and virtual function references
so that the linker can identify unused virtual functions and zero out
vtable slots that refer to them. This is most useful with
@option{-ffunction-sections} and @option{-Wl,--gc-sections}, in order to
also discard the functions themselves.
This optimization requires GNU as and GNU ld. Not all systems support
this option. @option{-Wl,--gc-sections} is ignored without @option{-static}.
@item -fno-weak
@opindex fno-weak
Do not use weak symbol support, even if it is provided by the linker.

View File

@ -2486,9 +2486,6 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
/* Emit information for vtable gc. */
note = find_reg_note (insn, REG_VTABLE_REF, NULL_RTX);
if (note)
assemble_vtable_entry (XEXP (XEXP (note, 0), 0),
INTVAL (XEXP (XEXP (note, 0), 1)));
current_output_insn = debug_insn = 0;
}

View File

@ -7495,6 +7495,9 @@ insert_store (struct ls_expr * expr, edge e)
if (expr->reaching_reg == NULL_RTX)
return 0;
if (e->flags & EDGE_FAKE)
return 0;
reg = expr->reaching_reg;
insn = gen_move_insn (copy_rtx (expr->pattern), reg);
@ -7503,13 +7506,14 @@ insert_store (struct ls_expr * expr, edge e)
edges so we don't try to insert it on the other edges. */
bb = e->dest;
for (tmp = e->dest->pred; tmp ; tmp = tmp->pred_next)
{
int index = EDGE_INDEX (edge_list, tmp->src, tmp->dest);
if (index == EDGE_INDEX_NO_EDGE)
abort ();
if (! TEST_BIT (pre_insert_map[index], expr->index))
break;
}
if (!tmp->flags & EDGE_FAKE)
{
int index = EDGE_INDEX (edge_list, tmp->src, tmp->dest);
if (index == EDGE_INDEX_NO_EDGE)
abort ();
if (! TEST_BIT (pre_insert_map[index], expr->index))
break;
}
/* If tmp is NULL, we found an insertion on every edge, blank the
insertion vector for these edges, and insert at the start of the BB. */

View File

@ -508,10 +508,6 @@ extern void default_file_start (void);
extern void file_end_indicate_exec_stack (void);
extern bool default_valid_pointer_mode (enum machine_mode);
/* Emit data for vtable gc for GNU binutils. */
extern void assemble_vtable_entry (rtx, HOST_WIDE_INT);
extern void assemble_vtable_inherit (rtx, rtx);
extern int default_address_cost (rtx);
#endif /* ! GCC_OUTPUT_H */

View File

@ -1,3 +1,7 @@
Wed Jul 30 19:13:34 CEST 2003 Jan Hubicka <jh@suse.cz>
* vtgc1.c: Kill.
2003-07-29 Zack Weinberg <zack@codesourcery.com>
* gcc.dg/struct-in-proto-1.c: New test.

View File

@ -1,136 +0,0 @@
// { dg-do compile }
// { dg-options "-fvtable-gc" }
// Origin: Hans-Peter Nilsson <hp@bitrange.com>
class Base0
{
public:
Base0(); virtual ~Base0();
virtual void f1();
virtual void f2();
private:
int a_value;
};
class Base1 : public Base0
{
public:
Base1(); virtual ~Base1();
virtual void f1(), f2();
virtual void f3();
};
class Base2 : public Base1
{
public:
Base2(); virtual ~Base2();
virtual void f1(), f2();
virtual void f4();
};
class VbasedA : virtual public Base2
{
public:
VbasedA(); virtual ~VbasedA();
virtual void f1(), f2(), f3();
virtual void f6();
};
class Side0
{
public:
Side0(); virtual ~Side0();
virtual void x1();
virtual void xx();
private:
int ryan;
};
class Multisv0 : public Side0, virtual public Base2
{
public:
Multisv0(); virtual ~Multisv0();
virtual void f1(), f2();
virtual void f3();
virtual void f6();
virtual void xx();
};
class Multivs1 : public Base2, virtual public Side0
{
public:
Multivs1(); virtual ~Multivs1(); virtual void f1(); virtual void fx2();
virtual void fx4(), fx5();
virtual void f6();
virtual void xx();
};
class Multiss2 : public Base2, public Side0
{
public:
Multiss2(); virtual ~Multiss2(); virtual void f1(); virtual void fx2();
virtual void fx4();
virtual void f6();
virtual void xx();
};
class Multivv3 : virtual public Base2, virtual public Side0
{
public:
Multivv3(); virtual ~Multivv3(); virtual void f1(); virtual void fx2();
virtual void fx4(), fx5();
virtual void f6();
virtual void xx();
};
Base0::Base0() {}
Base0::~Base0() {}
Base1::Base1() {}
Base1::~Base1() {}
Base2::Base2() {}
Base2::~Base2() {}
VbasedA::VbasedA() {}
VbasedA::~VbasedA() {}
Multisv0::Multisv0() {}
Multisv0::~Multisv0() {}
Multivs1::Multivs1() {}
Multivs1::~Multivs1() {}
Multiss2::Multiss2() {}
Multiss2::~Multiss2() {}
Multivv3::Multivv3() {}
Multivv3::~Multivv3() {}
Side0::Side0() {}
Side0::~Side0() {}
extern void x (VbasedA *);
extern void x2 (Multisv0 *);
extern void x3 (Multivs1 *);
extern void x4 (Multiss2 *);
extern void x5 (Multivv3 *);
void y () { VbasedA ii; x(&ii);}
void y2 () { Multisv0 ii; x2(&ii);}
void y3 () { Multivs1 ii; x3(&ii);}
void y4 () { Multiss2 ii; x4(&ii);}
void y5 () { Multivv3 ii; x5(&ii);}
void x (VbasedA *ii) { ii->f2();}
void x2 (Multisv0 *ii) { ii->f2();}
void x3 (Multivs1 *ii) { ii->f2();}
void x4 (Multiss2 *ii) { ii->f2();}
void x5 (Multivv3 *ii) { ii->f2();}
// Use .* because of ia64's convention of marking symbols with "#", which
// makes it through the c++filt.
// { dg-final { scan-assembler-dem "\.vtable_inherit\[ \t\]*vtable for Multivv3.*0" } }
// { dg-final { scan-assembler-dem "\.vtable_inherit\[ \t\]*VTT for Multivv3.*0" } }
// { dg-final { scan-assembler-dem "\.vtable_inherit\[ \t\]*vtable for Multiss2.*vtable for Base2" } }
// { dg-final { scan-assembler-dem "\.vtable_inherit\[ \t\]*vtable for Multivs1.*vtable for Base2" } }
// { dg-final { scan-assembler-dem "\.vtable_inherit\[ \t\]*VTT for Multivs1.*vtable for Base2" } }
// { dg-final { scan-assembler-dem "\.vtable_inherit\[ \t\]*vtable for Multisv0.*vtable for Side0" } }
// { dg-final { scan-assembler-dem "\.vtable_inherit\[ \t\]*VTT for Multisv0.*vtable for Side0" } }
// { dg-final { scan-assembler-dem "\.vtable_inherit\[ \t\]*vtable for Side0.*0" } }
// { dg-final { scan-assembler-dem "\.vtable_inherit\[ \t\]*vtable for VbasedA.*0" } }
// { dg-final { scan-assembler-dem "\.vtable_inherit\[ \t\]*VTT for VbasedA.*0" } }
// { dg-final { scan-assembler-dem "\.vtable_inherit\[ \t\]*vtable for Base2.*vtable for Base1" } }
// { dg-final { scan-assembler-dem "\.vtable_inherit\[ \t\]*vtable for Base1.*vtable for Base0" } }
// { dg-final { scan-assembler-dem "\.vtable_inherit\[ \t\]*vtable for Base0.*0" } }

View File

@ -948,6 +948,11 @@ inlinable_function_p (tree fn, inline_data *id, int nolimit)
in C++ it may result in template instantiation.) */
inlinable = !(*lang_hooks.tree_inlining.cannot_inline_tree_fn) (&fn);
/* If we don't have the function body available, we can't inline
it. */
if (! DECL_SAVED_TREE (fn))
return 0;
/* We may be here either because fn is declared inline or because
we use -finline-functions. For the second case, we are more
restrictive. */
@ -1027,11 +1032,6 @@ inlinable_function_p (tree fn, inline_data *id, int nolimit)
}
}
/* If we don't have the function body available, we can't inline
it. */
if (! DECL_SAVED_TREE (fn))
inlinable = 0;
/* Check again, language hooks may have modified it. */
if (! inlinable || DECL_UNINLINABLE (fn))
return 0;

View File

@ -4657,30 +4657,6 @@ default_pe_asm_named_section (const char *name, unsigned int flags)
}
}
/* Used for vtable gc in GNU binutils. Record that the pointer at OFFSET
from SYMBOL is used in all classes derived from SYMBOL. */
void
assemble_vtable_entry (rtx symbol, HOST_WIDE_INT offset)
{
fputs ("\t.vtable_entry ", asm_out_file);
output_addr_const (asm_out_file, symbol);
fprintf (asm_out_file, ", " HOST_WIDE_INT_PRINT_DEC "\n", offset);
}
/* Used for vtable gc in GNU binutils. Record the class hierarchy by noting
that the vtable symbol CHILD is derived from the vtable symbol PARENT. */
void
assemble_vtable_inherit (rtx child, rtx parent)
{
fputs ("\t.vtable_inherit ", asm_out_file);
output_addr_const (asm_out_file, child);
fputs (", ", asm_out_file);
output_addr_const (asm_out_file, parent);
fputc ('\n', asm_out_file);
}
/* The lame default section selector. */
void