[C++] Avoid one place of frontend calling into targetm
David Edelsohn
dje@watson.ibm.com
Sun May 6 13:04:00 GMT 2007
>>>>> Jan Hubicka writes:
Jan> Looks like C++ frontend is keeping DECL_STATIC_CONSTRUCTOR on bit too
Jan> many functions, but I am not at all sure why. Would be possible to have
Jan> a testcase + diff of what is going wrong so I can throw it into a cross?
The testcase is g++.dg/init/copy3.C:
// { dg-do run }
// { dg-options "-fno-elide-constructors" }
int copies;
struct S {
S () {}
S (const S&) { ++copies; }
};
S s[1] = { S () };
int main () {
if (copies != 1)
return 1;
}
and the diff of the assembly output is:
--- copy3.s.bad Sat May 5 22:20:26 2007
+++ copy3.s Sat May 5 22:20:23 2007
@@ -212,40 +212,6 @@
.byte 31
.align 2
LFE..10:
- .align 2
- .globl _GLOBAL__I_0_copies
- .globl ._GLOBAL__I_0_copies
- .csect _GLOBAL__I_0_copies[DS]
-_GLOBAL__I_0_copies:
- .long ._GLOBAL__I_0_copies, TOC[tc0], 0
- .csect .text[PR]
-._GLOBAL__I_0_copies:
-LFB..11:
- mflr 0
-LCFI..20:
- stw 31,-4(1)
-LCFI..21:
- stw 0,8(1)
-LCFI..22:
- stwu 1,-64(1)
-LCFI..23:
- mr 31,1
-LCFI..24:
- bl ._GLOBAL__I_copies
- lwz 1,0(1)
- lwz 0,8(1)
- mtlr 0
- lwz 31,-4(1)
- blr
-LT.._GLOBAL__I_0_copies:
- .long 0
- .byte 0,9,32,97,128,1,0,1
- .long LT.._GLOBAL__I_0_copies-._GLOBAL__I_0_copies
- .short 19
- .byte "_GLOBAL__I_0_copies"
- .byte 31
- .align 2
-LFE..11:
.globl copies
.csect .data[RW],3
.align 2
In other words, the entire, extraneous function _GLOBAL__I_0_copies.
David
More information about the Gcc-patches
mailing list