]>
Commit | Line | Data |
---|---|---|
7dfbd804 | 1 | // Copyright (C) 2008 Free Software Foundation, Inc. |
2 | // | |
3 | // This file is part of GCC. | |
4 | // | |
5 | // GCC is free software; you can redistribute it and/or modify it under | |
6 | // the terms of the GNU General Public License as published by the Free | |
7 | // Software Foundation; either version 3, or (at your option) any later | |
8 | // version. | |
9 | // | |
10 | // GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
11 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 | // for more details. | |
14 | // | |
15 | // Under Section 7 of GPL version 3, you are granted additional | |
16 | // permissions described in the GCC Runtime Library Exception, version | |
17 | // 3.1, as published by the Free Software Foundation. | |
18 | // | |
19 | // You should have received a copy of the GNU General Public License and | |
20 | // a copy of the GCC Runtime Library Exception along with this program; | |
21 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
22 | // <http://www.gnu.org/licenses/>. | |
23 | ||
8372e9ea | 24 | // picoChip ASM file |
25 | //.file "clzsi2.asm" | |
26 | ||
27 | .section .text | |
28 | ||
29 | .global __clzsi2 | |
30 | __clzsi2: | |
31 | _picoMark_FUNCTION_BEGIN= | |
32 | ||
33 | // picoChip Function Prologue : &__clzsi2 = 0 bytes | |
34 | ||
35 | // What value should be operated on? If the top word is empty | |
36 | // then count the bits in the bottom word, and add 16. If the | |
37 | // top word is not empty, then count the bits in the top word. | |
38 | ||
39 | // R4 stores the constant 0 | |
40 | ||
41 | sub.0 R1,0,r15 \ copy.1 16,r2 | |
42 | copyeq r0,r1 | |
43 | copyne 0,r2 | |
44 | ||
45 | // R1 now stores value to count, and R2 stores current bit offset. | |
46 | sbc r1,r0 | |
47 | asr.0 r1,15,r15 \ add.1 r0,1,r0 | |
48 | jr (lr) \ copyne 0,r0 | |
49 | =-> add.0 r0,r2,r0 | |
50 | ||
51 | _picoMark_FUNCTION_END= | |
52 | ||
53 | // picoChip Function Epilogue : __clzsi2 | |
54 | ||
55 | //============================================================================ | |
56 | // All DWARF information between this marker, and the END OF DWARF | |
57 | // marker should be included in the source file. Search for | |
58 | // FUNCTION_STACK_SIZE_GOES_HERE and FUNCTION NAME GOES HERE, and | |
59 | // provide the relevent information. Add markers called | |
60 | // _picoMark_FUNCTION_BEGIN and _picoMark_FUNCTION_END around the | |
61 | // function in question. | |
62 | //============================================================================ | |
63 | ||
64 | //============================================================================ | |
65 | // Frame information. | |
66 | //============================================================================ | |
67 | ||
68 | .section .debug_frame | |
69 | _picoMark_DebugFrame= | |
70 | ||
71 | // Common CIE header. | |
72 | .unalignedInitLong _picoMark_CieEnd-_picoMark_CieBegin | |
73 | _picoMark_CieBegin= | |
74 | .unalignedInitLong 0xffffffff | |
75 | .initByte 0x1 // CIE Version | |
76 | .ascii 16#0# // CIE Augmentation | |
77 | .uleb128 0x1 // CIE Code Alignment Factor | |
78 | .sleb128 2 // CIE Data Alignment Factor | |
79 | .initByte 0xc // CIE RA Column | |
80 | .initByte 0xc // DW_CFA_def_cfa | |
81 | .uleb128 0xd | |
82 | .uleb128 0x0 | |
83 | .align 2 | |
84 | _picoMark_CieEnd= | |
85 | ||
86 | // FDE | |
87 | _picoMark_LSFDE0I900821033007563= | |
88 | .unalignedInitLong _picoMark_FdeEnd-_picoMark_FdeBegin | |
89 | _picoMark_FdeBegin= | |
90 | .unalignedInitLong _picoMark_DebugFrame // FDE CIE offset | |
91 | .unalignedInitWord _picoMark_FUNCTION_BEGIN // FDE initial location | |
92 | .unalignedInitWord _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN | |
93 | .initByte 0xe // DW_CFA_def_cfa_offset | |
94 | .uleb128 0x0 // <-- FUNCTION_STACK_SIZE_GOES_HERE | |
95 | .initByte 0x4 // DW_CFA_advance_loc4 | |
96 | .unalignedInitLong _picoMark_FUNCTION_END-_picoMark_FUNCTION_BEGIN | |
97 | .initByte 0xe // DW_CFA_def_cfa_offset | |
98 | .uleb128 0x0 | |
99 | .align 2 | |
100 | _picoMark_FdeEnd= | |
101 | ||
102 | //============================================================================ | |
103 | // Abbrevation information. | |
104 | //============================================================================ | |
105 | ||
106 | .section .debug_abbrev | |
107 | _picoMark_ABBREVIATIONS= | |
108 | ||
109 | .section .debug_abbrev | |
110 | .uleb128 0x1 // (abbrev code) | |
111 | .uleb128 0x11 // (TAG: DW_TAG_compile_unit) | |
112 | .initByte 0x1 // DW_children_yes | |
113 | .uleb128 0x10 // (DW_AT_stmt_list) | |
114 | .uleb128 0x6 // (DW_FORM_data4) | |
115 | .uleb128 0x12 // (DW_AT_high_pc) | |
116 | .uleb128 0x1 // (DW_FORM_addr) | |
117 | .uleb128 0x11 // (DW_AT_low_pc) | |
118 | .uleb128 0x1 // (DW_FORM_addr) | |
119 | .uleb128 0x25 // (DW_AT_producer) | |
120 | .uleb128 0x8 // (DW_FORM_string) | |
121 | .uleb128 0x13 // (DW_AT_language) | |
122 | .uleb128 0x5 // (DW_FORM_data2) | |
123 | .uleb128 0x3 // (DW_AT_name) | |
124 | .uleb128 0x8 // (DW_FORM_string) | |
125 | .initByte 0x0 | |
126 | .initByte 0x0 | |
127 | ||
128 | .uleb128 0x2 ;# (abbrev code) | |
129 | .uleb128 0x2e ;# (TAG: DW_TAG_subprogram) | |
130 | .initByte 0x0 ;# DW_children_no | |
131 | .uleb128 0x3 ;# (DW_AT_name) | |
132 | .uleb128 0x8 ;# (DW_FORM_string) | |
133 | .uleb128 0x11 ;# (DW_AT_low_pc) | |
134 | .uleb128 0x1 ;# (DW_FORM_addr) | |
135 | .uleb128 0x12 ;# (DW_AT_high_pc) | |
136 | .uleb128 0x1 ;# (DW_FORM_addr) | |
137 | .initByte 0x0 | |
138 | .initByte 0x0 | |
139 | ||
140 | .initByte 0x0 | |
141 | ||
142 | //============================================================================ | |
143 | // Line information. DwarfLib requires this to be present, but it can | |
144 | // be empty. | |
145 | //============================================================================ | |
146 | ||
147 | .section .debug_line | |
148 | _picoMark_LINES= | |
149 | ||
150 | //============================================================================ | |
151 | // Debug Information | |
152 | //============================================================================ | |
153 | .section .debug_info | |
154 | ||
155 | //Fixed header. | |
156 | .unalignedInitLong _picoMark_DEBUG_INFO_END-_picoMark_DEBUG_INFO_BEGIN | |
157 | _picoMark_DEBUG_INFO_BEGIN= | |
158 | .unalignedInitWord 0x2 | |
159 | .unalignedInitLong _picoMark_ABBREVIATIONS | |
160 | .initByte 0x2 | |
161 | ||
162 | // Compile unit information. | |
163 | .uleb128 0x1 // (DIE 0xb) DW_TAG_compile_unit) | |
164 | .unalignedInitLong _picoMark_LINES | |
165 | .unalignedInitWord _picoMark_FUNCTION_END | |
166 | .unalignedInitWord _picoMark_FUNCTION_BEGIN | |
167 | // Producer is `picoChip' | |
168 | .ascii 16#70# 16#69# 16#63# 16#6f# 16#43# 16#68# 16#69# 16#70# 16#00# | |
169 | .unalignedInitWord 0xcafe // ASM language | |
170 | .ascii 16#0# // Name. DwarfLib expects this to be present. | |
171 | ||
172 | .uleb128 0x2 ;# (DIE DW_TAG_subprogram) | |
173 | ||
174 | // FUNCTION NAME GOES HERE. Use `echo name | od -t x1' to get the hex. Each hex | |
175 | // digit is specified using the format 16#XX# | |
176 | .ascii 16#5F# 16#63# 16#6C# 16#7A# 16#73# 16#69# 16#32# 16#0# // Function name `_clzsi2' | |
177 | .unalignedInitWord _picoMark_FUNCTION_BEGIN // DW_AT_low_pc | |
178 | .unalignedInitWord _picoMark_FUNCTION_END // DW_AT_high_pc | |
179 | ||
180 | .initByte 0x0 // end of compile unit children. | |
181 | ||
182 | _picoMark_DEBUG_INFO_END= | |
183 | ||
184 | //============================================================================ | |
185 | // END OF DWARF | |
186 | //============================================================================ | |
187 | ||
188 | .section .endFile | |
189 | // End of picoChip ASM file |