summaryrefslogtreecommitdiffstats
path: root/gcc/cp/optimize.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-06 03:12:19 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-06 03:12:19 +0000
commita35958af62936d71e63fb5fd9112317594ce7043 (patch)
tree40b36e31ab940371efa53fd3d29c1160f917bf91 /gcc/cp/optimize.c
parentedfc4618be346be4f293a55266f695de3e1e1c34 (diff)
downloadppe42-gcc-a35958af62936d71e63fb5fd9112317594ce7043.tar.gz
ppe42-gcc-a35958af62936d71e63fb5fd9112317594ce7043.zip
* cp-tree.h (instantiate_decl): Change prototype.
* decl2.c (mark_used): Adjust call. * optimize.c (inlinable_function_p): Adjust handling of templates. * pt.c (do_decl_instantiation): Adjust call to instantiate_decl. (do_type_instantiation): Likewise. (instantiate_decl): Defer more templates. (instantiate_pending_templates): Adjust logic to handle inline friend functions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32959 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/optimize.c')
-rw-r--r--gcc/cp/optimize.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index 5ba9ea7e34b..63ec81a26ab 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -463,10 +463,6 @@ inlinable_function_p (fn, id)
it. */
else if (!DECL_INLINE (fn))
;
- /* If we don't have the function body available, we can't inline
- it. */
- else if (!DECL_SAVED_TREE (fn))
- ;
/* We can't inline varargs functions. */
else if (varargs_function_p (fn))
;
@@ -481,6 +477,21 @@ inlinable_function_p (fn, id)
/* Squirrel away the result so that we don't have to check again. */
DECL_UNINLINABLE (fn) = !inlinable;
+ /* We can inline a template instantiation only if it's fully
+ instantiated. */
+ if (inlinable
+ && DECL_TEMPLATE_INFO (fn)
+ && TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn)))
+ {
+ fn = instantiate_decl (fn, /*defer_ok=*/0);
+ inlinable = !TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn));
+ }
+
+ /* If we don't have the function body available, we can't inline
+ it. */
+ if (!DECL_SAVED_TREE (fn))
+ inlinable = 0;
+
/* Don't do recursive inlining, either. We don't record this in
DECL_UNLINABLE; we may be able to inline this function later. */
if (inlinable)
@@ -492,16 +503,6 @@ inlinable_function_p (fn, id)
inlinable = 0;
}
- /* We can inline a template instantiation only if it's fully
- instantiated. */
- if (inlinable
- && DECL_TEMPLATE_INFO (fn)
- && TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn)))
- {
- fn = instantiate_decl (fn);
- inlinable = !TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn));
- }
-
/* Return the result. */
return inlinable;
}
OpenPOWER on IntegriCloud