This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question regarding c++ constructors


On Feb 21, 2005, at 3:45 AM, Mile Davidovic wrote:
Functions are completely the same.
What is the reason for such compilere behaviour?

Just lack of code in the compiler to do better, see http://gcc.gnu.org/ml/gcc-patches/2002-08/msg00354.html for some of the details and starting point, should you want to develop the code further.... With that compiler, one can get:


__ZN4testC2Ev:
LFB4:
        b __ZN4testC4Ev
LFE4:
        .align 2
        .globl __ZN4testC1Ev
.section __TEXT,__text,regular,pure_instructions
        .align 2
__ZN4testC1Ev:
LFB6:
        b __ZN4testC4Ev
LFE6:
        .align 2
        .globl __ZN4testC4Ev
.section __TEXT,__text,regular,pure_instructions
        .align 2
__ZN4testC4Ev:
LFB7:
        blr
LFE7:

While this case doesn't show it, imagine if the code were long to very long, the savings increase.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]