Skip to content

Commit 2b4e524

Browse files
seven-milelanza
authored andcommitted
[CIR][ABI][NFC] AppleARM64 CXXABI handling in TargetLowering library (llvm#733)
In [this commit](llvm@e5d840b), minimal support for Darwin aarch64 triples was added. But TargetLoweringInfo was not updated correspondingly. This could lead to a failure of the test `driver.c` with CallConvLowering pass enabled (or `LowerModule` used in some other ways). This PR fixes the inconsistency and adds an extra missing feature flag for it.
1 parent a7f74c0 commit 2b4e524

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ struct MissingFeatures {
265265
// We're ignoring several details regarding ABI-halding for Swift.
266266
static bool swift() { return false; }
267267

268+
// The AppleARM64 is using ItaniumCXXABI, which is not quite right.
269+
static bool appleArm64CXXABI() { return false; }
270+
268271
// Despite carrying some information about variadics, we are currently
269272
// ignoring this to focus only on the code necessary to lower non-variadics.
270273
static bool variadicFunctions() { return false; }

clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ CIRGenCXXABI *cir::CreateCIRGenItaniumCXXABI(CIRGenModule &CGM) {
362362
case TargetCXXABI::AppleARM64:
363363
// TODO: this isn't quite right, clang uses AppleARM64CXXABI which inherits
364364
// from ARMCXXABI. We'll have to follow suit.
365+
assert(!MissingFeatures::appleArm64CXXABI());
365366
return new CIRGenItaniumCXXABI(CGM);
366367

367368
default:

clang/lib/CIR/Dialect/Transforms/TargetLowering/ItaniumCXXABI.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ CIRCXXABI *CreateItaniumCXXABI(LowerModule &LM) {
6565
// include the other 32-bit ARM oddities: constructor/destructor return values
6666
// and array cookies.
6767
case clang::TargetCXXABI::GenericAArch64:
68+
case clang::TargetCXXABI::AppleARM64:
69+
// TODO: this isn't quite right, clang uses AppleARM64CXXABI which inherits
70+
// from ARMCXXABI. We'll have to follow suit.
71+
assert(!::cir::MissingFeatures::appleArm64CXXABI());
6872
return new ItaniumCXXABI(LM, /*UseARMMethodPtrABI=*/true,
6973
/*UseARMGuardVarABI=*/true);
7074

0 commit comments

Comments
 (0)