diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2015-11-25 09:24:26 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-11-25 09:24:26 +0000 |
commit | c99b04983b3e9030487e90989a08210d404459db (patch) | |
tree | 9dd8c128e9b51ab2a09f5a5535b4ee212bb05440 /clang/lib/Basic | |
parent | f83a2c2db26e7952c2d868f18ff103e2517c7ce3 (diff) | |
download | bcm5719-llvm-c99b04983b3e9030487e90989a08210d404459db.tar.gz bcm5719-llvm-c99b04983b3e9030487e90989a08210d404459db.zip |
[X86] Support for C calling convention only for MCU target.
For MCU only C calling convention is allowed, all other calling conventions are not supported.
Differential Revision: http://reviews.llvm.org/D14864
llvm-svn: 254063
Diffstat (limited to 'clang/lib/Basic')
-rw-r--r-- | clang/lib/Basic/Targets.cpp | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 697a9f232e0..4833379b356 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -3391,11 +3391,6 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, } if (CPU >= CK_i586) Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8"); - - if (getTriple().isOSIAMCU()) { - Builder.defineMacro("__iamcu"); - Builder.defineMacro("__iamcu__"); - } } bool X86TargetInfo::hasFeature(StringRef Feature) const { @@ -3644,11 +3639,6 @@ public: IntPtrType = SignedInt; RegParmMax = 3; - if (getTriple().isOSIAMCU()) { - LongDoubleWidth = 64; - LongDoubleFormat = &llvm::APFloat::IEEEdouble; - } - // Use fpret for all types. RealTypeUsesObjCFPRet = ((1 << TargetInfo::Float) | (1 << TargetInfo::Double) | @@ -3881,6 +3871,27 @@ public: } }; +// X86-32 MCU target +class MCUX86_32TargetInfo : public X86_32TargetInfo { +public: + MCUX86_32TargetInfo(const llvm::Triple &Triple) : X86_32TargetInfo(Triple) { + LongDoubleWidth = 64; + LongDoubleFormat = &llvm::APFloat::IEEEdouble; + } + + CallingConvCheckResult checkCallingConvention(CallingConv CC) const override { + // On MCU we support only C calling convention. + return CC == CC_C ? CCCR_OK : CCCR_Warning; + } + + void getTargetDefines(const LangOptions &Opts, + MacroBuilder &Builder) const override { + X86_32TargetInfo::getTargetDefines(Opts, Builder); + Builder.defineMacro("__iamcu"); + Builder.defineMacro("__iamcu__"); + } +}; + // RTEMS Target template<typename Target> class RTEMSTargetInfo : public OSTargetInfo<Target> { @@ -7769,6 +7780,8 @@ static TargetInfo *AllocateTarget(const llvm::Triple &Triple) { return new RTEMSX86_32TargetInfo(Triple); case llvm::Triple::NaCl: return new NaClTargetInfo<X86_32TargetInfo>(Triple); + case llvm::Triple::ELFIAMCU: + return new MCUX86_32TargetInfo(Triple); default: return new X86_32TargetInfo(Triple); } |