diff options
author | Fangrui Song <maskray@google.com> | 2019-07-09 13:32:26 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-07-09 13:32:26 +0000 |
commit | 04615341e48152ab8c3c17b368a14b155b5ffe34 (patch) | |
tree | e3f5f4cfeac9e5a57ef192280c5b87b736a22104 /clang/lib/AST/ItaniumMangle.cpp | |
parent | 51dad4196e58131c2c9df9e1eb4302b4c637aff5 (diff) | |
download | bcm5719-llvm-04615341e48152ab8c3c17b368a14b155b5ffe34.tar.gz bcm5719-llvm-04615341e48152ab8c3c17b368a14b155b5ffe34.zip |
[ItaniumMangle] Refactor long double/__float128 mangling and fix the mangled code
In gcc PowerPC, long double has 3 mangling schemes:
-mlong-double-64: `e`
-mlong-double-128 -mabi=ibmlongdouble: `g`
-mlong-double-128 -mabi=ieeelongdouble: `u9__ieee128` (gcc <= 8.1: `U10__float128`)
The current useFloat128ManglingForLongDouble() bisection is not suitable
when we support -mlong-double-128 in clang (D64277). Replace
useFloat128ManglingForLongDouble() with getLongDoubleMangling() and
getFloat128Mangling() to allow 3 mangling schemes.
I also deleted the `getTriple().isOSBinFormatELF()` check (the Darwin
support has gone: https://reviews.llvm.org/D50988).
For x86, change the mangled code of __float128 from `U10__float128` to `g`. `U10__float128` was wrongly copied from PowerPC.
The test will be added to `test/CodeGen/x86-long-double.cpp` in D64277.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D64276
llvm-svn: 365480
Diffstat (limited to 'clang/lib/AST/ItaniumMangle.cpp')
-rw-r--r-- | clang/lib/AST/ItaniumMangle.cpp | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index 99556a6e70d..5f4644b0f7c 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -2608,30 +2608,19 @@ void CXXNameMangler::mangleType(const BuiltinType *T) { Out << 'd'; break; case BuiltinType::LongDouble: { - bool UseFloat128Mangling = - getASTContext().getTargetInfo().useFloat128ManglingForLongDouble(); - if (getASTContext().getLangOpts().OpenMP && - getASTContext().getLangOpts().OpenMPIsDevice) { - UseFloat128Mangling = getASTContext() - .getAuxTargetInfo() - ->useFloat128ManglingForLongDouble(); - } - Out << (UseFloat128Mangling ? 'g' : 'e'); + const TargetInfo *TI = getASTContext().getLangOpts().OpenMP && + getASTContext().getLangOpts().OpenMPIsDevice + ? getASTContext().getAuxTargetInfo() + : &getASTContext().getTargetInfo(); + Out << TI->getLongDoubleMangling(); break; } case BuiltinType::Float128: { - bool UseFloat128Mangling = - getASTContext().getTargetInfo().useFloat128ManglingForLongDouble(); - if (getASTContext().getLangOpts().OpenMP && - getASTContext().getLangOpts().OpenMPIsDevice) { - UseFloat128Mangling = getASTContext() - .getAuxTargetInfo() - ->useFloat128ManglingForLongDouble(); - } - if (UseFloat128Mangling) - Out << "U10__float128"; // Match the GCC mangling - else - Out << 'g'; + const TargetInfo *TI = getASTContext().getLangOpts().OpenMP && + getASTContext().getLangOpts().OpenMPIsDevice + ? getASTContext().getAuxTargetInfo() + : &getASTContext().getTargetInfo(); + Out << TI->getFloat128Mangling(); break; } case BuiltinType::NullPtr: |