[llvm-commits] Patch for Win64 calling conventions

Anton Korobeynikov anton at korobeynikov.info
Fri Aug 28 08:58:08 PDT 2009


Hello, Michael

> the following patches adds a workaround for Win64 calling conventions.
> The problem is, that windows requires a 32 byte free zone above the
> current frame as a back store for register parameters.
> While this zone is allocated in newer versions, spilling with PUSH/POP
> will spill into this zone, so spilled values gets overwritten when a
> called function uses this area.
> The patch simply uses store/load to the right spillslot.
> This might be overkill if the current function is a leaf ...
The problem is other actually: there is no push for high xmm
registers, that's why we're emitting movaps to store them to stack.
However, prologue / epilogue expansion code assumes (wrongly) that
callee-saved saves / loads can be generated via push / pop only.
Unfortunately, it's not safe to let them recognize movaps as well,
since it can be not frame-setup-related one.

I'm planning to rewrite frame handling code on x86, since it's
currently really hacky. However, your workaround looks reasonable
short-term.

> The second small patch simply sets the hosttriple to "x86_64-pc-win32"
> for 64bit builds and to "i686-pc-win32" for 32bit builds.
> At least my cmake sets the hosttriple always to i686, causing the 32bit
> code generator to be called instead of the 64bit one.
The patch is incorrect: you're breaking mingw32 builds. Please don't
assume that the only windows build is vcpp-based one :)

-- 
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University



More information about the llvm-commits mailing list