[WebAssembly] Initial WebAssembly support in clang
This implements basic support for compiling (though not yet assembling or linking) for a WebAssembly target. Note that ABI details are not yet finalized, and may change. Differential Revision: http://reviews.llvm.org/D12002 llvm-svn: 246814
This commit is contained in:
@@ -66,6 +66,7 @@ static CGCXXABI *createCXXABI(CodeGenModule &CGM) {
|
||||
case TargetCXXABI::iOS64:
|
||||
case TargetCXXABI::GenericMIPS:
|
||||
case TargetCXXABI::GenericItanium:
|
||||
case TargetCXXABI::WebAssembly:
|
||||
return CreateItaniumCXXABI(CGM);
|
||||
case TargetCXXABI::Microsoft:
|
||||
return CreateMicrosoftCXXABI(CGM);
|
||||
@@ -819,9 +820,14 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
|
||||
if (alignment)
|
||||
F->setAlignment(alignment);
|
||||
|
||||
// C++ ABI requires 2-byte alignment for member functions.
|
||||
if (F->getAlignment() < 2 && isa<CXXMethodDecl>(D))
|
||||
F->setAlignment(2);
|
||||
// Some C++ ABIs require 2-byte alignment for member functions, in order to
|
||||
// reserve a bit for differentiating between virtual and non-virtual member
|
||||
// functions. If the current target's C++ ABI requires this and this is a
|
||||
// member function, set its alignment accordingly.
|
||||
if (getTarget().getCXXABI().areMemberFunctionsAligned()) {
|
||||
if (F->getAlignment() < 2 && isa<CXXMethodDecl>(D))
|
||||
F->setAlignment(2);
|
||||
}
|
||||
}
|
||||
|
||||
void CodeGenModule::SetCommonAttributes(const Decl *D,
|
||||
|
||||
Reference in New Issue
Block a user