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, i386, Pointer Bounds Checker 30/x] Size relocation


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.


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