Skip to content

Commit

Permalink
[CIR][ABI][NFC] AppleARM64 CXXABI handling in TargetLowering library (l…
Browse files Browse the repository at this point in the history
…lvm#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.
  • Loading branch information
seven-mile authored and lanza committed Oct 2, 2024
1 parent e2555a4 commit 3b49ee9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clang/include/clang/CIR/MissingFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ struct MissingFeatures {
// We're ignoring several details regarding ABI-halding for Swift.
static bool swift() { return false; }

// The AppleARM64 is using ItaniumCXXABI, which is not quite right.
static bool appleArm64CXXABI() { return false; }

// Despite carrying some information about variadics, we are currently
// ignoring this to focus only on the code necessary to lower non-variadics.
static bool variadicFunctions() { return false; }
Expand Down
1 change: 1 addition & 0 deletions clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ CIRGenCXXABI *cir::CreateCIRGenItaniumCXXABI(CIRGenModule &CGM) {
case TargetCXXABI::AppleARM64:
// TODO: this isn't quite right, clang uses AppleARM64CXXABI which inherits
// from ARMCXXABI. We'll have to follow suit.
assert(!MissingFeatures::appleArm64CXXABI());
return new CIRGenItaniumCXXABI(CGM);

default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ CIRCXXABI *CreateItaniumCXXABI(LowerModule &LM) {
// include the other 32-bit ARM oddities: constructor/destructor return values
// and array cookies.
case clang::TargetCXXABI::GenericAArch64:
case clang::TargetCXXABI::AppleARM64:
// TODO: this isn't quite right, clang uses AppleARM64CXXABI which inherits
// from ARMCXXABI. We'll have to follow suit.
assert(!::cir::MissingFeatures::appleArm64CXXABI());
return new ItaniumCXXABI(LM, /*UseARMMethodPtrABI=*/true,
/*UseARMGuardVarABI=*/true);

Expand Down

0 comments on commit 3b49ee9

Please sign in to comment.