#include "system.h"
#include "coretypes.h"
#include "tree.h"
+#include "predict.h"
+#include "vec.h"
+#include "hashtab.h"
+#include "hash-set.h"
+#include "machmode.h"
+#include "tm.h"
+#include "hard-reg-set.h"
+#include "input.h"
+#include "function.h"
+#include "dominance.h"
+#include "cfg.h"
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
#include "tree-dfa.h"
#include "tree-pass.h"
#include "gimple-pretty-print.h"
+#include "hash-map.h"
+#include "plugin-api.h"
+#include "ipa-ref.h"
+#include "cgraph.h"
+#include "alloc-pool.h"
+#include "ipa-prop.h"
#include "ipa-inline.h"
#include "cfgloop.h"
#include "except.h"
}
}
+/* Return true if target supports alias symbols. */
+
+bool
+sem_item::target_supports_symbol_aliases_p (void)
+{
+#if !defined (ASM_OUTPUT_DEF) || (!defined(ASM_OUTPUT_WEAK_ALIAS) && !defined (ASM_WEAKEN_DECL))
+ return false;
+#else
+ return true;
+#endif
+}
+
/* Semantic function constructor that uses STACK as bitmap memory stack. */
sem_function::sem_function (bitmap_obstack *stack): sem_item (FUNC, stack),
sem_function::~sem_function ()
{
for (unsigned i = 0; i < bb_sorted.length (); i++)
- free (bb_sorted[i]);
+ delete (bb_sorted[i]);
arg_types.release ();
bb_sizes.release ();
redirect_callers
= (!original_discardable
&& alias->get_availability () > AVAIL_INTERPOSABLE
- && original->get_availability () > AVAIL_INTERPOSABLE);
+ && original->get_availability () > AVAIL_INTERPOSABLE
+ && !alias->instrumented_version);
}
else
{
redirect_callers = false;
}
- if (create_alias && DECL_COMDAT_GROUP (alias->decl))
+ if (create_alias && (DECL_COMDAT_GROUP (alias->decl)
+ || !sem_item::target_supports_symbol_aliases_p ()))
{
create_alias = false;
create_thunk = true;
local_original
= dyn_cast <cgraph_node *> (original->noninterposable_alias ());
+ if (!local_original)
+ {
+ if (dump_file)
+ fprintf (dump_file, "Noninterposable alias cannot be created.\n\n");
+
+ return false;
+ }
+
if (redirect_callers)
{
/* If alias is non-overwritable then
alias->resolve_alias (original);
/* Workaround for PR63566 that forces equal calling convention
- to be used. */
+ to be used. */
alias->local.local = false;
original->local.local = false;
sem_function::init (void)
{
if (in_lto_p)
- get_node ()->get_body ();
+ get_node ()->get_untransformed_body ();
tree fndecl = node->decl;
function *func = DECL_STRUCT_FUNCTION (fndecl);
{
gcc_assert (alias_item->type == VAR);
+ if (!sem_item::target_supports_symbol_aliases_p ())
+ {
+ if (dump_file)
+ fprintf (dump_file, "Symbol aliases are not supported by target\n\n");
+ return false;
+ }
+
sem_variable *alias_var = static_cast<sem_variable *> (alias_item);
varpool_node *original = get_node ();
alias->analyzed = false;
DECL_INITIAL (alias->decl) = NULL;
+ alias->need_bounds_init = false;
alias->remove_all_references ();
varpool_node::create_alias (alias_var->decl, decl);