forked from OSchip/llvm-project
parent
1a61fa460f
commit
55f987b45c
|
@ -159,8 +159,26 @@ fastcc int %bar(int %X, int(double, int)* %FP) { ;<i> fastcc</i>
|
|||
<p>In LLVM 1.5, the X86 code generator is the only target that has been enhanced
|
||||
to support proper tail calls (other targets will be enhanced in future).
|
||||
Further, because this support was added very close to the release, it is
|
||||
disabled by default. Pass <tt>-enable-x86-fastcc</tt> to llc to enable it. X86
|
||||
support will be enabled by default in the next LLVM release.</p>
|
||||
disabled by default. Pass <tt>-enable-x86-fastcc</tt> to llc to enable it (this
|
||||
will be enabled by default in the next release). The example above compiles to:
|
||||
</p>
|
||||
|
||||
<p><pre>
|
||||
bar:
|
||||
sub ESP, 8 # Callee uses more space than the caller
|
||||
mov ECX, DWORD PTR [ESP + 8] # Get the old return address
|
||||
mov DWORD PTR [ESP + 4], 0 # First half of 0.0
|
||||
mov DWORD PTR [ESP + 8], 0 # Second half of 0.0
|
||||
mov DWORD PTR [ESP], ECX # Put the return address where it belongs
|
||||
jmp EDX # Tail call "FP"
|
||||
</pre></p>
|
||||
|
||||
<p>
|
||||
With fastcc on X86, the first two integer arguments are passed in EAX/EDX, the
|
||||
callee pops its arguments off the stack, and the argument area is always a
|
||||
multiple of 8 bytes in size.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--_________________________________________________________________________-->
|
||||
|
|
Loading…
Reference in New Issue