aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt6
-rw-r--r--emscripten-version.txt2
-rw-r--r--lib/Basic/Targets.cpp6
-rw-r--r--lib/CodeGen/TargetInfo.cpp28
4 files changed, 23 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5d05a4cdb5..bcd5c52578 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -290,10 +290,10 @@ option(CLANG_INCLUDE_TESTS
"Generate build targets for the Clang unit tests."
${LLVM_INCLUDE_TESTS})
-# TODO: docs.
-add_subdirectory(test)
-
if( CLANG_INCLUDE_TESTS )
+ # TODO: docs.
+ add_subdirectory(test) # XXX Emscripten: Backport fix from upstream LLVM 3.4 to actually skip tests if CLANG_INCLUDE_TESTS = OFF
+
add_subdirectory(unittests)
endif()
diff --git a/emscripten-version.txt b/emscripten-version.txt
new file mode 100644
index 0000000000..f488f67e2a
--- /dev/null
+++ b/emscripten-version.txt
@@ -0,0 +1,2 @@
+1.16.0
+
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 43a21f2734..b56b42c798 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -269,6 +269,7 @@ public:
// handled outside of clang. TODO: Handling this within clang may be
// beneficial.
this->UserLabelPrefix = "";
+ this->MaxAtomicPromoteWidth = this->MaxAtomicInlineWidth = 32;
}
};
@@ -5102,8 +5103,11 @@ public:
// the direction suggested here:
// https://bugzilla.mozilla.org/show_bug.cgi?id=904913#c21
// We can still set the preferred alignment to 16 bytes though.
+ //
+ // Set the natural stack alignment to 16 bytes to accomodate 128-bit
+ // aligned vectors.
DescriptionString = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"
- "f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32";
+ "f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128";
}
void getDefaultFeatures(llvm::StringMap<bool> &Features) const {
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);
}