diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-06-26 18:39:06 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-06-26 18:39:06 +0000 |
commit | 21543d4cd558cada630271a0cf3075ad7ce94cbf (patch) | |
tree | 08bdb3f3e0a9d0f71e72bb56d9ddb7b916e7dfeb /gcc/gimple-fold.c | |
parent | ed0bc1ffb674fe93d0df68654b5bb76869f0bc8c (diff) | |
download | gcc-21543d4cd558cada630271a0cf3075ad7ce94cbf.tar.gz |
2013-06-26 Basile Starynkevitch <basile@starynkevitch.net>
{{merged with trunk [4.9] svn rev. 196654-200426}}
MELT branch merged with trunk rev. 200426 using svnmerge.py
[gcc/]
2013-06-26 Basile Starynkevitch <basile@starynkevitch.net>
{{merge with trunk [4.9] svn rev. 196654-200426}}
* melt-runtime.c (melt_val2passflag): TODO_ggc_collect &
TODO_do_not_ggc_collect are conditionalized.
* melt/generated/warmelt-first+03.cc: Manually remove calls to
MELT_TRACE_EXIT_LOCATION macro.
* melt/generated/warmelt-base+03.cc: Ditto.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@200430 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r-- | gcc/gimple-fold.c | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index b9211a9add2..728d3610f11 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -73,11 +73,6 @@ can_refer_decl_in_current_unit_p (tree decl, tree from_decl) if ((!TREE_STATIC (decl) && !DECL_EXTERNAL (decl)) || (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != FUNCTION_DECL)) return true; - /* Weakrefs have somewhat confusing DECL_EXTERNAL flag set; they - are always safe. */ - if (DECL_EXTERNAL (decl) - && lookup_attribute ("weakref", DECL_ATTRIBUTES (decl))) - return true; /* We are folding reference from external vtable. The vtable may reffer to a symbol keyed to other compilation unit. The other compilation unit may be in separate DSO and the symbol may be hidden. */ @@ -114,7 +109,7 @@ can_refer_decl_in_current_unit_p (tree decl, tree from_decl) The second is important when devirtualization happens during final compilation stage when making a new reference no longer makes callee to be compiled. */ - if (!node || !node->analyzed || node->global.inlined_to) + if (!node || !node->symbol.definition || node->global.inlined_to) { gcc_checking_assert (!TREE_ASM_WRITTEN (decl)); return false; @@ -123,7 +118,7 @@ can_refer_decl_in_current_unit_p (tree decl, tree from_decl) else if (TREE_CODE (decl) == VAR_DECL) { vnode = varpool_get_node (decl); - if (!vnode || !vnode->analyzed) + if (!vnode || !vnode->symbol.definition) { gcc_checking_assert (!TREE_ASM_WRITTEN (decl)); return false; @@ -178,7 +173,7 @@ canonicalize_constructor_val (tree cval, tree from_decl) /* Make sure we create a cgraph node for functions we'll reference. They can be non-existent if the reference comes from an entry of an external vtable for example. */ - cgraph_get_create_node (base); + cgraph_get_create_real_symbol_node (base); } /* Fixup types in global initializers. */ if (TREE_TYPE (TREE_TYPE (cval)) != TREE_TYPE (TREE_OPERAND (cval, 0))) @@ -197,9 +192,9 @@ canonicalize_constructor_val (tree cval, tree from_decl) tree get_symbol_constant_value (tree sym) { - if (const_value_known_p (sym)) + tree val = ctor_for_folding (sym); + if (val != error_mark_node) { - tree val = DECL_INITIAL (sym); if (val) { val = canonicalize_constructor_val (unshare_expr (val), sym); @@ -1043,7 +1038,7 @@ gimple_extract_devirt_binfo_from_cst (tree cst) HOST_WIDE_INT pos, size; tree fld; - if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (expected_type)) + if (types_same_for_odr (type, expected_type)) break; if (offset < 0) return NULL_TREE; @@ -1143,6 +1138,8 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace) gimplify_and_update_call_from_tree (gsi, result); changed = true; } + else if (DECL_BUILT_IN_CLASS (callee) == BUILT_IN_MD) + changed |= targetm.gimple_fold_builtin (gsi); } return changed; @@ -2698,19 +2695,18 @@ get_base_constructor (tree base, HOST_WIDE_INT *bit_offset, switch (TREE_CODE (base)) { case VAR_DECL: - if (!const_value_known_p (base)) - return NULL_TREE; - - /* Fallthru. */ case CONST_DECL: - if (!DECL_INITIAL (base) - && (TREE_STATIC (base) || DECL_EXTERNAL (base))) - return error_mark_node; - /* Do not return an error_mark_node DECL_INITIAL. LTO uses this - as special marker (_not_ zero ...) for its own purposes. */ - if (DECL_INITIAL (base) == error_mark_node) - return NULL_TREE; - return DECL_INITIAL (base); + { + tree init = ctor_for_folding (base); + + /* Our semantic is exact oposite of ctor_for_folding; + NULL means unknown, while error_mark_node is 0. */ + if (init == error_mark_node) + return NULL_TREE; + if (!init) + return error_mark_node; + return init; + } case ARRAY_REF: case COMPONENT_REF: |