Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Craig Federighi
Tue, 15 Sep 1992 03:46
gcc-2.2.2: doesn't inline generic fns/methods
Author: Craig Federighi
Date: Tue, 15 Sep 1992 03:46
Date: Tue, 15 Sep 1992 03:46
87 lines
2009 bytes
2009 bytes
GCC Version: gcc-2.2.2
Machine: NeXT '040
I noticed that gcc isn't inlining generic functions or the inline methods
of generic (template) classes. I couldn't find a mention of this limitation
in any of the info files in the gcc install directory. If there is a file
mentioning these sorts of limitations / bugs, could you please mail me back
a pointer to it?
Here is a simple example using generic functions. The results are similar
for the inline methods of generic classes.
// Test on inlined functions
// Non-template functions inline correctly
inline int InlineMax( const int &a, const int &b )
{
return (a>b) ? a : b;
}
int CALLIINLINEMAX()
{
return InlineMax(5, 10);
}
/*
_CALLIINLINEMAX__Fv:
link a6,#-8
moveq #5,d1
movel d1,a6@(-4)
moveq #10,d1
movel d1,a6@(-8)
lea a6@(-8),a0
movel a6@(-4),d0
cmpl a0@,d0
jge L6
movel a0@,d0
L6:
unlk a6
rts
*/
// Test on inlined functions
// Template functions do not inline.
template <class T>
inline T GenInlineMax( const T &a, const T &b )
{
return (a>b) ? a : b;
}
int CALLGenInlineMax()
{
return GenInlineMax(5, 10);
}
/*
_CALLGenInlineMax__Fv:
link a6,#-8
moveq #10,d1
movel d1,a6@(-8)
pea a6@(-8)
moveq #5,d1
movel d1,a6@(-4)
pea a6@(-4)
jbsr _GenInlineMax__FRCiT0
unlk a6
rts
.align 1
_GenInlineMax__FRCiT0:
link a6,#0
movel a6@(8),a0
movel a6@(12),a1
movel a0@,d0
cmpl a1@,d0
jge L15
movel a1@,d0
L15:
unlk a6
rts
*/
- Craig Federighi
craigf@icsi.berkeley.edu
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads