|
75 | 75 | </div>
|
76 | 76 |
|
77 | 77 | <!--_________________________________________________________________________-->
|
78 |
| -<div class="doc_subsubsection"><a href="newcg">New Native Code |
| 78 | +<div class="doc_subsubsection"><a name="newcg">New Native Code |
79 | 79 | Generators</a></div>
|
80 | 80 |
|
81 | 81 | <div class="doc_text">
|
82 | 82 | <p>
|
83 | 83 | This release includes new native code generators for <a
|
84 |
| -href="#alpha-be">Alpha</a>, <a href="#ia64-be">IA-64</a>, and SPARC-V8 (32-bit |
85 |
| -SPARC). These code generators are still beta quality, but are progressing |
86 |
| -rapidly. |
| 84 | +href="#alpha-be">Alpha</a>, <a href="#ia64-be">IA-64</a>, and <a |
| 85 | +href="#sparcv8">SPARC-V8</a> (32-bit SPARC). These code generators are still |
| 86 | +beta quality, but are progressing rapidly. |
87 | 87 | </p>
|
88 | 88 | </div>
|
89 | 89 |
|
|
138 | 138 | features: custom calling conventions (described above), which allow the code
|
139 | 139 | generator to emit code for the caller to deallocate its own stack when it
|
140 | 140 | returns. The second feature is a flag on the <a href="LangRef.html#i_call">call
|
141 |
| -instruction</a>, which indicates that the callee does not access the callers |
| 141 | +instruction</a>, which indicates that the callee does not access the caller's |
142 | 142 | stack frame (indicating that it is acceptable to deallocate the caller stack
|
143 | 143 | before invoking the callee). LLVM proper tail calls run on the system stack (as
|
144 | 144 | do normal calls), supports indirect tail calls, tail calls with arbitrary
|
|
153 | 153 | to handle more general cases, but the simple case will always work if the code
|
154 | 154 | generator supports tail calls. Here is a simple example:</p>
|
155 | 155 |
|
156 |
| -<p><pre> |
| 156 | +<pre> |
157 | 157 | fastcc int %bar(int %X, int(double, int)* %FP) { ;<i> fastcc</i>
|
158 | 158 | %Y = tail call fastcc int %FP(double 0.0, int %X) ;<i> tail, fastcc</i>
|
159 | 159 | ret int %Y
|
160 | 160 | }
|
161 |
| -</pre></p> |
| 161 | +</pre> |
162 | 162 |
|
163 | 163 | <p>In LLVM 1.5, the X86 code generator is the only target that has been enhanced
|
164 | 164 | to support proper tail calls (other targets will be enhanced in future).
|
|
167 | 167 | will be enabled by default in the next release). The example above compiles to:
|
168 | 168 | </p>
|
169 | 169 |
|
170 |
| -<p><pre> |
| 170 | +<pre> |
171 | 171 | bar:
|
172 | 172 | sub ESP, 8 # Callee uses more space than the caller
|
173 | 173 | mov ECX, DWORD PTR [ESP + 8] # Get the old return address
|
174 | 174 | mov DWORD PTR [ESP + 4], 0 # First half of 0.0
|
175 | 175 | mov DWORD PTR [ESP + 8], 0 # Second half of 0.0
|
176 | 176 | mov DWORD PTR [ESP], ECX # Put the return address where it belongs
|
177 | 177 | jmp EDX # Tail call "FP"
|
178 |
| -</pre></p> |
| 178 | +</pre> |
179 | 179 |
|
180 | 180 | <p>
|
181 | 181 | With fastcc on X86, the first two integer arguments are passed in EAX/EDX, the
|
|
728 | 728 |
|
729 | 729 | </div>
|
730 | 730 |
|
| 731 | +<!-- ======================================================================= --> |
| 732 | +<div class="doc_subsection"> |
| 733 | + <a name="sparcv8">Known problems with the SPARC-V8 back-end</a> |
| 734 | +</div> |
| 735 | + |
| 736 | +<div class="doc_text"> |
| 737 | + |
| 738 | +<ul> |
| 739 | +<li>Many features are still missing (e.g. support for 64-bit integer |
| 740 | +arithmetic).</li> |
| 741 | + |
| 742 | +<li>This backend needs to be updated to use the SelectionDAG instruction |
| 743 | +selection framework.</li> |
| 744 | +</ul> |
| 745 | + |
| 746 | +</div> |
| 747 | + |
731 | 748 | <!-- *********************************************************************** -->
|
732 | 749 | <div class="doc_section">
|
733 | 750 | <a name="additionalinfo">Additional Information</a>
|
|
0 commit comments