Skip to content

Commit 8f9ef6d

Browse files
committed
Remove floating point related target defaults. Add comments.
1 parent 0e51347 commit 8f9ef6d

File tree

1 file changed

+17
-7
lines changed
  • clang/lib/Basic/Targets

1 file changed

+17
-7
lines changed

clang/lib/Basic/Targets/X86.h

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -835,20 +835,30 @@ class LLVM_LIBRARY_VISIBILITY UEFIX86_64TargetInfo
835835
public:
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

Comments
 (0)