diff options
author | Dan Gohman <sunfish@mozilla.com> | 2014-04-25 15:51:06 -0700 |
---|---|---|
committer | Dan Gohman <sunfish@mozilla.com> | 2014-04-25 15:51:06 -0700 |
commit | ad32fdb927a37dba26cb8b56f3a6b11667fe6584 (patch) | |
tree | bc20982c69cde047d94c9a11b5a50e1d9d6545eb /lib/CodeGen/ItaniumCXXABI.cpp | |
parent | 926efa5d923dfd9555270a2bbb156bc30ce35fc9 (diff) |
Introduce an Emscripten C++ ABI.
Emscripten uses the Itanium C++ ABI for most things, except that it uses
ARM C++ ABI pointers to member functions, to avoid the overhead of aligning
functions.
Diffstat (limited to 'lib/CodeGen/ItaniumCXXABI.cpp')
-rw-r--r-- | lib/CodeGen/ItaniumCXXABI.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
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"); |