@@ -835,20 +835,30 @@ class LLVM_LIBRARY_VISIBILITY UEFIX86_64TargetInfo
835835public:
836836 UEFIX86_64TargetInfo (const llvm::Triple &Triple, const TargetOptions &Opts)
837837 : UEFITargetInfo<X86_64TargetInfo>(Triple, Opts) {
838- LongWidth = LongAlign = 32 ;
839- DoubleAlign = LongLongAlign = 64 ;
838+ this ->setABIDefaults ();
839+ this ->resetDataLayout (" e-m:w-p270:32:32-p271:32:32-p272:64:64-"
840+ " i64:64-i128:128-f80:128-n8:16:32:64-S128" );
841+ }
842+
843+ // The UEFI spec does not mandate specific C++ ABI, integer widths, or
844+ // alignment. We are setting these defaults to match the Windows target as it
845+ // is the only way to build EFI applications with Clang/LLVM today. We intend
846+ // to offer flexibility by supporting choices that are not default in Windows
847+ // target in the future.
848+ void setABIDefaults () {
849+ // Set C++ ABI.
850+ this ->TheCXXABI .set (TargetCXXABI::Microsoft);
851+ // Set Integer types and alignment.
840852 IntMaxType = SignedLongLong;
841853 Int64Type = SignedLongLong;
842854 SizeType = UnsignedLongLong;
843855 PtrDiffType = SignedLongLong;
844856 IntPtrType = SignedLongLong;
845- LongDoubleWidth = LongDoubleAlign = 64 ;
846- LongDoubleFormat = &llvm::APFloat::IEEEdouble ();
847857 WCharType = UnsignedShort;
848858 WIntType = UnsignedShort;
849- this -> TheCXXABI . set (TargetCXXABI::Microsoft) ;
850- this -> resetDataLayout ( " e-m:w-p270:32:32-p271:32:32-p272:64:64- "
851- " i64:64-i128:128-f80:128-n8:16:32:64-S128 " ) ;
859+ LongWidth = LongAlign = 32 ;
860+ DoubleAlign = LongLongAlign = 64 ;
861+ LongDoubleWidth = LongDoubleAlign = 64 ;
852862 }
853863
854864 CallingConvCheckResult checkCallingConvention (CallingConv CC) const override {
0 commit comments