On 28 November 2011 02:14, Geoffrey Mainland <[email protected]> wrote:
>> -----Original Message-----
>> From: David Terei [mailto:[email protected]]
>> Sent: 27 November 2011 23:32
>> To: Geoffrey Mainland
>> Cc: [email protected]
>> Subject: Re: [commit: ghc] simd: Handle 4-byte aligned stack on Win32 when
>> generating SSE instructions. (0f251a0)
>>
>> The mangler exists to work around a lack of features in LLVM that we need
>> (and until very recently a bug in the way GHC did stack management). You're
>> telling me that Win32 only guarantees 4 byte stack alignment but LLVM
>> assume 16byte. This seems like a bug somewhere.
>> Either in LLVM or the way we are using it. Its fine to patch the mangler to
>> handle this but it should be considered a hack and something better
>> pursued.
>
> LLVM does not assume 16-byte stack alignment. Instead, on platforms where 
> 16-byte stack alignment is not guaranteed, it 1) always outputs a function 
> prologue that 2) aligns the stack to a 16-byte boundary with an and 
> instructions, and it also 3) disables tail calls.
>
> Because LLVM aligns the stack for a function that has SSE register spills, it 
> then always generates movaps instructions for the spills.
>
> I have added a hack to LLVM that disables the stack-aligning code so that we 
> 1) don't get ebp scribbled over by the prologue and 2) recover the use of 
> tail calls. I should just further hack LLVM to generate movups instructions 
> directly instead of changing the mangler.

Thanks for the more details explanation.

>> So my question is more, what better is being pursued? or can be pursued.
>
> I can just patch LLVM. Keep in mind that the simd branch is not going to be 
> merged to master any time soon, so please don't worry about removing the 
> mangler---if it disappears and I want to merge from master, it's my problem, 
> not yours :)

The mangler also isn't going away very soon as the changes need to
remove it are changes to LLVM :).

> Patching LLVM is still disgusting. We can start a discussion with the LLVM 
> folks about the proper way to accomplish what I want. If you can point me in 
> the right direction (which may just be "post to llvm-devel") I would 
> appreciate it. We may also just decide not to support SSE on Win32. That 
> wouldn't bother me much except for the fact that my development machine at 
> work is a Windows box.

So yes just posting to llvm-devel. But it may be best to hold off on
that until you / ghc community is properly ready to tackle the issue.
For now I assume you have other work to worry about and the mangler
removal can wait till the end. We just want to avoid a common pitfall
in interacting with llvm (or any other open source project) of
approaching them in a vague and uncommitted fashion. The LLVM folks
are good to work with but we need to be driving the interaction and
work not sending wishy washy emails that lead no where and hurt our
reputation.

Mangler is fine for now I just wanted to understand the issue better
and see what we can do to remove it. When you want to patch LLVM
please just include me in the discussion as I've had a few patches
accepted by them in the past so feel I can help in this area.

Cheers,
David

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to