View | Details | Raw Unified | Return to bug 77728 | Differences between
and this patch

Collapse All | Expand All

(-)gcc/config/arm/arm.c.jj (-16 / +47 lines)
Lines 81-87 struct four_ints Link Here
81
81
82
/* Forward function declarations.  */
82
/* Forward function declarations.  */
83
static bool arm_const_not_ok_for_debug_p (rtx);
83
static bool arm_const_not_ok_for_debug_p (rtx);
84
static bool arm_needs_doubleword_align (machine_mode, const_tree);
84
static int arm_needs_doubleword_align (machine_mode, const_tree);
85
static int arm_compute_static_chain_stack_bytes (void);
85
static int arm_compute_static_chain_stack_bytes (void);
86
static arm_stack_offsets *arm_get_frame_offsets (void);
86
static arm_stack_offsets *arm_get_frame_offsets (void);
87
static void arm_add_gc_roots (void);
87
static void arm_add_gc_roots (void);
Lines 6349-6355 aapcs_layout_arg (CUMULATIVE_ARGS *pcum, Link Here
6349
  /* C3 - For double-word aligned arguments, round the NCRN up to the
6349
  /* C3 - For double-word aligned arguments, round the NCRN up to the
6350
     next even number.  */
6350
     next even number.  */
6351
  ncrn = pcum->aapcs_ncrn;
6351
  ncrn = pcum->aapcs_ncrn;
6352
  if ((ncrn & 1) && arm_needs_doubleword_align (mode, type))
6352
  if ((ncrn & 1) && arm_needs_doubleword_align (mode, type) > 0)
6353
    ncrn++;
6353
    ncrn++;
6354
6354
6355
  nregs = ARM_NUM_REGS2(mode, type);
6355
  nregs = ARM_NUM_REGS2(mode, type);
Lines 6455-6466 arm_init_cumulative_args (CUMULATIVE_ARG Link Here
6455
    }
6455
    }
6456
}
6456
}
6457
6457
6458
/* Return true if mode/type need doubleword alignment.  */
6458
/* Return 1 if double word alignment is required for argument passing.
6459
static bool
6459
   Return -1 if double word alignment used to be required for argument
6460
   passing before PR77728 ABI fix, but is not required anymore.
6461
   Return 0 if double word alignment is not required and wasn't requried
6462
   before either.  */
6463
static int
6460
arm_needs_doubleword_align (machine_mode mode, const_tree type)
6464
arm_needs_doubleword_align (machine_mode mode, const_tree type)
6461
{
6465
{
6462
  if (!type)
6466
  if (!type)
6463
    return PARM_BOUNDARY < GET_MODE_ALIGNMENT (mode);
6467
    return GET_MODE_ALIGNMENT (mode) > PARM_BOUNDARY;
6464
6468
6465
  /* Scalar and vector types: Use natural alignment, i.e. of base type.  */
6469
  /* Scalar and vector types: Use natural alignment, i.e. of base type.  */
6466
  if (!AGGREGATE_TYPE_P (type))
6470
  if (!AGGREGATE_TYPE_P (type))
Lines 6470-6481 arm_needs_doubleword_align (machine_mode Link Here
6470
  if (TREE_CODE (type) == ARRAY_TYPE)
6474
  if (TREE_CODE (type) == ARRAY_TYPE)
6471
    return TYPE_ALIGN (TREE_TYPE (type)) > PARM_BOUNDARY;
6475
    return TYPE_ALIGN (TREE_TYPE (type)) > PARM_BOUNDARY;
6472
6476
6477
  int ret = 0;
6473
  /* Record/aggregate types: Use greatest member alignment of any member.  */ 
6478
  /* Record/aggregate types: Use greatest member alignment of any member.  */ 
6474
  for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
6479
  for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
6475
    if (DECL_ALIGN (field) > PARM_BOUNDARY)
6480
    if (DECL_ALIGN (field) > PARM_BOUNDARY)
6476
      return true;
6481
      {
6482
	if (TREE_CODE (field) == FIELD_DECL)
6483
	  return 1;
6484
	else
6485
	  /* Before PR77728 fix, we were incorrectly considering also
6486
	     other aggregate fields, like VAR_DECLs, TYPE_DECLs etc.
6487
	     Make sure we can warn about that with -Wpsabi.  */
6488
	  ret = -1;
6489
      }
6477
6490
6478
  return false;
6491
  return ret;
6479
}
6492
}
6480
6493
6481
6494
Lines 6532-6541 arm_function_arg (cumulative_args_t pcum Link Here
6532
    }
6545
    }
6533
6546
6534
  /* Put doubleword aligned quantities in even register pairs.  */
6547
  /* Put doubleword aligned quantities in even register pairs.  */
6535
  if (pcum->nregs & 1
6548
  if ((pcum->nregs & 1) && ARM_DOUBLEWORD_ALIGN)
6536
      && ARM_DOUBLEWORD_ALIGN
6549
    {
6537
      && arm_needs_doubleword_align (mode, type))
6550
      int res = arm_needs_doubleword_align (mode, type);
6538
    pcum->nregs++;
6551
      if (res < 0 && warn_psabi)
6552
	inform (input_location, "parameter passing for argument of type "
6553
		"%qT changed in GCC 7.1", type);
6554
      else if (res > 0)
6555
	pcum->nregs++;
6556
    }
6539
6557
6540
  /* Only allow splitting an arg between regs and memory if all preceding
6558
  /* Only allow splitting an arg between regs and memory if all preceding
6541
     args were allocated to regs.  For args passed by reference we only count
6559
     args were allocated to regs.  For args passed by reference we only count
Lines 6554-6562 arm_function_arg (cumulative_args_t pcum Link Here
6554
static unsigned int
6572
static unsigned int
6555
arm_function_arg_boundary (machine_mode mode, const_tree type)
6573
arm_function_arg_boundary (machine_mode mode, const_tree type)
6556
{
6574
{
6557
  return (ARM_DOUBLEWORD_ALIGN && arm_needs_doubleword_align (mode, type)
6575
  if (!ARM_DOUBLEWORD_ALIGN)
6558
	  ? DOUBLEWORD_ALIGNMENT
6576
    return PARM_BOUNDARY;
6559
	  : PARM_BOUNDARY);
6577
6578
  int res = arm_needs_doubleword_align (mode, type);
6579
  if (res < 0 && warn_psabi)
6580
    inform (input_location, "parameter passing for argument of type %qT "
6581
	    "changed in GCC 7.1", type);
6582
6583
  return res > 0 ? DOUBLEWORD_ALIGNMENT : PARM_BOUNDARY;
6560
}
6584
}
6561
6585
6562
static int
6586
static int
Lines 26516-26523 arm_setup_incoming_varargs (cumulative_a Link Here
26516
  if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
26540
  if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
26517
    {
26541
    {
26518
      nregs = pcum->aapcs_ncrn;
26542
      nregs = pcum->aapcs_ncrn;
26519
      if ((nregs & 1) && arm_needs_doubleword_align (mode, type))
26543
      if (nregs & 1)
26520
	nregs++;
26544
	{
26545
	  int res = arm_needs_doubleword_align (mode, type);
26546
	  if (res < 0 && warn_psabi)
26547
	    inform (input_location, "parameter passing for argument of "
26548
		    "type %qT changed in GCC 7.1", type);
26549
	  else if (res > 0)
26550
	    nregs++;
26551
	}
26521
    }
26552
    }
26522
  else
26553
  else
26523
    nregs = pcum->nregs;
26554
    nregs = pcum->nregs;

Return to bug 77728