aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/ASTContext.cpp2
-rw-r--r--lib/Basic/Targets.cpp5
-rw-r--r--lib/CodeGen/CodeGenModule.cpp1
-rw-r--r--lib/CodeGen/ItaniumCXXABI.cpp17
4 files changed, 19 insertions, 6 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 176aec53a2..b77977f7fd 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -651,6 +651,7 @@ CXXABI *ASTContext::createCXXABI(const TargetInfo &T) {
case TargetCXXABI::GenericARM:
case TargetCXXABI::iOS:
return CreateARMCXXABI(*this);
+ case TargetCXXABI::Emscripten: // Same as Itanium at this level
case TargetCXXABI::GenericAArch64: // Same as Itanium at this level
case TargetCXXABI::GenericItanium:
return CreateItaniumCXXABI(*this);
@@ -7940,6 +7941,7 @@ MangleContext *ASTContext::createMangleContext() {
case TargetCXXABI::GenericAArch64:
case TargetCXXABI::GenericItanium:
case TargetCXXABI::GenericARM:
+ case TargetCXXABI::Emscripten:
case TargetCXXABI::iOS:
return createItaniumMangleContext(*this, getDiagnostics());
case TargetCXXABI::Microsoft:
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index b56b42c798..93da96f897 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -270,6 +270,11 @@ public:
// beneficial.
this->UserLabelPrefix = "";
this->MaxAtomicPromoteWidth = this->MaxAtomicInlineWidth = 32;
+
+ // Emscripten uses the Itanium ABI mostly, but it uses ARM-style pointers
+ // to member functions so that it can avoid having to align function
+ // addresses.
+ this->TheCXXABI.set(TargetCXXABI::Emscripten);
}
};
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 0b03a3c4b6..15e4a50eaa 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -57,6 +57,7 @@ static CGCXXABI &createCXXABI(CodeGenModule &CGM) {
switch (CGM.getTarget().getCXXABI().getKind()) {
case TargetCXXABI::GenericAArch64:
case TargetCXXABI::GenericARM:
+ case TargetCXXABI::Emscripten:
case TargetCXXABI::iOS:
case TargetCXXABI::GenericItanium:
return *CreateItaniumCXXABI(CGM);
diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp
index 3767e4f278..1568284a7d 100644
--- a/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/lib/CodeGen/ItaniumCXXABI.cpp
@@ -231,18 +231,23 @@ CodeGen::CGCXXABI *CodeGen::CreateItaniumCXXABI(CodeGenModule &CGM) {
return new ItaniumCXXABI(CGM, /* UseARMMethodPtrABI = */ true,
/* UseARMGuardVarABI = */ true);
+ case TargetCXXABI::Emscripten:
+ // Use ARM-style method pointers so that generated code
+ // does not assume anything about the alignment of function
+ // pointers.
+ return new ItaniumCXXABI(CGM, /* UseARMMethodPtrABI = */ true,
+ /* UseARMGuardVarABI = */ false);
+
case TargetCXXABI::GenericItanium:
- switch (CGM.getContext().getTargetInfo().getTriple().getArch()) {
- case llvm::Triple::le32:
- case llvm::Triple::asmjs:
- // Use ARM-style method pointers so that generated code
+ if (CGM.getContext().getTargetInfo().getTriple().getArch()
+ == llvm::Triple::le32) {
+ // For PNaCl, use ARM-style method pointers so that PNaCl code
// does not assume anything about the alignment of function
// pointers.
return new ItaniumCXXABI(CGM, /* UseARMMethodPtrABI = */ true,
/* UseARMGuardVarABI = */ false);
- default:
- return new ItaniumCXXABI(CGM);
}
+ return new ItaniumCXXABI(CGM);
case TargetCXXABI::Microsoft:
llvm_unreachable("Microsoft ABI is not Itanium-based");