This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Properly check mode for x86 call/jmp address


On Tue, Mar 6, 2012 at 11:47 AM, Richard Henderson <rth@redhat.com> wrote:
> On 03/06/12 11:10, H.J. Lu wrote:
>> ?(define_insn "*call"
>> - ?[(call (mem:QI (match_operand:P 0 "call_insn_operand" "<c>zw"))
>> + ?[(call (mem:QI (match_operand:C 0 "call_insn_operand" "<c>zw"))
>> ? ? ? ?(match_operand 1 "" ""))]
>> - ?"!SIBLING_CALL_P (insn)"
>> + ?"!SIBLING_CALL_P (insn)
>> + ? && (GET_CODE (operands[0]) == SYMBOL_REF
>> + ? ? ? || GET_MODE (operands[0]) == word_mode)"
>
> There are enough copies of this extra constraint that I wonder
> if it simply ought to be folded into call_insn_operand.
>
> Which would need to be changed to define_special_predicate,
> since you'd be doing your own mode checking.
>
> Probably similar changes to sibcall_insn_operand.
>
>
> r~

Here is the updated patch.  I changed constant_call_address_operand
and call_register_no_elim_operand to use define_special_predicate.
OK for trunk?

Thanks.


-- 
H.J
---
2012-03-06  H.J. Lu  <hongjiu.lu@intel.com>

	* config/i386/i386.c (ix86_expand_call): Call
	constant_call_address_operand with Pmode and call
	call_register_no_elim_operand/memory_operand with word_mode.
	Convert the address to word_mode instead of Pmode.

	* config/i386/i386.md (W): New.
	(C): Likewise.
	(indirect_jump): Convert address to word_mode for x32.
	(tablejump): Likewise.
	(*indirect_jump): Replace :P with :W.
	(*tablejump_1): Likewise.
	(*call_vzeroupper): Replace :P with :C.
	(*call): Likewise.
	(*sibcall_vzeroupper): Likewise.
	(*sibcall): Likewise.
	(*call_value_vzeroupper): Likewise.
	(*call_value): Likewise.
	(*sibcall_value_vzeroupper): Likewise.
	(*sibcall_value): Likewise.

	* config/i386/predicates.md (constant_call_address_operand):
	Defined with define_special_predicate.  Return false if mode
	isn't Pmode.
	(call_register_no_elim_operand): Defined with
	define_special_predicate.  Return false if mode isn't word_mode.

Attachment: gcc-x32-branch-2.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]