This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Add support for the Win32 hook prologue (try 8)
- From: Stefan Dösinger <stefan at codeweavers dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Paolo Bonzini <bonzini at gnu dot org>
- Date: Wed, 7 Oct 2009 21:08:22 +0200
- Subject: Add support for the Win32 hook prologue (try 8)
Here's another version of the ms_hook_prologue patch.
I noticed that the function context isn't set, and the
current_function_decl isn't updated by the time the attribute
callbacks execute. Thus I use current_function_decl, not
decl_function_context(node) to find out if the function is nested or
not. If this is not correct(I only checked the C frontend so far),
please suggest a better solution. The only other way I found was to
check the nestedness during code generation, which doesn't seem right
to me(and puts the error at the end of the function, not its
declaration).
The development / test platform for this patch is x86_64-apple-
darwin10.0.0 on OSX 10.6.1. I have tested older versions of this on
x86_64-pc-linux-gnu as well, but didn't run the testsuite for this
patch on Linux yet.
Changes from try 7:
Disallowed ms_hook_prologue on nested functions
Attached the correct patch this time
Changes from try 6:
the ms_hook_prologue attribute applies to the function, rather than
its type. Changed the attribute lookup accordingly. However, I still
allow the attribute for nested functions, there's no reason why this
wouldn't work. (The case of static_chain and ms_hook_prologue can
potentially be optimized)
Changes from try 5:
Fixed conflicts with static_chain patches, simple handling for
static_chain+ms_hook_prologue cases.
Improved changelog(hopefully correctly)
Changes from try 4:
Use SIMode instead of Pmode for the registers.
Changes from try 3:
Renamed the attribute name to ms_hook_prologue, since its not always
generated
by msvc
Changes from try 2:
* Use dg-require-effective-target ilp32 instead of dg-options -m32 in
the test
* More code layout fixes
Changes from the first try:
* Moved testcase to gcc.target/i386
* restructured ix86_handle_abi_attribute
* Changed HAVE_AS_IX86_SWAP handling as suggested by rth
* ix86_function_msvc_prologue returns a bool, removed fntype != NULL
check
* fixed indentation in ix86_expand_prologue(hopefully correct now)
2009-09-23: Stefan Dösinger <stefan@codeweavers.com
* config/i386/i386.md: Added vswapmov, a volative DIMode
register->register mov with the swap suffix set
* config/i386/i386.c (ix86_expand_prologue): Add a new function
attribute ms_hook_prologue that starts functions with the same
opcode
sequence used in most Win32 API functions
* config/i386/i386.c (ix86_function_ms_hook_prologue): New
* config/i386/i386.c (ix86_handle_fndecl_attribute): New
* gcc.target/i386/ms_hook_prologue.c: New testcase
* configure.ac: Test for swap suffix support in as
Attachment:
ms_hook_prologue.diff
Description: Binary data