Index: i386.c =================================================================== --- i386.c (revision 143161) +++ i386.c (working copy) @@ -8017,11 +8017,27 @@ if (frame_pointer_needed) { + if(1 /* fixme: Control this with the ms_hook attribute */) + { + /* fixme: set rev flag */ + insn = emit_move_insn (gen_rtx_REG (Pmode, 5), gen_rtx_REG (Pmode, 5)); + RTX_FRAME_RELATED_P (insn) = 1; + } + insn = emit_insn (gen_push (hard_frame_pointer_rtx)); RTX_FRAME_RELATED_P (insn) = 1; - insn = emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx); - RTX_FRAME_RELATED_P (insn) = 1; + if (lookup_attribute ("cdecl", TYPE_ATTRIBUTES (TREE_TYPE (DECL_RESULT (cfun->decl)))) ) + { + /* fixme: set rev flag */ + insn = emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx); + RTX_FRAME_RELATED_P (insn) = 1; + } + else + { + insn = emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx); + RTX_FRAME_RELATED_P (insn) = 1; + } } if (stack_realign_fp) @@ -26156,11 +26172,24 @@ } if (!TARGET_64BIT) { - warning (OPT_Wattributes, "%qs attribute only available for 64-bit", - IDENTIFIER_POINTER (name)); - *no_add_attrs = true; - return NULL_TREE; + if(!is_attribute_p ("ms_hook", name)) + { + warning (OPT_Wattributes, "%qs attribute only available for 64-bit", + IDENTIFIER_POINTER (name)); + *no_add_attrs = true; + return NULL_TREE; + } } + else + { + if(is_attribute_p ("ms_hook", name)) + { + warning (OPT_Wattributes, "%qs attribute only available for 32-bit", + IDENTIFIER_POINTER (name)); + *no_add_attrs = true; + return NULL_TREE; + } + } /* Can combine regparm with all attributes but fastcall. */ if (is_attribute_p ("ms_abi", name)) @@ -29200,6 +29229,7 @@ /* ms_abi and sysv_abi calling convention function attributes. */ { "ms_abi", 0, 0, false, true, true, ix86_handle_abi_attribute }, { "sysv_abi", 0, 0, false, true, true, ix86_handle_abi_attribute }, + { "ms_hook", 0, 0, false, true, true, ix86_handle_abi_attribute }, /* End element. */ { NULL, 0, 0, false, false, false, NULL } };