diff options
author | Simon Atanasyan <simon@atanasyan.com> | 2019-02-13 18:27:09 +0000 |
---|---|---|
committer | Simon Atanasyan <simon@atanasyan.com> | 2019-02-13 18:27:09 +0000 |
commit | 4c22a574140c799117d340d803c2ae0468ca3b86 (patch) | |
tree | a9533b18f4aeadb4c8188b77c815c9ad797f5ef5 /clang/lib/Basic/Targets/Mips.cpp | |
parent | 430d294f0b845c6fee710f5b5c33008ebe06ec69 (diff) | |
download | bcm5719-llvm-4c22a574140c799117d340d803c2ae0468ca3b86.tar.gz bcm5719-llvm-4c22a574140c799117d340d803c2ae0468ca3b86.zip |
[Headers][mips] Add `__attribute__((__mode__(__unwind_word__)))` to the _Unwind_Word / _Unwind_SWord definitions
The rationale of this change is to fix _Unwind_Word / _Unwind_SWord
definitions for MIPS N32 ABI. This ABI uses 32-bit pointers,
but _Unwind_Word and _Unwind_SWord types are eight bytes long.
# The __attribute__((__mode__(__unwind_word__))) is added to the type
definitions. It makes them equal to the corresponding definitions used
by GCC and allows to override types using `getUnwindWordWidth` function.
# The `getUnwindWordWidth` virtual function override in the `MipsTargetInfo`
class and provides correct type size values.
Differential revision: https://reviews.llvm.org/D58165
llvm-svn: 353965
Diffstat (limited to 'clang/lib/Basic/Targets/Mips.cpp')
-rw-r--r-- | clang/lib/Basic/Targets/Mips.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets/Mips.cpp b/clang/lib/Basic/Targets/Mips.cpp index 840ad1bc627..2cafbe87a99 100644 --- a/clang/lib/Basic/Targets/Mips.cpp +++ b/clang/lib/Basic/Targets/Mips.cpp @@ -215,6 +215,14 @@ ArrayRef<Builtin::Info> MipsTargetInfo::getTargetBuiltins() const { Builtin::FirstTSBuiltin); } +unsigned MipsTargetInfo::getUnwindWordWidth() const { + return llvm::StringSwitch<unsigned>(ABI) + .Case("o32", 32) + .Case("n32", 64) + .Case("n64", 64) + .Default(getPointerWidth(0)); +} + bool MipsTargetInfo::validateTarget(DiagnosticsEngine &Diags) const { // microMIPS64R6 backend was removed. if (getTriple().isMIPS64() && IsMicromips && (ABI == "n32" || ABI == "n64")) { |