Move the decision about the kind of CGCXXABI to make inside

the family-specific files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173530 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
John McCall 2013-01-25 23:36:14 +00:00
Родитель 188bdcd1aa
Коммит 96fcde0b8e
3 изменённых файлов: 24 добавлений и 12 удалений

Просмотреть файл

@ -296,9 +296,12 @@ public:
llvm::Constant *addr);
};
/// Creates an instance of a C++ ABI class.
CGCXXABI *CreateARMCXXABI(CodeGenModule &CGM);
// Create an instance of a C++ ABI class:
/// Creates an Itanium-family ABI.
CGCXXABI *CreateItaniumCXXABI(CodeGenModule &CGM);
/// Creates a Microsoft-family ABI.
CGCXXABI *CreateMicrosoftCXXABI(CodeGenModule &CGM);
}

Просмотреть файл

@ -53,12 +53,12 @@ static const char AnnotationSection[] = "llvm.metadata";
static CGCXXABI &createCXXABI(CodeGenModule &CGM) {
switch (CGM.getContext().getTargetInfo().getCXXABI().getKind()) {
// For IR-generation purposes, there's no significant difference
// between the ARM and iOS ABIs.
case TargetCXXABI::GenericARM: return *CreateARMCXXABI(CGM);
case TargetCXXABI::iOS: return *CreateARMCXXABI(CGM);
case TargetCXXABI::GenericItanium: return *CreateItaniumCXXABI(CGM);
case TargetCXXABI::Microsoft: return *CreateMicrosoftCXXABI(CGM);
case TargetCXXABI::GenericARM:
case TargetCXXABI::iOS:
case TargetCXXABI::GenericItanium:
return *CreateItaniumCXXABI(CGM);
case TargetCXXABI::Microsoft:
return *CreateMicrosoftCXXABI(CGM);
}
llvm_unreachable("invalid C++ ABI kind");

Просмотреть файл

@ -174,11 +174,20 @@ private:
}
CodeGen::CGCXXABI *CodeGen::CreateItaniumCXXABI(CodeGenModule &CGM) {
return new ItaniumCXXABI(CGM);
}
switch (CGM.getContext().getTargetInfo().getCXXABI().getKind()) {
// For IR-generation purposes, there's no significant difference
// between the ARM and iOS ABIs.
case TargetCXXABI::GenericARM:
case TargetCXXABI::iOS:
return new ARMCXXABI(CGM);
CodeGen::CGCXXABI *CodeGen::CreateARMCXXABI(CodeGenModule &CGM) {
return new ARMCXXABI(CGM);
case TargetCXXABI::GenericItanium:
return new ItaniumCXXABI(CGM);
case TargetCXXABI::Microsoft:
llvm_unreachable("Microsoft ABI is not Itanium-based");
}
llvm_unreachable("bad ABI kind");
}
llvm::Type *