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


2014-10-01 19:17 GMT+04:00 Uros Bizjak <ubizjak@gmail.com>:
> On Wed, Oct 1, 2014 at 4:10 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
>
>>> +;; Return true if size of VALUE can be stored in a sign
>>> +;; extended immediate field.
>>> +(define_predicate "x86_64_immediate_size_operand"
>>> +  (match_code "symbol_ref")
>>> +{
>>> +  if (!TARGET_64BIT)
>>> +    return true;
>>> +
>>> +  /* For 64 bit target we may assume size of object fits
>>> +     immediate only when code model guarantees that.  */
>>> +  return (ix86_cmodel == CM_SMALL || ix86_cmodel == CM_KERNEL);
>>> +})
>>> +
>>
>> This predicate causes bootstrap error:
>> predicates.md:362:38: error: unused parameter 'op' [-Werror=unused-parameter]
>
> Huh? How is this predicate different from e.g.
>
> (define_predicate "compare_operator"
>   (match_code "compare"))
>
> ?
>
> Can you please show generated code from gcc/insn-preds.c?
>
> Uros.

It is different because it has a code block which is used to generate
additional function. Here is what generated for the predicate:

static inline int
x86_64_immediate_size_operand_1 (rtx op, enum machine_mode mode
ATTRIBUTE_UNUSED)
{
  if (!TARGET_64BIT)
    return true;

  /* For 64 bit target we may assume size of object fits
     immediate only when code model guarantees that.  */
  return (ix86_cmodel == CM_SMALL || ix86_cmodel == CM_KERNEL);
}

int
x86_64_immediate_size_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
{
  return ((GET_CODE (op) == SYMBOL_REF) && (
(x86_64_immediate_size_operand_1 (op, mode)))) && (
(mode == VOIDmode || GET_MODE (op) == mode));
}


Ilya


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