This is the mail archive of the 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] Introduce abi_word_mode

Geoffrey Keating wrote:
"Ulrich Weigand" <> writes:

The GCC middle end has the notion of a "word", which is somewhat vaguely
defined as "the natural mode of a general-purpose register".

On the other hand, for better or worse, GCC has made this internal detail
available at a source code level via attribute ((mode (word))).

I think this is an excellent argument for deprecating and removing attribute((mode(word))).


I agree with Richard that defining the ABI word mode to be the mode of attribute((mode(word))) is inherently cyclic. I think that what Ulrich is trying to do changes the meaning of attribute ((mode (word))), which inherently exposes a machine-specific detail: the width of actual registers on the machine. The intent is that you can declare variables of this type and that they will nicely fit in registers. (I suppose that this is intended to be used if "int" does not make full use of the register width.)

I'd argue that a program which uses word mode in a context that matters for the ABI is broken, if that program is intended to be used on multiple CPUs. SImode is always the same width, "int" is always the same width, but "word" is a property of the CPU. That argument aside, I understand where you're coming from: you want to preserve source compatibility, but use the 64-bit registers. Have any other ports ever tried to do this? I thought that there were PowerPC configurations that used 64-bit registers with the 32-bit ABI; what do they do?

I agree with Geoff that this is an attribute we could do without, though I don't know how practical it is to remove it. Whatever you can do with "word" mode, you can also do with "int" on 90% of all platforms, and with a teeny bit of autoconf on the remainder.

Mark Mitchell
(650) 331-3385 x713

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