diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-04-16 11:06:30 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-04-16 11:06:30 -0700 |
commit | 9596f4e867095c9f1741601615a8d2bcb097772e (patch) | |
tree | a0c9f7f077ee8226c38fd9540c61bd4738d41a3b /lib/CodeGen/TargetInfo.cpp | |
parent | 51c484d755eec70ebb2c4592cef61131e00bcb44 (diff) | |
parent | 926efa5d923dfd9555270a2bbb156bc30ce35fc9 (diff) |
Merge branch 'incoming'1.16.0
Diffstat (limited to 'lib/CodeGen/TargetInfo.cpp')
-rw-r--r-- | lib/CodeGen/TargetInfo.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index 5aa982e255..196596d40a 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -421,31 +421,33 @@ class EmscriptenABIInfo : public DefaultABIInfo { explicit EmscriptenABIInfo(CodeGen::CodeGenTypes &CGT) : DefaultABIInfo(CGT) {} ABIArgInfo classifyReturnType(QualType RetTy) const; - ABIArgInfo classifyArgumentType(QualType RetTy) const; + ABIArgInfo classifyArgumentType(QualType Ty) const; + + // DefaultABIInfo's classifyReturnType and classifyArgumentType are + // non-virtual, but computeInfo is virtual, so we overload that. + virtual void computeInfo(CGFunctionInfo &FI) const { + FI.getReturnInfo() = classifyReturnType(FI.getReturnType()); + for (CGFunctionInfo::arg_iterator it = FI.arg_begin(), ie = FI.arg_end(); + it != ie; ++it) + it->info = classifyArgumentType(it->type); + } }; class EmscriptenTargetCodeGenInfo : public TargetCodeGenInfo { public: explicit EmscriptenTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT) : TargetCodeGenInfo(new EmscriptenABIInfo(CGT)) {} - - // TODO: Re-evaluate whether these hacks, borrowed from PNaCl, are necessary. - bool addAsmMemoryAroundSyncSynchronize() const { return true; } - bool asmMemoryIsFence() const { return true; } }; /// \brief Classify argument of given type \p Ty. ABIArgInfo EmscriptenABIInfo::classifyArgumentType(QualType Ty) const { if (isAggregateTypeForABI(Ty)) { + unsigned TypeAlign = getContext().getTypeAlignInChars(Ty).getQuantity(); if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, CGT)) - return ABIArgInfo::getIndirect(0, RAA == CGCXXABI::RAA_DirectInMemory); - return ABIArgInfo::getIndirect(0); + return ABIArgInfo::getIndirect(TypeAlign, RAA == CGCXXABI::RAA_DirectInMemory); + return ABIArgInfo::getIndirect(TypeAlign); } - // We can handle floating-point values directly. - if (Ty->isFloatingType()) - return ABIArgInfo::getDirect(); - // Otherwise just do the default thing. return DefaultABIInfo::classifyArgumentType(Ty); } @@ -458,10 +460,6 @@ ABIArgInfo EmscriptenABIInfo::classifyReturnType(QualType RetTy) const { return ABIArgInfo::getDirect(CGT.ConvertType(QualType(SeltTy, 0))); } - // We can handle floating-point values directly. - if (RetTy->isFloatingType()) - return ABIArgInfo::getDirect(); - // Otherwise just do the default thing. return DefaultABIInfo::classifyReturnType(RetTy); } |