Fix attribute((mode([word|unwind_word]))) for x32
authorReid Kleckner <rnk@google.com>
Mon, 1 Feb 2016 18:58:24 +0000 (18:58 +0000)
committerReid Kleckner <rnk@google.com>
Mon, 1 Feb 2016 18:58:24 +0000 (18:58 +0000)
commitf27e752fe888f8a8fd38d7e65854f57040a13160
tree46991c185e2f6dd0087d3f0640fefdcef43a08fc
parentc8620dfd270c504a8e0b5159c937e875179217f9
Fix attribute((mode([word|unwind_word]))) for x32

Patch by H.J. Lu

```
typedef unsigned int gcc_word __attribute__((mode(word)));
```
and

```
typedef unsigned int gcc_unwind_word __attribute__((mode(unwind_word)));
```
define the largest unsigned integer types which can be stored in a
general purpose register, which may not be the pointer type.  For x32,
they aren't pointer nor unsigned long.  We should

1. Make getUnwindWordWidth and getRegisterWidth virtual,
2. Override them for x32, similar to hasInt128Type.
3. Use getRegisterWidth for __attribute__((mode(word)));

This fixes PR 24706.

Reviewers: rnk

Differential Revision: http://reviews.llvm.org/D16779

llvm-svn: 259383
clang/include/clang/Basic/TargetInfo.h
clang/lib/Basic/Targets.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/Sema/attr-mode.c