[PATCH, i386, Pointer Bounds Checker 33/x] MPX ABI

Uros Bizjak ubizjak@gmail.com
Sun Sep 21 15:32:00 GMT 2014


On Sun, Sep 21, 2014 at 2:34 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Fri, Sep 19, 2014 at 9:55 AM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
>
>> Here is an updated version of this patch.
>>
>> Thanks,
>> Ilya
>> --
>> 2014-09-19  Ilya Enkovich  <ilya.enkovich@intel.com>
>>
>>         * config/i386/i386.c (ix86_option_override_internal): Do not
>>         support x32 with MPX.
>>         is not available.
>>         (init_cumulative_args): Init stdarg, bnd_regno, bnds_in_bt
>>         and force_bnd_pass.
>>         (function_arg_advance_32): Return number of used integer
>>         registers.
>>         (function_arg_advance_64): Likewise.
>>         (function_arg_advance_ms_64): Likewise.
>>         (ix86_function_arg_advance): Handle pointer bounds.
>>         (ix86_function_arg): Likewise.
>>         (ix86_function_value_regno_p): Mark fisrt bounds registers as
>>         possible function value.
>>         (ix86_function_value_1): Handle pointer bounds type/mode
>>         (ix86_return_in_memory): Likewise.
>>         (ix86_print_operand): Analyse insn to decide abounf"bnd" prefix.
>>         (ix86_expand_call): Generate returned bounds.
>>         (ix86_bnd_prefixed_insn_p): Check if we have instrumented call
>>         or function.
>>         * config/i386/i386.h (ix86_args): Add bnd_regno, bnds_in_bt,
>>         force_bnd_pass and stdarg fields.
>>         * config/i386/i386.md (UNSPEC_BNDRET): New.
>>         (*call_value): Add returned bounds.
>>         (*sibcall_value): Likewise.
>>         (*call_value_rex64_ms_sysv): Likewise.
>>         (*call_value_pop): Likewise.
>>         (*sibcall_value_pop): Likewise.
>>         * config/i386/predicates.md (call_rex64_ms_sysv_operation): Adjust
>>         to changed call patterns.
>>
>>
>> @@ -11604,6 +11609,8 @@
>>      [(set (match_operand 0)
>>           (call (mem:QI (match_operand:DI 1 "call_insn_operand" "rBwBz"))
>>                 (match_operand 2)))
>> +     (set (reg:BND64 BND0_REG) (unspec [(reg:BND64 BND0_REG)] UNSPEC_BNDRET))
>> +     (set (reg:BND64 BND1_REG) (unspec [(reg:BND64 BND1_REG)] UNSPEC_BNDRET))
>>       (unspec [(const_int 0)] UNSPEC_MS_TO_SYSV_CALL)])]
>>   "TARGET_64BIT && !SIBLING_CALL_P (insn)"
>>    "* return ix86_output_call_insn (insn, operands[1]);"

This pattern has been removed [1] ...

>> --- a/gcc/config/i386/predicates.md
>> +++ b/gcc/config/i386/predicates.md
>> @@ -631,14 +631,17 @@
>>    (match_code "parallel")
>>  {
>>    unsigned creg_size = ARRAY_SIZE (x86_64_ms_sysv_extra_clobbered_registers);
>> +  unsigned adop = GET_CODE (XVECEXP (op, 0, 0)) == SET
>> +                  ? 4
>> +                 : 2;
>>    unsigned i;
>>
>> -  if ((unsigned) XVECLEN (op, 0) != creg_size + 2)
>> +  if ((unsigned) XVECLEN (op, 0) != creg_size + adop)
>>      return false;
>>
>>    for (i = 0; i < creg_size; i++)
>>      {
>> -      rtx elt = XVECEXP (op, 0, i+2);
>> +      rtx elt = XVECEXP (op, 0, i+adop);
>>        enum machine_mode mode;
>>        unsigned regno;

... and the part above has been killed as well.

[1] https://gcc.gnu.org/ml/gcc-patches/2014-09/msg01739.html

Uros.



More information about the Gcc-patches mailing list