[CIR][NFC] Add infrastructure for AArch64 builtins (#170386)

This change adds the basic code structure for handling AArch64 builtins.
The structure of this code is brought over from classic codegen to make
implementing missing builtins easier. In some cases, the handling
involved too much logic for a simple NFC change, so those parts were
replaced with a MissingFeature assert.

The actual handling for all builtins is left for later changes.
This commit is contained in:
Andy Kaylor 2025-12-03 09:30:16 -08:00 committed by GitHub
parent bd4c21b3c8
commit 817ab49ece
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 1601 additions and 0 deletions

View File

@ -190,6 +190,10 @@ struct MissingFeatures {
static bool globalCtorAssociatedData() { return false; }
// Misc
static bool aarch64SIMDIntrinsics() { return false; }
static bool aarch64SMEIntrinsics() { return false; }
static bool aarch64SVEIntrinsics() { return false; }
static bool aarch64TblBuiltinExpr() { return false; }
static bool abiArgInfo() { return false; }
static bool addAutoInitAnnotation() { return false; }
static bool addHeapAllocSiteMetadata() { return false; }
@ -293,6 +297,7 @@ struct MissingFeatures {
static bool metaDataNode() { return false; }
static bool moduleNameHash() { return false; }
static bool msabi() { return false; }
static bool neonSISDIntrinsics() { return false; }
static bool nrvo() { return false; }
static bool objCBlocks() { return false; }
static bool objCGC() { return false; }

View File

@ -1361,9 +1361,13 @@ static mlir::Value emitTargetArchBuiltinExpr(CIRGenFunction *cgf,
case llvm::Triple::armeb:
case llvm::Triple::thumb:
case llvm::Triple::thumbeb:
// These are actually NYI, but that will be reported by emitBuiltinExpr.
// At this point, we don't even know that the builtin is target-specific.
return nullptr;
case llvm::Triple::aarch64:
case llvm::Triple::aarch64_32:
case llvm::Triple::aarch64_be:
return cgf->emitAArch64BuiltinExpr(builtinID, e, returnValue, arch);
case llvm::Triple::bpfeb:
case llvm::Triple::bpfel:
// These are actually NYI, but that will be reported by emitBuiltinExpr.

File diff suppressed because it is too large Load Diff

View File

@ -1236,6 +1236,14 @@ public:
/// CIR emit functions
/// ----------------------
public:
mlir::Value emitAArch64BuiltinExpr(unsigned builtinID, const CallExpr *expr,
ReturnValueSlot returnValue,
llvm::Triple::ArchType arch);
mlir::Value emitAArch64SMEBuiltinExpr(unsigned builtinID,
const CallExpr *expr);
mlir::Value emitAArch64SVEBuiltinExpr(unsigned builtinID,
const CallExpr *expr);
mlir::Value emitAlignmentAssumption(mlir::Value ptrValue, QualType ty,
SourceLocation loc,
SourceLocation assumptionLoc,

View File

@ -12,6 +12,7 @@ add_clang_library(clangCIR
CIRGenAtomic.cpp
CIRGenBuilder.cpp
CIRGenBuiltin.cpp
CIRGenBuiltinAArch64.cpp
CIRGenBuiltinX86.cpp
CIRGenCall.cpp
CIRGenClass.cpp