[LLVMdev] Bug in X86CompilationCallback_SSE

Corrado Zoccolo czoccolo at gmail.com
Thu Mar 12 13:55:13 PDT 2009


On Thu, Mar 12, 2009 at 5:18 PM, Dan Gohman <gohman at apple.com> wrote:
> This looks like an interesting idea. As written, the inline asms
> aren't safe
> though; they reference %eax, %edx, etc. without declaring such things in
> constraints, so the compiler wouldn't know that it can't clobber those
> registers.
>
> Dan
>
I don't know how to specify the constraint, since it should constrain
gcc to not use the register before the asm block, while constraints
can just say how to pass info to/from the asm block, and describe how
the asm block modifies the environment.

Actually, I don't think it is needed, though, since those asm blocks
are put at the very beginning and the very end of the function (and
declared volatile, i.e. they cannot be moved), so the compiler has no
need for those registers:
* they are not used by standard prologue/epilogue
* the only thing that is done before is the allocation of the stack
space, and since we use it both before and after a call, the compiler
must use one (or more) callee saved registers for it, so it can't use
any of the registers we need to save.

Corrado



More information about the llvm-dev mailing list