[llvm-branch-commits] [llvm-gcc-branch] r90900 - in /llvm-gcc-4.2/branches/Apple/Leela-M1/gcc: cgraph.c cgraph.h cgraphunit.c cp/semantics.c ipa.c llvm-convert.cpp
Bill Wendling
isanbard at gmail.com
Tue Dec 8 15:40:46 PST 2009
Author: void
Date: Tue Dec 8 17:40:46 2009
New Revision: 90900
URL: http://llvm.org/viewvc/llvm-project?rev=90900&view=rev
Log:
$ svn merge -c -72619 https://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk
--- Reverse-merging r72619 into '.':
U gcc/cgraph.c
U gcc/cgraph.h
U gcc/cgraphunit.c
U gcc/cp/semantics.c
U gcc/llvm-convert.cpp
U gcc/ipa.c
Modified:
llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cgraph.c
llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cgraph.h
llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cgraphunit.c
llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cp/semantics.c
llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/ipa.c
llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cgraph.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cgraph.c?rev=90900&r1=90899&r2=90900&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cgraph.c (original)
+++ llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cgraph.c Tue Dec 8 17:40:46 2009
@@ -601,7 +601,7 @@
if (!n->next_clone && !n->global.inlined_to
&& (cgraph_global_info_ready
/* LLVM LOCAL extern inline */
- && (TREE_ASM_WRITTEN (n->decl) || OMIT_FUNCTION_BODY (n->decl))))
+ && (TREE_ASM_WRITTEN (n->decl) || IS_EXTERN_INLINE (n->decl))))
kill_body = true;
}
@@ -1185,7 +1185,7 @@
else if (!(*targetm.binds_local_p) (node->decl)
/* LLVM LOCAL extern inline */
- && !DECL_COMDAT (node->decl) && !OMIT_FUNCTION_BODY (node->decl))
+ && !DECL_COMDAT (node->decl) && !IS_EXTERN_INLINE (node->decl))
avail = AVAIL_OVERWRITABLE;
else avail = AVAIL_AVAILABLE;
Modified: llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cgraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cgraph.h?rev=90900&r1=90899&r2=90900&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cgraph.h (original)
+++ llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cgraph.h Tue Dec 8 17:40:46 2009
@@ -335,12 +335,14 @@
bool cgraph_default_inline_p (struct cgraph_node *, const char **);
/* LLVM LOCAL begin 6501843 */
-/* Make sure bodies of "extern inline" functions are output to LLVM IR.
+/* We're no longer running gcc's inliner at all, so the bodies of
+ used extern always-inline functions must be passed down to the LLVM BE.
cgraph used to remove these. (gcc "extern inline" == c99 "inline") */
#ifdef ENABLE_LLVM
-#define OMIT_FUNCTION_BODY(f) (false)
+#define IS_EXTERN_INLINE(f) (DECL_EXTERNAL(f) && \
+ !lookup_attribute("always_inline", DECL_ATTRIBUTES(f)))
#else
-#define OMIT_FUNCTION_BODY(f) (DECL_EXTERNAL(f))
+#define IS_EXTERN_INLINE(f) (DECL_EXTERNAL(f))
#endif
/* LLVM LOCAL end */
#endif /* GCC_CGRAPH_H */
Modified: llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cgraphunit.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cgraphunit.c?rev=90900&r1=90899&r2=90900&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cgraphunit.c (original)
+++ llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cgraphunit.c Tue Dec 8 17:40:46 2009
@@ -385,7 +385,7 @@
if (!n->global.inlined_to
&& !n->alias
/* LLVM LOCAL extern inline */
- && !OMIT_FUNCTION_BODY (n->decl))
+ && !IS_EXTERN_INLINE (n->decl))
{
cgraph_expand_function (n);
output = true;
@@ -849,7 +849,7 @@
if (node->analyzed
&& DECL_SAVED_TREE (node->decl) && !TREE_ASM_WRITTEN (node->decl)
/* LLVM LOCAL extern inline */
- && (!OMIT_FUNCTION_BODY (node->decl) || node->global.inlined_to))
+ && (!IS_EXTERN_INLINE (node->decl) || node->global.inlined_to))
{
if (this_cfun->cfg)
{
@@ -942,10 +942,7 @@
if (!TREE_ASM_WRITTEN (decl)
&& !node->alias
- /* LLVM LOCAL begin extern inline */
- && (!DECL_EXTERNAL (decl) ||
- (TREE_CODE (decl) == FUNCTION_DECL && !OMIT_FUNCTION_BODY(decl)))
- /* LLVM LOCAL end extern inline */
+ && !DECL_EXTERNAL (decl)
&& (TREE_CODE (decl) != VAR_DECL || !DECL_HAS_VALUE_EXPR_P (decl)))
{
assemble_variable (decl, 0, 1, 0);
@@ -1298,7 +1295,7 @@
|| (e && node->reachable))
&& !TREE_ASM_WRITTEN (decl)
/* LLVM LOCAL extern inline */
- && !OMIT_FUNCTION_BODY (decl))
+ && !IS_EXTERN_INLINE (decl))
node->output = 1;
else
{
@@ -1306,7 +1303,7 @@
#ifdef ENABLE_CHECKING
if (!node->global.inlined_to && DECL_SAVED_TREE (decl)
/* LLVM LOCAL extern inline */
- && !OMIT_FUNCTION_BODY (decl))
+ && !IS_EXTERN_INLINE (decl))
{
dump_cgraph_node (stderr, node);
internal_error ("failed to reclaim unneeded function");
@@ -1314,7 +1311,7 @@
#endif
/* LLVM LOCAL extern inline */
gcc_assert (node->global.inlined_to || !DECL_SAVED_TREE (decl)
- || OMIT_FUNCTION_BODY (decl));
+ || IS_EXTERN_INLINE (decl));
}
}
Modified: llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cp/semantics.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cp/semantics.c?rev=90900&r1=90899&r2=90900&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cp/semantics.c (original)
+++ llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/cp/semantics.c Tue Dec 8 17:40:46 2009
@@ -3223,18 +3223,14 @@
`-fexternal-templates'; we instantiate the function, even though
we're not planning on emitting it, in case we get a chance to
inline it. */
- /* LLVM LOCAL extern inline */
- if (OMIT_FUNCTION_BODY (fn))
+ if (DECL_EXTERNAL (fn))
return;
/* ??? When is this needed? */
saved_function = current_function_decl;
/* Emit any thunks that should be emitted at the same time as FN. */
- /* LLVM LOCAL begin extern inline */
- if (!DECL_EXTERNAL (fn))
- emit_associated_thunks (fn);
- /* LLVM LOCAL end extern inline */
+ emit_associated_thunks (fn);
/* This function is only called from cgraph, or recursively from
emit_associated_thunks. In neither case should we be currently
Modified: llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/ipa.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/ipa.c?rev=90900&r1=90899&r2=90900&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/ipa.c (original)
+++ llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/ipa.c Tue Dec 8 17:40:46 2009
@@ -113,7 +113,7 @@
for (node = cgraph_nodes; node; node = node->next)
if (node->needed && !node->global.inlined_to
/* LLVM LOCAL extern inline */
- && ((!OMIT_FUNCTION_BODY (node->decl))
+ && ((!IS_EXTERN_INLINE (node->decl))
|| !node->analyzed
|| before_inlining_p))
{
@@ -137,7 +137,7 @@
&& node->analyzed
&& (!e->inline_failed || !e->callee->analyzed
/* LLVM LOCAL extern inline */
- || !OMIT_FUNCTION_BODY(e->callee->decl)
+ || !IS_EXTERN_INLINE(e->callee->decl)
|| before_inlining_p))
{
e->callee->aux = first;
@@ -169,7 +169,7 @@
if (file)
fprintf (file, " %s", cgraph_node_name (node));
/* LLVM LOCAL extern inline */
- if (!node->analyzed || !OMIT_FUNCTION_BODY(node->decl)
+ if (!node->analyzed || !IS_EXTERN_INLINE(node->decl)
|| before_inlining_p)
cgraph_remove_node (node);
else
Modified: llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/llvm-convert.cpp?rev=90900&r1=90899&r2=90900&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/llvm-convert.cpp Tue Dec 8 17:40:46 2009
@@ -495,14 +495,21 @@
// The function should not already have a body.
assert(Fn->empty() && "Function expanded multiple times!");
-
+
// Compute the linkage that the function should get.
+ // Functions declared "always inline" should not have a body
+ // emitted; hack this by pretending they're static. That will either
+ // make them go away or emit a static definition that won't collide with
+ // anything.
if (DECL_LLVM_PRIVATE(FnDecl)) {
Fn->setLinkage(Function::PrivateLinkage);
} else if (DECL_LLVM_LINKER_PRIVATE(FnDecl)) {
Fn->setLinkage(Function::LinkerPrivateLinkage);
} else if (!TREE_PUBLIC(FnDecl) /*|| lang_hooks.llvm_is_in_anon(subr)*/) {
Fn->setLinkage(Function::InternalLinkage);
+ } else if (DECL_EXTERNAL(FnDecl) &&
+ lookup_attribute ("always_inline", DECL_ATTRIBUTES (FnDecl))) {
+ Fn->setLinkage(Function::InternalLinkage);
} else if (DECL_COMDAT(FnDecl)) {
Fn->setLinkage(Function::getLinkOnceLinkage(flag_odr));
} else if (DECL_WEAK(FnDecl)) {
@@ -510,8 +517,6 @@
Fn->setLinkage(Function::WeakAnyLinkage);
} else if (DECL_ONE_ONLY(FnDecl)) {
Fn->setLinkage(Function::getWeakLinkage(flag_odr));
- } else if (DECL_EXTERNAL(FnDecl)) {
- Fn->setLinkage(Function::AvailableExternallyLinkage);
}
#ifdef TARGET_ADJUST_LLVM_LINKAGE
More information about the llvm-branch-commits
mailing list