[LLVMdev] LLVM-GCC generating too much code from inline assembly

Dale Johannesen dalej at apple.com
Tue Mar 23 15:11:32 PDT 2010


On Mar 16, 2010, at 12:30 AMPDT, Fred / Kettch wrote:
> 
> I recently switched to LLVM-GCC 4.2 on OS X, to go around a bug caused by gcc with optimized code. Unfortunately, I ran into another weird problem on LLVM-GCC. In my code, there's a file with a bunch of inline assembly blocks, that worked fine with GCC 4.2. Now, when compiling with LLVM-GCC 4.2, weird things happen.
> 
> Here's an example: (the blocks are larger than that, but a single line will do to show you what's happening)
> __asm {
>    mov ebx, iObject
> }
> 
> The problem occurs in debug, and the code looks like this :
> ## InlineAsm Start
> .file "... my filename"
> ## InlineAsm End
> ## InlineAsm Start
> .line 1454
> ## InlineAsm End
> ## InlineAsm Start
> movl -20(%ebp), $ebx
> ## InlineAsm End
> movl %ebx, %eax
> movl %eax, -52(%ebp)

This is something I fixed recently; I think it produces functionally correct code at -O0 now in TOT.  You will still see interpolated copies, and stack loads and stores, but it should no longer clobber registers that are explicitly used for something else.  You need to use -O to get good performance though.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100323/b0352560/attachment.html>


More information about the llvm-dev mailing list