diff options
author | Michael Kuperstein <michael.m.kuperstein@intel.com> | 2015-10-19 08:09:43 +0000 |
---|---|---|
committer | Michael Kuperstein <michael.m.kuperstein@intel.com> | 2015-10-19 08:09:43 +0000 |
commit | b1ec50d56a53824a4b38cf81e17927e4c408d4a2 (patch) | |
tree | 2e565d99bc924e84552b415d463bb2bd4de3119e /clang/lib/CodeGen/TargetInfo.cpp | |
parent | ea6a835f4eefa6d9dc6c0d2210bc0ab973f44f78 (diff) | |
download | bcm5719-llvm-b1ec50d56a53824a4b38cf81e17927e4c408d4a2.tar.gz bcm5719-llvm-b1ec50d56a53824a4b38cf81e17927e4c408d4a2.zip |
[X86] Enable soft float ABI for x86
The Intel MCU psABI requires floating-point values to be passed in-reg.
This makes the x86-32 ABI code respect "-mfloat-abi soft" and generate float inreg arguments.
Differential Revision: http://reviews.llvm.org/D13554
llvm-svn: 250689
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 0411bb54485..4b31a1355ee 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -798,6 +798,7 @@ class X86_32ABIInfo : public ABIInfo { bool IsDarwinVectorABI; bool IsRetSmallStructInRegABI; bool IsWin32StructABI; + bool IsSoftFloatABI; unsigned DefaultNumRegisterParameters; static bool isRegisterSize(unsigned Size) { @@ -847,21 +848,22 @@ public: X86_32ABIInfo(CodeGen::CodeGenTypes &CGT, bool DarwinVectorABI, bool RetSmallStructInRegABI, bool Win32StructABI, - unsigned NumRegisterParameters) + unsigned NumRegisterParameters, bool SoftFloatABI) : ABIInfo(CGT), IsDarwinVectorABI(DarwinVectorABI), IsRetSmallStructInRegABI(RetSmallStructInRegABI), IsWin32StructABI(Win32StructABI), - DefaultNumRegisterParameters(NumRegisterParameters) {} + DefaultNumRegisterParameters(NumRegisterParameters), + IsSoftFloatABI(SoftFloatABI) {} }; class X86_32TargetCodeGenInfo : public TargetCodeGenInfo { public: X86_32TargetCodeGenInfo(CodeGen::CodeGenTypes &CGT, bool DarwinVectorABI, bool RetSmallStructInRegABI, bool Win32StructABI, - unsigned NumRegisterParameters) - : TargetCodeGenInfo( - new X86_32ABIInfo(CGT, DarwinVectorABI, RetSmallStructInRegABI, - Win32StructABI, NumRegisterParameters)) {} + unsigned NumRegisterParameters, bool SoftFloatABI) + : TargetCodeGenInfo(new X86_32ABIInfo( + CGT, DarwinVectorABI, RetSmallStructInRegABI, Win32StructABI, + NumRegisterParameters, SoftFloatABI)) {} static bool isStructReturnInRegABI( const llvm::Triple &Triple, const CodeGenOptions &Opts); @@ -1212,9 +1214,11 @@ X86_32ABIInfo::Class X86_32ABIInfo::classify(QualType Ty) const { bool X86_32ABIInfo::shouldUseInReg(QualType Ty, CCState &State, bool &NeedsPadding) const { NeedsPadding = false; - Class C = classify(Ty); - if (C == Float) - return false; + if (!IsSoftFloatABI) { + Class C = classify(Ty); + if (C == Float) + return false; + } unsigned Size = getContext().getTypeSize(Ty); unsigned SizeInRegs = (Size + 31) / 32; @@ -1885,7 +1889,7 @@ public: bool DarwinVectorABI, bool RetSmallStructInRegABI, bool Win32StructABI, unsigned NumRegisterParameters) : X86_32TargetCodeGenInfo(CGT, DarwinVectorABI, RetSmallStructInRegABI, - Win32StructABI, NumRegisterParameters) {} + Win32StructABI, NumRegisterParameters, false) {} void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &CGM) const override; @@ -7397,7 +7401,8 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() { } else { return *(TheTargetCodeGenInfo = new X86_32TargetCodeGenInfo( Types, IsDarwinVectorABI, RetSmallStructInRegABI, - IsWin32FloatStructABI, CodeGenOpts.NumRegisterParameters)); + IsWin32FloatStructABI, CodeGenOpts.NumRegisterParameters, + CodeGenOpts.FloatABI == "soft")); } } |