From c2a644391b7e8d4603d95e97daabd1b368052421 Mon Sep 17 00:00:00 2001 From: Paul Brook Date: Wed, 29 Mar 2006 15:21:13 +0000 Subject: re PR middle-end/23623 (volatile keyword changes bitfield access size from 32bit to 8bit) 2006-03-29 Paul Brook PR middle-end/23623 * targhooks.c (default_narrow_bitfield): New fuction. * targhooks.h (default_narrow_bitfield): add prototype. * target.h (gcc_target): Add narrow_volatile_bitfield. * target-def.h (TARGET_NARROW_VOLATILE_BITFIELD): Define. * stor-layout.c (get_best_mode): Use targetm.narrow_volatile_bitfield. * doc/tm.texi: Document TARGET_NARROW_VOLATILE_BITFIELDS. * config/arm/arm.c (TARGET_NARROW_VOLATILE_BITFIELD): Define. From-SVN: r112493 --- gcc/stor-layout.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'gcc/stor-layout.c') diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index caf176f..5617d27 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -2148,13 +2148,17 @@ fixup_unsigned_type (tree type) If LARGEST_MODE is not VOIDmode, it means that we should not use a mode larger than LARGEST_MODE (usually SImode). - If no mode meets all these conditions, we return VOIDmode. Otherwise, if - VOLATILEP is true or SLOW_BYTE_ACCESS is false, we return the smallest - mode meeting these conditions. - - Otherwise (VOLATILEP is false and SLOW_BYTE_ACCESS is true), we return - the largest mode (but a mode no wider than UNITS_PER_WORD) that meets - all the conditions. */ + If no mode meets all these conditions, we return VOIDmode. + + If VOLATILEP is false and SLOW_BYTE_ACCESS is false, we return the + smallest mode meeting these conditions. + + If VOLATILEP is false and SLOW_BYTE_ACCESS is true, we return the + largest mode (but a mode no wider than UNITS_PER_WORD) that meets + all the conditions. + + If VOLATILEP is true the narrow_volatile_bitfields target hook is used to + decide which of the above modes should be used. */ enum machine_mode get_best_mode (int bitsize, int bitpos, unsigned int align, @@ -2184,7 +2188,8 @@ get_best_mode (int bitsize, int bitpos, unsigned int align, || (largest_mode != VOIDmode && unit > GET_MODE_BITSIZE (largest_mode))) return VOIDmode; - if (SLOW_BYTE_ACCESS && ! volatilep) + if ((SLOW_BYTE_ACCESS && ! volatilep) + || (volatilep && !targetm.narrow_volatile_bitfield())) { enum machine_mode wide_mode = VOIDmode, tmode; -- cgit v1.1