OSDN Git Service

Improve alias analysis on ia64
[pf3gnuchains/gcc-fork.git] / gcc / config / ia64 / crtend.asm
1 /* Copyright (C) 2000 Free Software Foundation, Inc.
2    Contributed by Jes Sorensen, <Jes.Sorensen@cern.ch>
3
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Library General Public License as
6    published by the Free Software Foundation; either version 2 of the
7    License, or (at your option) any later version.
8
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Library General Public License for more details.
13
14    You should have received a copy of the GNU Library General Public
15    License along with the GNU C Library; see the file COPYING.LIB.  If not,
16    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17    Boston, MA 02111-1307, USA.  */
18
19 .section .ctors,"aw","progbits"
20         .align  8
21 __CTOR_END__:
22         data8   0
23
24 .section .dtors,"aw","progbits"
25         .align 8
26 __DTOR_END__:
27         data8   0
28
29 /*
30  * Fragment of the ELF _init routine that invokes our dtor cleanup.
31  *
32  * We make the call by indirection, because in large programs the 
33  * .fini and .init sections are not in range of the destination, and
34  * we cannot allow the linker to insert a stub at the end of this
35  * fragment of the _fini function.  Further, Itanium does not implement
36  * the long branch instructions, and we do not wish every program to
37  * trap to the kernel for emulation.
38  *
39  * Note that we require __do_global_ctors_aux to preserve the GP,
40  * so that the next fragment in .fini gets the right value.
41  */
42 .section .init,"ax","progbits"
43         { .mlx
44           movl r2 = @gprel(__do_global_ctors_aux#)
45           ;;
46         }
47         { .mii
48           nop.m 0
49           add r2 = r2, gp
50           ;;
51           mov b6 = r2
52         }
53         { .bbb
54           br.call.sptk.many b0 = b6
55           ;;
56         }
57
58 .text
59         .align 16
60         .proc __do_global_ctors_aux#
61 __do_global_ctors_aux:
62         /*
63                 for (loc0 = __CTOR_END__-1; *p != -1; --p)
64                   (*p) ();
65         */
66         { .mii
67           alloc loc4 = ar.pfs, 0, 5, 0, 0
68           addl loc0 = @ltoff(__CTOR_END__# - 8), gp
69           mov loc1 = b0
70           ;;
71         }
72         { .mmi
73           ld8 loc0 = [loc0]
74           ;;
75           ld8 loc3 = [loc0], -8
76           mov loc2 = gp
77           ;;
78         }
79         { .mfb
80           cmp.eq p6, p0 = -1, loc3
81 (p6)      br.cond.spnt.few 2f
82         }
83 0:
84         { .mmi
85           ld8 r15 = [loc3], 8
86           ;;
87           ld8 gp = [loc3]
88           mov b6 = r15
89         }
90         { .mfb
91           ld8 loc3 = [loc0], -8
92           br.call.sptk.many b0 = b6
93           ;;
94         }
95         { .mfb
96           cmp.ne p6, p0 = -1, loc3
97 (p6)      br.cond.sptk.few 0b
98         }
99 2:
100         { .mii
101           mov gp = loc2
102           mov b0 = loc1
103           mov ar.pfs = loc4
104         }
105         { .bbb
106           br.ret.sptk.many b0
107           ;;
108         }
109         .endp __do_global_ctors_aux#