/* Functions in i386.c */
extern bool ix86_target_stack_probe (void);
extern bool ix86_can_use_return_insn_p (void);
+extern bool ix86_function_ms_hook_prologue (const_tree fn);
extern void ix86_setup_frame_addresses (void);
extern bool ix86_rip_relative_addr_p (struct ix86_address *parts);
bool
ix86_can_use_return_insn_p (void)
{
+ if (ix86_function_ms_hook_prologue (current_function_decl))
+ return false;
+
if (ix86_function_naked (current_function_decl))
return false;
;; static chain pointer - the first instruction has to be pushl %esi
;; and it can't be moved around, as we use alternate entry points
;; in that case.
+;; Also disallow for ms_hook_prologue functions which have frame
+;; pointer set up in function label which is correctly handled in
+;; ix86_expand_{prologue|epligoue}() only.
(define_expand "simple_return"
[(simple_return)]
- "!TARGET_SEH && !ix86_static_chain_on_stack"
+ "!TARGET_SEH && !ix86_static_chain_on_stack && !ix86_function_ms_hook_prologue (cfun->decl)"
{
if (crtl->args.pops_args)
{
/* { dg-require-effective-target ms_hook_prologue } */
/* { dg-options "-O2 -fomit-frame-pointer" } */
+#include <stdio.h>
+
int __attribute__ ((__ms_hook_prologue__)) foo ()
{
unsigned char *ptr = (unsigned char *) foo;
return 0;
}
+unsigned int __attribute__ ((noinline, __ms_hook_prologue__)) test_func()
+{
+ static int value;
+
+ if (value++) puts("");
+
+ return 0;
+}
+
int main ()
{
- return foo();
+ return foo() || test_func();
}