This revision was automatically updated to reflect the committed changes.
Closed by commit rG8bee52bdb54a: [AIX][Frontend] C++ ABI customizations for AIX
boilerplate (authored by Xiangling_L).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74015/new/
https://reviews.llvm.org/D74015
Files:
clang/include/clang/Basic/TargetCXXABI.h
clang/lib/AST/ASTContext.cpp
clang/lib/Basic/Targets/OSTargets.h
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/test/CodeGen/static-init.cpp
Index: clang/test/CodeGen/static-init.cpp
===================================================================
--- /dev/null
+++ clang/test/CodeGen/static-init.cpp
@@ -0,0 +1,12 @@
+// RUN: not %clang_cc1 -triple powerpc-ibm-aix-xcoff -S -emit-llvm -x c++ %s \
+// RUN: 2>&1 | FileCheck %s
+
+// RUN: not %clang_cc1 -triple powerpc64-ibm-aix-xcoff -S -emit-llvm -x c++ %s \
+// RUN: 2>&1 | FileCheck %s
+
+struct test {
+ test();
+ ~test();
+} t;
+
+// CHECK: error in backend: Static initialization has not been implemented on XL ABI yet.
Index: clang/lib/CodeGen/ItaniumCXXABI.cpp
===================================================================
--- clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -516,6 +516,16 @@
}
bool canCallMismatchedFunctionType() const override { return false; }
};
+
+class XLCXXABI final : public ItaniumCXXABI {
+public:
+ explicit XLCXXABI(CodeGen::CodeGenModule &CGM)
+ : ItaniumCXXABI(CGM) {}
+
+ void registerGlobalDtor(CodeGenFunction &CGF, const VarDecl &D,
+ llvm::FunctionCallee dtor,
+ llvm::Constant *addr) override;
+};
}
CodeGen::CGCXXABI *CodeGen::CreateItaniumCXXABI(CodeGenModule &CGM) {
@@ -546,6 +556,9 @@
case TargetCXXABI::WebAssembly:
return new WebAssemblyCXXABI(CGM);
+ case TargetCXXABI::XL:
+ return new XLCXXABI(CGM);
+
case TargetCXXABI::GenericItanium:
if (CGM.getContext().getTargetInfo().getTriple().getArch()
== llvm::Triple::le32) {
@@ -4407,3 +4420,11 @@
NormalCleanup, cast<llvm::CatchPadInst>(CGF.CurrentFuncletPad));
ItaniumCXXABI::emitBeginCatch(CGF, C);
}
+
+/// Register a global destructor as best as we know how.
+void XLCXXABI::registerGlobalDtor(CodeGenFunction &CGF, const VarDecl &D,
+ llvm::FunctionCallee dtor,
+ llvm::Constant *addr) {
+ llvm::report_fatal_error("Static initialization has not been implemented on"
+ " XL ABI yet.");
+}
Index: clang/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -83,6 +83,7 @@
case TargetCXXABI::GenericMIPS:
case TargetCXXABI::GenericItanium:
case TargetCXXABI::WebAssembly:
+ case TargetCXXABI::XL:
return CreateItaniumCXXABI(CGM);
case TargetCXXABI::Microsoft:
return CreateMicrosoftCXXABI(CGM);
Index: clang/lib/Basic/Targets/OSTargets.h
===================================================================
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -706,6 +706,8 @@
public:
AIXTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: OSTargetInfo<Target>(Triple, Opts) {
+ this->TheCXXABI.set(TargetCXXABI::XL);
+
if (this->PointerWidth == 64) {
this->WCharType = this->UnsignedInt;
} else {
Index: clang/lib/AST/ASTContext.cpp
===================================================================
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -874,6 +874,7 @@
case TargetCXXABI::GenericMIPS:
case TargetCXXABI::GenericItanium:
case TargetCXXABI::WebAssembly:
+ case TargetCXXABI::XL:
return CreateItaniumCXXABI(*this);
case TargetCXXABI::Microsoft:
return CreateMicrosoftCXXABI(*this);
@@ -10253,6 +10254,7 @@
case TargetCXXABI::iOS64:
case TargetCXXABI::WebAssembly:
case TargetCXXABI::WatchOS:
+ case TargetCXXABI::XL:
return ItaniumMangleContext::create(*this, getDiagnostics());
case TargetCXXABI::Microsoft:
return MicrosoftMangleContext::create(*this, getDiagnostics());
Index: clang/include/clang/Basic/TargetCXXABI.h
===================================================================
--- clang/include/clang/Basic/TargetCXXABI.h
+++ clang/include/clang/Basic/TargetCXXABI.h
@@ -109,6 +109,13 @@
/// - constructors and destructors return 'this', as in ARM.
Fuchsia,
+ /// The XL ABI is the ABI used by IBM xlclang compiler and is a modified
+ /// version of the Itanium ABI.
+ ///
+ /// The relevant changes from the Itanium ABI are:
+ /// - static initialization is adjusted to use sinit and sterm functions;
+ XL,
+
/// The Microsoft ABI is the ABI used by Microsoft Visual Studio (and
/// compatible compilers).
///
@@ -148,6 +155,7 @@
case WatchOS:
case GenericMIPS:
case WebAssembly:
+ case XL:
return true;
case Microsoft:
@@ -168,6 +176,7 @@
case WatchOS:
case GenericMIPS:
case WebAssembly:
+ case XL:
return false;
case Microsoft:
@@ -202,6 +211,7 @@
case iOS64:
case WatchOS:
case Microsoft:
+ case XL:
return true;
}
llvm_unreachable("bad ABI kind");
@@ -278,6 +288,7 @@
case iOS: // old iOS compilers did not follow this rule
case Microsoft:
case GenericMIPS:
+ case XL:
return true;
}
llvm_unreachable("bad ABI kind");
@@ -315,6 +326,7 @@
case GenericARM:
case iOS:
case GenericMIPS:
+ case XL:
return UseTailPaddingUnlessPOD03;
// iOS on ARM64 and WebAssembly use the C++11 POD rules. They do not honor
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits