This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, i386, Pointer Bounds Checker 30/x] Size relocation
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "Enkovich, Ilya" <ilya dot enkovich at intel dot com>
- Date: Wed, 17 Sep 2014 20:51:11 +0200
- Subject: Re: [PATCH, i386, Pointer Bounds Checker 30/x] Size relocation
- Authentication-results: sourceware.org; auth=none
- References: <CAFULd4avH2BWgAvDJhvU1TwRpDSdAUAwBLdRR3Qd8VTeF8rx_g at mail dot gmail dot com> <CAMbmDYbmV5hmUME1WEeEVQZ13dpRAt5a3VRompfZi8YxhZ35_A at mail dot gmail dot com> <CAFULd4Ym34U=-yfP_RszZ6CG-J2xgoPjBbs3Ezbh=1OTQOjkAw at mail dot gmail dot com> <20140917183534 dot GD3628 at msticlxl57 dot ims dot intel dot com>
On Wed, Sep 17, 2014 at 8:35 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
> On 16 Sep 12:22, Uros Bizjak wrote:
>> On Tue, Sep 16, 2014 at 11:37 AM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
>> > 2014-09-16 13:08 GMT+04:00 Uros Bizjak <ubizjak@gmail.com>:
>> >>
>> >> Can x86_64_immediate_operand predicate be used here?
>> >
>> > I think it cannot be used because of TLS symbols not counting as immediate.
>>
>> OK, please introduce a new predicate, similar to
>> x86_64_immediate_operand, perhaps x86_64_immediate_size_operand, so we
>> can add some comments there. This will also help to macroize the insn,
>> x86_64_immediate_operand has !TARGET_64BIT shortcut for this case.
>>
>> Uros.
>
> I don't see how new predicate would help to macroize insn. Single template may look as following patch.
You put early return for !TARGET_64BITS. Please see
x86_64_immediate_operand predicate.
So,
/* Here comes comment. */
(define_predicate "x86_64_immediate_size_operand"
(match_code "symbol_ref")
{
if (!TARGET_64BIT)
return true;
/* Comment here explaining these conditions. */
return (ix86_cmodel == CM_SMALL || ix86_cmodel == CM_KERNEL);
}
And then in the pattern itself:
if (x86_64_immediate_size_operand (operands[1], VOIDmode)
return "mov{l}\t{%1@SIZE, %k0|%k0, %1@SIZE}";
else
return "movabs{q}\t{%1@SIZE, %0|%0, %1@SIZE}";
Uros.