MaskRay updated this revision to Diff 208399. MaskRay edited the summary of this revision. MaskRay added a comment.
getMangledTypeOfLongDouble -> getLongDoubleMangling as erichkeane suggested. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64276/new/ https://reviews.llvm.org/D64276 Files: include/clang/Basic/TargetInfo.h lib/AST/ItaniumMangle.cpp lib/Basic/Targets/PPC.h lib/Basic/Targets/SystemZ.h lib/Basic/Targets/X86.h test/CodeGenCXX/float128-declarations.cpp
Index: test/CodeGenCXX/float128-declarations.cpp =================================================================== --- test/CodeGenCXX/float128-declarations.cpp +++ test/CodeGenCXX/float128-declarations.cpp @@ -84,15 +84,15 @@ // CHECK-DAG: @_ZN12_GLOBAL__N_13f2nE = internal global fp128 0xL00000000000000004004080000000000 // CHECK-DAG: @_ZN12_GLOBAL__N_15arr1nE = internal global [10 x fp128] // CHECK-DAG: @_ZN12_GLOBAL__N_15arr2nE = internal global [3 x fp128] [fp128 0xL33333333333333333FFF333333333333, fp128 0xL00000000000000004000800000000000, fp128 0xL00000000000000004025176592E00000] -// CHECK-DAG: define internal fp128 @_ZN12_GLOBAL__N_16func1nERKU10__float128(fp128* +// CHECK-DAG: define internal fp128 @_ZN12_GLOBAL__N_16func1nERKu9__ieee128(fp128* // CHECK-DAG: @f1f = global fp128 0xL00000000000000000000000000000000 // CHECK-DAG: @f2f = global fp128 0xL33333333333333334004033333333333 // CHECK-DAG: @arr1f = global [10 x fp128] // CHECK-DAG: @arr2f = global [3 x fp128] [fp128 0xL3333333333333333BFFF333333333333, fp128 0xL0000000000000000C000800000000000, fp128 0xL0000000000000000C025176592E00000] -// CHECK-DAG: declare fp128 @_Z6func1fU10__float128(fp128) -// CHECK-DAG: define linkonce_odr void @_ZN2C1C2EU10__float128(%class.C1* %this, fp128 %arg) -// CHECK-DAG: define linkonce_odr fp128 @_ZN2C16func2cEU10__float128(fp128 %arg) -// CHECK-DAG: define linkonce_odr fp128 @_Z6func1tIU10__float128ET_S0_(fp128 %arg) +// CHECK-DAG: declare fp128 @_Z6func1fu9__ieee128(fp128) +// CHECK-DAG: define linkonce_odr void @_ZN2C1C2Eu9__ieee128(%class.C1* %this, fp128 %arg) +// CHECK-DAG: define linkonce_odr fp128 @_ZN2C16func2cEu9__ieee128(fp128 %arg) +// CHECK-DAG: define linkonce_odr fp128 @_Z6func1tIu9__ieee128ET_S0_(fp128 %arg) // CHECK-DAG: @__const.main.s1 = private unnamed_addr constant %struct.S1 { fp128 0xL00000000000000004006080000000000 } // CHECK-DAG: store fp128 0xLF0AFD0EBFF292DCE42E0B38CDD83F26F, fp128* %f1l, align 16 // CHECK-DAG: store fp128 0xL00000000000000008000000000000000, fp128* %f2l, align 16 Index: lib/Basic/Targets/X86.h =================================================================== --- lib/Basic/Targets/X86.h +++ lib/Basic/Targets/X86.h @@ -848,7 +848,7 @@ LongDoubleFormat = &llvm::APFloat::IEEEquad(); } - bool useFloat128ManglingForLongDouble() const override { return true; } + const char *getLongDoubleMangling() const override { return "g"; } }; } // namespace targets } // namespace clang Index: lib/Basic/Targets/SystemZ.h =================================================================== --- lib/Basic/Targets/SystemZ.h +++ lib/Basic/Targets/SystemZ.h @@ -141,7 +141,7 @@ return ""; } - bool useFloat128ManglingForLongDouble() const override { return true; } + const char *getLongDoubleMangling() const override { return "g"; } }; } // namespace targets } // namespace clang Index: lib/Basic/Targets/PPC.h =================================================================== --- lib/Basic/Targets/PPC.h +++ lib/Basic/Targets/PPC.h @@ -314,11 +314,14 @@ bool hasSjLjLowering() const override { return true; } - bool useFloat128ManglingForLongDouble() const override { - return LongDoubleWidth == 128 && - LongDoubleFormat == &llvm::APFloat::PPCDoubleDouble() && - getTriple().isOSBinFormatELF(); + const char *getLongDoubleMangling() const override { + if (LongDoubleWidth == 64) + return "e"; + return LongDoubleFormat == &llvm::APFloat::PPCDoubleDouble() + ? "g" + : "u9__ieee128"; } + const char *getFloat128Mangling() const override { return "u9__ieee128"; } }; class LLVM_LIBRARY_VISIBILITY PPC32TargetInfo : public PPCTargetInfo { Index: lib/AST/ItaniumMangle.cpp =================================================================== --- lib/AST/ItaniumMangle.cpp +++ lib/AST/ItaniumMangle.cpp @@ -2608,30 +2608,19 @@ 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: Index: include/clang/Basic/TargetInfo.h =================================================================== --- include/clang/Basic/TargetInfo.h +++ include/clang/Basic/TargetInfo.h @@ -599,9 +599,11 @@ return *Float128Format; } - /// Return true if the 'long double' type should be mangled like - /// __float128. - virtual bool useFloat128ManglingForLongDouble() const { return false; } + /// Return the mangled code of long double. + virtual const char *getLongDoubleMangling() const { return "e"; } + + /// Return the mangled code of __float128. + virtual const char *getFloat128Mangling() const { return "g"; } /// Return the value for the C99 FLT_EVAL_METHOD macro. virtual unsigned getFloatEvalMethod() const { return 0; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits