diff --git a/clang/lib/CIR/CodeGen/ABIInfo.h b/clang/lib/CIR/CodeGen/ABIInfo.h index 6e8e18b070a2..6ac37bb01350 100644 --- a/clang/lib/CIR/CodeGen/ABIInfo.h +++ b/clang/lib/CIR/CodeGen/ABIInfo.h @@ -13,7 +13,6 @@ namespace clang::CIRGen { -class ABIArgInfo; class CIRGenCXXABI; class CIRGenFunctionInfo; class CIRGenTypes; diff --git a/clang/lib/CIR/CodeGen/CIRAsm.cpp b/clang/lib/CIR/CodeGen/CIRAsm.cpp index 2b3fea6d2756..781a74c67a21 100644 --- a/clang/lib/CIR/CodeGen/CIRAsm.cpp +++ b/clang/lib/CIR/CodeGen/CIRAsm.cpp @@ -285,7 +285,7 @@ static void buildAsmStores(CIRGenFunction &CGF, const AsmStmt &S, mlir::Type TruncTy = ResultTruncRegTypes[i]; if ((i < ResultRegIsFlagReg.size()) && ResultRegIsFlagReg[i]) { - assert(!MissingFeatures::asmLLVMAssume()); + assert(!cir::MissingFeatures::asmLLVMAssume()); } // If the result type of the LLVM IR asm doesn't match the result type of @@ -311,7 +311,7 @@ static void buildAsmStores(CIRGenFunction &CGF, const AsmStmt &S, } else if (isa(TruncTy)) { Tmp = Builder.createIntCast(Tmp, TruncTy); } else if (false /*TruncTy->isVectorTy()*/) { - assert(!MissingFeatures::asmVectorType()); + assert(!cir::MissingFeatures::asmVectorType()); } } @@ -468,7 +468,7 @@ mlir::LogicalResult CIRGenFunction::buildAsmStmt(const AsmStmt &S) { } // Update largest vector width for any vector types. - assert(!MissingFeatures::asmVectorType()); + assert(!cir::MissingFeatures::asmVectorType()); } else { Address DestAddr = Dest.getAddress(); @@ -504,7 +504,7 @@ mlir::LogicalResult CIRGenFunction::buildAsmStmt(const AsmStmt &S) { Arg = builder.createBitcast(Arg, AdjTy); // Update largest vector width for any vector types. - assert(!MissingFeatures::asmVectorType()); + assert(!cir::MissingFeatures::asmVectorType()); // Only tie earlyclobber physregs. if (Info.allowsRegister() && (GCCReg.empty() || Info.earlyClobber())) @@ -521,7 +521,7 @@ mlir::LogicalResult CIRGenFunction::buildAsmStmt(const AsmStmt &S) { // If this is a Microsoft-style asm blob, store the return registers (EAX:EDX) // to the return value slot. Only do this when returning in registers. if (isa(&S)) { - const ABIArgInfo &RetAI = CurFnInfo->getReturnInfo(); + const cir::ABIArgInfo &RetAI = CurFnInfo->getReturnInfo(); if (RetAI.isDirect() || RetAI.isExtend()) { // Make a fake lvalue for the return value slot. LValue ReturnSlot = makeAddrLValue(ReturnValue, FnRetTy); @@ -593,7 +593,7 @@ mlir::LogicalResult CIRGenFunction::buildAsmStmt(const AsmStmt &S) { << InputExpr->getType() << InputConstraint; // Update largest vector width for any vector types. - assert(!MissingFeatures::asmVectorType()); + assert(!cir::MissingFeatures::asmVectorType()); ArgTypes.push_back(Arg.getType()); ArgElemTypes.push_back(ArgElemType); @@ -636,11 +636,11 @@ mlir::LogicalResult CIRGenFunction::buildAsmStmt(const AsmStmt &S) { HasSideEffect, inferFlavor(CGM, S), mlir::ArrayAttr()); if (false /*IsGCCAsmGoto*/) { - assert(!MissingFeatures::asmGoto()); + assert(!cir::MissingFeatures::asmGoto()); } else if (HasUnwindClobber) { - assert(!MissingFeatures::asmUnwindClobber()); + assert(!cir::MissingFeatures::asmUnwindClobber()); } else { - assert(!MissingFeatures::asmMemoryEffects()); + assert(!cir::MissingFeatures::asmMemoryEffects()); mlir::Value result; if (IA.getNumResults()) diff --git a/clang/lib/CIR/CodeGen/CIRGenAtomic.cpp b/clang/lib/CIR/CodeGen/CIRGenAtomic.cpp index 1c74bf468634..6e1c05949a33 100644 --- a/clang/lib/CIR/CodeGen/CIRGenAtomic.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenAtomic.cpp @@ -42,7 +42,7 @@ class AtomicInfo { uint64_t ValueSizeInBits; CharUnits AtomicAlign; CharUnits ValueAlign; - TypeEvaluationKind EvaluationKind; + cir::TypeEvaluationKind EvaluationKind; bool UseLibcall; LValue LVal; CIRGenBitFieldInfo BFI; @@ -51,7 +51,7 @@ class AtomicInfo { public: AtomicInfo(CIRGenFunction &CGF, LValue &lvalue, mlir::Location l) : CGF(CGF), AtomicSizeInBits(0), ValueSizeInBits(0), - EvaluationKind(TEK_Scalar), UseLibcall(true), loc(l) { + EvaluationKind(cir::TEK_Scalar), UseLibcall(true), loc(l) { assert(!lvalue.isGlobalReg()); ASTContext &C = CGF.getContext(); if (lvalue.isSimple()) { @@ -102,7 +102,7 @@ class AtomicInfo { CharUnits getAtomicAlignment() const { return AtomicAlign; } uint64_t getAtomicSizeInBits() const { return AtomicSizeInBits; } uint64_t getValueSizeInBits() const { return ValueSizeInBits; } - TypeEvaluationKind getEvaluationKind() const { return EvaluationKind; } + cir::TypeEvaluationKind getEvaluationKind() const { return EvaluationKind; } bool shouldUseLibcall() const { return UseLibcall; } const LValue &getAtomicLValue() const { return LVal; } mlir::Value getAtomicPointer() const { @@ -287,13 +287,13 @@ bool AtomicInfo::requiresMemSetZero(mlir::Type ty) const { switch (getEvaluationKind()) { // For scalars and complexes, check whether the store size of the // type uses the full size. - case TEK_Scalar: + case cir::TEK_Scalar: return !isFullSizeType(CGF.CGM, ty, AtomicSizeInBits); - case TEK_Complex: + case cir::TEK_Complex: llvm_unreachable("NYI"); // Padding in structs has an undefined bit pattern. User beware. - case TEK_Aggregate: + case cir::TEK_Aggregate: return false; } llvm_unreachable("bad evaluation kind"); @@ -545,7 +545,7 @@ static void buildAtomicOp(CIRGenFunction &CGF, AtomicExpr *E, Address Dest, mlir::Value IsWeak, mlir::Value FailureOrder, uint64_t Size, mlir::cir::MemOrder Order, uint8_t Scope) { - assert(!MissingFeatures::syncScopeID()); + assert(!cir::MissingFeatures::syncScopeID()); StringRef Op; auto &builder = CGF.getBuilder(); @@ -592,7 +592,7 @@ static void buildAtomicOp(CIRGenFunction &CGF, AtomicExpr *E, Address Dest, case AtomicExpr::AO__scoped_atomic_load: { auto *load = builder.createLoad(loc, Ptr).getDefiningOp(); // FIXME(cir): add scope information. - assert(!MissingFeatures::syncScopeID()); + assert(!cir::MissingFeatures::syncScopeID()); load->setAttr("mem_order", orderAttr); if (E->isVolatile()) load->setAttr("is_volatile", mlir::UnitAttr::get(builder.getContext())); @@ -618,7 +618,7 @@ static void buildAtomicOp(CIRGenFunction &CGF, AtomicExpr *E, Address Dest, case AtomicExpr::AO__scoped_atomic_store_n: { auto loadVal1 = builder.createLoad(loc, Val1); // FIXME(cir): add scope information. - assert(!MissingFeatures::syncScopeID()); + assert(!cir::MissingFeatures::syncScopeID()); builder.createStore(loc, loadVal1, Ptr, E->isVolatile(), /*alignment=*/mlir::IntegerAttr{}, orderAttr); return; @@ -791,7 +791,7 @@ static void buildAtomicOp(CIRGenFunction &CGF, AtomicExpr *Expr, Address Dest, // LLVM atomic instructions always have synch scope. If clang atomic // expression has no scope operand, use default LLVM synch scope. if (!ScopeModel) { - assert(!MissingFeatures::syncScopeID()); + assert(!cir::MissingFeatures::syncScopeID()); buildAtomicOp(CGF, Expr, Dest, Ptr, Val1, Val2, IsWeak, FailureOrder, Size, Order, /*FIXME(cir): LLVM default scope*/ 1); return; @@ -799,7 +799,7 @@ static void buildAtomicOp(CIRGenFunction &CGF, AtomicExpr *Expr, Address Dest, // Handle constant scope. if (getConstOpIntAttr(Scope)) { - assert(!MissingFeatures::syncScopeID()); + assert(!cir::MissingFeatures::syncScopeID()); llvm_unreachable("NYI"); return; } @@ -1469,7 +1469,7 @@ void CIRGenFunction::buildAtomicStore(RValue rvalue, LValue dest, store.setIsVolatile(true); // DecorateInstructionWithTBAA - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); return; } @@ -1480,18 +1480,18 @@ void CIRGenFunction::buildAtomicInit(Expr *init, LValue dest) { AtomicInfo atomics(*this, dest, getLoc(init->getSourceRange())); switch (atomics.getEvaluationKind()) { - case TEK_Scalar: { + case cir::TEK_Scalar: { mlir::Value value = buildScalarExpr(init); atomics.emitCopyIntoMemory(RValue::get(value)); return; } - case TEK_Complex: { + case cir::TEK_Complex: { llvm_unreachable("NYI"); return; } - case TEK_Aggregate: { + case cir::TEK_Aggregate: { // Fix up the destination if the initializer isn't an expression // of atomic type. llvm_unreachable("NYI"); diff --git a/clang/lib/CIR/CodeGen/CIRGenBuilder.h b/clang/lib/CIR/CodeGen/CIRGenBuilder.h index fed183f3feff..47f4979d9c7a 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuilder.h +++ b/clang/lib/CIR/CodeGen/CIRGenBuilder.h @@ -47,10 +47,10 @@ namespace clang::CIRGen { class CIRGenFunction; -class CIRGenBuilderTy : public CIRBaseBuilderTy { +class CIRGenBuilderTy : public cir::CIRBaseBuilderTy { const CIRGenTypeCache &typeCache; bool IsFPConstrained = false; - fp::ExceptionBehavior DefaultConstrainedExcept = fp::ebStrict; + cir::fp::ExceptionBehavior DefaultConstrainedExcept = cir::fp::ebStrict; llvm::RoundingMode DefaultConstrainedRounding = llvm::RoundingMode::Dynamic; llvm::StringMap GlobalsVersioning; @@ -96,10 +96,10 @@ class CIRGenBuilderTy : public CIRBaseBuilderTy { } /// Set the exception handling to be used with constrained floating point - void setDefaultConstrainedExcept(fp::ExceptionBehavior NewExcept) { + void setDefaultConstrainedExcept(cir::fp::ExceptionBehavior NewExcept) { #ifndef NDEBUG std::optional ExceptStr = - convertExceptionBehaviorToStr(NewExcept); + cir::convertExceptionBehaviorToStr(NewExcept); assert(ExceptStr && "Garbage strict exception behavior!"); #endif DefaultConstrainedExcept = NewExcept; @@ -109,14 +109,14 @@ class CIRGenBuilderTy : public CIRBaseBuilderTy { void setDefaultConstrainedRounding(llvm::RoundingMode NewRounding) { #ifndef NDEBUG std::optional RoundingStr = - convertRoundingModeToStr(NewRounding); + cir::convertRoundingModeToStr(NewRounding); assert(RoundingStr && "Garbage strict rounding mode!"); #endif DefaultConstrainedRounding = NewRounding; } /// Get the exception handling used with constrained floating point - fp::ExceptionBehavior getDefaultConstrainedExcept() { + cir::fp::ExceptionBehavior getDefaultConstrainedExcept() { return DefaultConstrainedExcept; } @@ -422,7 +422,7 @@ class CIRGenBuilderTy : public CIRBaseBuilderTy { // FIXME: replay LLVM codegen for now, perhaps add a vtable ptr special // type so it's a bit more clear and C++ idiomatic. auto fnTy = mlir::cir::FuncType::get({}, getUInt32Ty(), isVarArg); - assert(!MissingFeatures::isVarArg()); + assert(!cir::MissingFeatures::isVarArg()); return getPointerTo(getPointerTo(fnTy)); } @@ -657,30 +657,30 @@ class CIRGenBuilderTy : public CIRBaseBuilderTy { } mlir::Value createFSub(mlir::Value lhs, mlir::Value rhs) { - assert(!MissingFeatures::metaDataNode()); + assert(!cir::MissingFeatures::metaDataNode()); if (IsFPConstrained) llvm_unreachable("Constrained FP NYI"); - assert(!MissingFeatures::foldBinOpFMF()); + assert(!cir::MissingFeatures::foldBinOpFMF()); return create(lhs.getLoc(), mlir::cir::BinOpKind::Sub, lhs, rhs); } mlir::Value createFAdd(mlir::Value lhs, mlir::Value rhs) { - assert(!MissingFeatures::metaDataNode()); + assert(!cir::MissingFeatures::metaDataNode()); if (IsFPConstrained) llvm_unreachable("Constrained FP NYI"); - assert(!MissingFeatures::foldBinOpFMF()); + assert(!cir::MissingFeatures::foldBinOpFMF()); return create(lhs.getLoc(), mlir::cir::BinOpKind::Add, lhs, rhs); } mlir::Value createFMul(mlir::Value lhs, mlir::Value rhs) { - assert(!MissingFeatures::metaDataNode()); + assert(!cir::MissingFeatures::metaDataNode()); if (IsFPConstrained) llvm_unreachable("Constrained FP NYI"); - assert(!MissingFeatures::foldBinOpFMF()); + assert(!cir::MissingFeatures::foldBinOpFMF()); return create(lhs.getLoc(), mlir::cir::BinOpKind::Mul, lhs, rhs); } @@ -697,14 +697,14 @@ class CIRGenBuilderTy : public CIRBaseBuilderTy { mlir::Value createDynCastToVoid(mlir::Location loc, mlir::Value src, bool vtableUseRelativeLayout) { // TODO(cir): consider address space here. - assert(!MissingFeatures::addressSpace()); + assert(!cir::MissingFeatures::addressSpace()); auto destTy = getVoidPtrTy(); return create( loc, destTy, mlir::cir::DynamicCastKind::ptr, src, mlir::cir::DynamicCastInfoAttr{}, vtableUseRelativeLayout); } - cir::Address createBaseClassAddr(mlir::Location loc, cir::Address addr, + Address createBaseClassAddr(mlir::Location loc, Address addr, mlir::Type destType, unsigned offset, bool assumeNotNull) { if (destType == addr.getElementType()) @@ -716,7 +716,7 @@ class CIRGenBuilderTy : public CIRBaseBuilderTy { return Address(baseAddr, ptrTy, addr.getAlignment()); } - cir::Address createDerivedClassAddr(mlir::Location loc, cir::Address addr, + Address createDerivedClassAddr(mlir::Location loc, Address addr, mlir::Type destType, unsigned offset, bool assumeNotNull) { if (destType == addr.getElementType()) @@ -833,7 +833,7 @@ class CIRGenBuilderTy : public CIRBaseBuilderTy { /// Cast the element type of the given address to a different type, /// preserving information like the alignment. - cir::Address createElementBitCast(mlir::Location loc, cir::Address addr, + Address createElementBitCast(mlir::Location loc, Address addr, mlir::Type destType) { if (destType == addr.getElementType()) return addr; @@ -869,7 +869,7 @@ class CIRGenBuilderTy : public CIRBaseBuilderTy { mlir::Value createAlignedLoad(mlir::Location loc, mlir::Type ty, mlir::Value ptr, llvm::MaybeAlign align) { // TODO: make sure callsites shouldn't be really passing volatile. - assert(!MissingFeatures::volatileLoadOrStore()); + assert(!cir::MissingFeatures::volatileLoadOrStore()); return createAlignedLoad(loc, ty, ptr, align, /*isVolatile=*/false); } @@ -942,7 +942,7 @@ class CIRGenBuilderTy : public CIRBaseBuilderTy { // but currently some parts of Clang AST, which we don't want to touch just // yet, return them. void computeGlobalViewIndicesFromFlatOffset( - int64_t Offset, mlir::Type Ty, CIRDataLayout Layout, + int64_t Offset, mlir::Type Ty, cir::CIRDataLayout Layout, llvm::SmallVectorImpl &Indices) { if (!Offset) return; @@ -1046,7 +1046,7 @@ class CIRGenBuilderTy : public CIRBaseBuilderTy { mlir::cast(memberPtr.getType()); // TODO(cir): consider address space. - assert(!MissingFeatures::addressSpace()); + assert(!cir::MissingFeatures::addressSpace()); auto resultTy = getPointerTo(memberPtrTy.getMemberTy()); return create(loc, resultTy, objectPtr, diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp index 1a145af6ed56..5a5d2122d035 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp @@ -49,7 +49,7 @@ static RValue buildLibraryCall(CIRGenFunction &CGF, const FunctionDecl *FD, static mlir::Value tryUseTestFPKind(CIRGenFunction &CGF, unsigned BuiltinID, mlir::Value V) { if (CGF.getBuilder().getIsFPConstrained() && - CGF.getBuilder().getDefaultConstrainedExcept() != fp::ebIgnore) { + CGF.getBuilder().getDefaultConstrainedExcept() != cir::fp::ebIgnore) { if (mlir::Value Result = CGF.getTargetHooks().testFPKind( V, BuiltinID, CGF.getBuilder(), CGF.CGM)) return Result; @@ -509,7 +509,7 @@ RValue CIRGenFunction::buildBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, case Builtin::BI__builtin_cosf16: case Builtin::BI__builtin_cosl: case Builtin::BI__builtin_cosf128: - assert(!MissingFeatures::fastMathFlags()); + assert(!cir::MissingFeatures::fastMathFlags()); return buildUnaryFPBuiltin(*this, *E); case Builtin::BIcosh: @@ -530,7 +530,7 @@ RValue CIRGenFunction::buildBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, case Builtin::BI__builtin_expf16: case Builtin::BI__builtin_expl: case Builtin::BI__builtin_expf128: - assert(!MissingFeatures::fastMathFlags()); + assert(!cir::MissingFeatures::fastMathFlags()); return buildUnaryFPBuiltin(*this, *E); case Builtin::BIexp2: @@ -541,7 +541,7 @@ RValue CIRGenFunction::buildBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, case Builtin::BI__builtin_exp2f16: case Builtin::BI__builtin_exp2l: case Builtin::BI__builtin_exp2f128: - assert(!MissingFeatures::fastMathFlags()); + assert(!cir::MissingFeatures::fastMathFlags()); return buildUnaryFPBuiltin(*this, *E); case Builtin::BI__builtin_exp10: @@ -615,7 +615,7 @@ RValue CIRGenFunction::buildBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, case Builtin::BI__builtin_fmod: case Builtin::BI__builtin_fmodf: case Builtin::BI__builtin_fmodl: - assert(!MissingFeatures::fastMathFlags()); + assert(!cir::MissingFeatures::fastMathFlags()); return buildBinaryFPBuiltin(*this, *E); case Builtin::BI__builtin_fmodf16: @@ -631,7 +631,7 @@ RValue CIRGenFunction::buildBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, case Builtin::BI__builtin_logf16: case Builtin::BI__builtin_logl: case Builtin::BI__builtin_logf128: - assert(!MissingFeatures::fastMathFlags()); + assert(!cir::MissingFeatures::fastMathFlags()); return buildUnaryFPBuiltin(*this, *E); case Builtin::BIlog10: @@ -642,7 +642,7 @@ RValue CIRGenFunction::buildBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, case Builtin::BI__builtin_log10f16: case Builtin::BI__builtin_log10l: case Builtin::BI__builtin_log10f128: - assert(!MissingFeatures::fastMathFlags()); + assert(!cir::MissingFeatures::fastMathFlags()); return buildUnaryFPBuiltin(*this, *E); case Builtin::BIlog2: @@ -653,7 +653,7 @@ RValue CIRGenFunction::buildBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, case Builtin::BI__builtin_log2f16: case Builtin::BI__builtin_log2l: case Builtin::BI__builtin_log2f128: - assert(!MissingFeatures::fastMathFlags()); + assert(!cir::MissingFeatures::fastMathFlags()); return buildUnaryFPBuiltin(*this, *E); case Builtin::BInearbyint: @@ -671,7 +671,7 @@ RValue CIRGenFunction::buildBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, case Builtin::BI__builtin_pow: case Builtin::BI__builtin_powf: case Builtin::BI__builtin_powl: - assert(!MissingFeatures::fastMathFlags()); + assert(!cir::MissingFeatures::fastMathFlags()); return RValue::get( buildBinaryMaybeConstrainedFPBuiltin(*this, *E)); @@ -717,7 +717,7 @@ RValue CIRGenFunction::buildBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, case Builtin::BI__builtin_sinf16: case Builtin::BI__builtin_sinl: case Builtin::BI__builtin_sinf128: - assert(!MissingFeatures::fastMathFlags()); + assert(!cir::MissingFeatures::fastMathFlags()); return buildUnaryFPBuiltin(*this, *E); case Builtin::BIsqrt: @@ -728,7 +728,7 @@ RValue CIRGenFunction::buildBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, case Builtin::BI__builtin_sqrtf16: case Builtin::BI__builtin_sqrtl: case Builtin::BI__builtin_sqrtf128: - assert(!MissingFeatures::fastMathFlags()); + assert(!cir::MissingFeatures::fastMathFlags()); return buildUnaryFPBuiltin(*this, *E); case Builtin::BI__builtin_elementwise_sqrt: @@ -974,7 +974,7 @@ RValue CIRGenFunction::buildBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, case Builtin::BI__builtin_unpredictable: { if (CGM.getCodeGenOpts().OptimizationLevel != 0) - assert(!MissingFeatures::insertBuiltinUnpredictable()); + assert(!cir::MissingFeatures::insertBuiltinUnpredictable()); return RValue::get(buildScalarExpr(E->getArg(0))); } @@ -1373,7 +1373,7 @@ RValue CIRGenFunction::buildBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // default (e.g. in C / C++ auto vars are in the generic address space). At // the AST level this is handled within CreateTempAlloca et al., but for the // builtin / dynamic alloca we have to handle it here. - assert(!MissingFeatures::addressSpace()); + assert(!cir::MissingFeatures::addressSpace()); auto AAS = getCIRAllocaAddressSpace(); auto EAS = builder.getAddrSpaceAttr( E->getType()->getPointeeType().getAddressSpace()); @@ -2301,21 +2301,21 @@ RValue CIRGenFunction::buildBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // __builtin_arm_mve_vld2q_u32. So if the result is an aggregate, force // ReturnValue to be non-null, so that the target-specific emission code can // always just emit into it. - TypeEvaluationKind EvalKind = getEvaluationKind(E->getType()); - if (EvalKind == TEK_Aggregate && ReturnValue.isNull()) { + cir::TypeEvaluationKind EvalKind = getEvaluationKind(E->getType()); + if (EvalKind == cir::TEK_Aggregate && ReturnValue.isNull()) { llvm_unreachable("NYI"); } // Now see if we can emit a target-specific builtin. if (auto V = buildTargetBuiltinExpr(BuiltinID, E, ReturnValue)) { switch (EvalKind) { - case TEK_Scalar: + case cir::TEK_Scalar: if (mlir::isa(V.getType())) return RValue::get(nullptr); return RValue::get(V); - case TEK_Aggregate: + case cir::TEK_Aggregate: llvm_unreachable("NYI"); - case TEK_Complex: + case cir::TEK_Complex: llvm_unreachable("No current target builtin returns complex"); } llvm_unreachable("Bad evaluation kind in EmitBuiltinExpr"); @@ -2336,7 +2336,7 @@ mlir::Value CIRGenFunction::buildCheckedArgForBuiltin(const Expr *E, if (!SanOpts.has(SanitizerKind::Builtin)) return value; - assert(!MissingFeatures::sanitizerBuiltin()); + assert(!cir::MissingFeatures::sanitizerBuiltin()); llvm_unreachable("NYI"); } diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp index c21a1c7c6e46..c8cc6c9c096d 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp @@ -2259,13 +2259,13 @@ mlir::Value buildNeonCall(CIRGenBuilderTy &builder, unsigned shift = 0, bool rightshift = false) { // TODO: Consider removing the following unreachable when we have // buildConstrainedFPCall feature implemented - assert(!MissingFeatures::buildConstrainedFPCall()); + assert(!cir::MissingFeatures::buildConstrainedFPCall()); if (isConstrainedFPIntrinsic) llvm_unreachable("isConstrainedFPIntrinsic NYI"); for (unsigned j = 0; j < argTypes.size(); ++j) { if (isConstrainedFPIntrinsic) { - assert(!MissingFeatures::buildConstrainedFPCall()); + assert(!cir::MissingFeatures::buildConstrainedFPCall()); } if (shift > 0 && shift == j) { args[j] = buildNeonShiftVector( @@ -2276,7 +2276,7 @@ mlir::Value buildNeonCall(CIRGenBuilderTy &builder, } } if (isConstrainedFPIntrinsic) { - assert(!MissingFeatures::buildConstrainedFPCall()); + assert(!cir::MissingFeatures::buildConstrainedFPCall()); return nullptr; } return builder @@ -2313,8 +2313,8 @@ buildCommonNeonCallPattern0(CIRGenFunction &cgf, llvm::StringRef intrincsName, mlir::Value CIRGenFunction::buildCommonNeonBuiltinExpr( unsigned builtinID, unsigned llvmIntrinsic, unsigned altLLVMIntrinsic, const char *nameHint, unsigned modifier, const CallExpr *e, - llvm::SmallVectorImpl &ops, cir::Address ptrOp0, - cir::Address ptrOp1, llvm::Triple::ArchType arch) { + llvm::SmallVectorImpl &ops, Address ptrOp0, + Address ptrOp1, llvm::Triple::ArchType arch) { // Get the last argument, which specifies the vector type. const clang::Expr *arg = e->getArg(e->getNumArgs() - 1); std::optional neonTypeConst = @@ -3386,7 +3386,7 @@ CIRGenFunction::buildAArch64BuiltinExpr(unsigned BuiltinID, const CallExpr *E, } case NEON::BI__builtin_neon_vrnda_v: case NEON::BI__builtin_neon_vrndaq_v: { - assert(!MissingFeatures::buildConstrainedFPCall()); + assert(!cir::MissingFeatures::buildConstrainedFPCall()); return buildNeonCall(builder, {ty}, Ops, "round", ty, getLoc(E->getExprLoc())); } @@ -3737,7 +3737,7 @@ CIRGenFunction::buildAArch64BuiltinExpr(unsigned BuiltinID, const CallExpr *E, } case NEON::BI__builtin_neon_vld1_dup_v: case NEON::BI__builtin_neon_vld1q_dup_v: { - cir::Address ptrAddr = PtrOp0.withElementType(vTy.getEltType()); + Address ptrAddr = PtrOp0.withElementType(vTy.getEltType()); mlir::Value val = builder.createLoad(getLoc(E->getExprLoc()), ptrAddr); mlir::cir::VecSplatOp vecSplat = builder.create( getLoc(E->getExprLoc()), vTy, val); diff --git a/clang/lib/CIR/CodeGen/CIRGenCXX.cpp b/clang/lib/CIR/CodeGen/CIRGenCXX.cpp index 3db1644812b7..f77b61e51a56 100644 --- a/clang/lib/CIR/CodeGen/CIRGenCXX.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenCXX.cpp @@ -39,7 +39,7 @@ bool CIRGenModule::tryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D) { // an alias, unless this class owns no members. if (getCodeGenOpts().SanitizeMemoryUseAfterDtor && !D->getParent()->field_empty()) - assert(!MissingFeatures::sanitizeDtor()); + assert(!cir::MissingFeatures::sanitizeDtor()); // If the destructor doesn't have a trivial body, we have to emit it // separately. @@ -192,17 +192,17 @@ static void buildDeclInit(CIRGenFunction &CGF, const VarDecl *D, const Expr *Init = D->getInit(); switch (CIRGenFunction::getEvaluationKind(type)) { - case TEK_Aggregate: + case cir::TEK_Aggregate: CGF.buildAggExpr( Init, AggValueSlot::forLValue(lv, AggValueSlot::IsDestructed, AggValueSlot::DoesNotNeedGCBarriers, AggValueSlot::IsNotAliased, AggValueSlot::DoesNotOverlap)); return; - case TEK_Scalar: + case cir::TEK_Scalar: CGF.buildScalarInit(Init, CGF.getLoc(D->getLocation()), lv, false); return; - case TEK_Complex: + case cir::TEK_Complex: llvm_unreachable("complext evaluation NYI"); } } @@ -254,7 +254,7 @@ static void buildDeclDestroy(CIRGenFunction &CGF, const VarDecl *D) { if (Record && (CanRegisterDestructor || UsingExternalHelper)) { assert(!D->getTLSKind() && "TLS NYI"); assert(!Record->hasTrivialDestructor()); - assert(!MissingFeatures::openCLCXX()); + assert(!cir::MissingFeatures::openCLCXX()); CXXDestructorDecl *Dtor = Record->getDestructor(); // In LLVM OG codegen this is done in registerGlobalDtor, but CIRGen // relies on LoweringPrepare for further decoupling, so build the @@ -304,7 +304,7 @@ void CIRGenFunction::buildInvariantStart([[maybe_unused]] CharUnits Size) { if (!CGM.getCodeGenOpts().OptimizationLevel) return; - assert(!MissingFeatures::createInvariantIntrinsic()); + assert(!cir::MissingFeatures::createInvariantIntrinsic()); } void CIRGenModule::buildCXXGlobalVarDeclInit(const VarDecl *varDecl, @@ -329,7 +329,7 @@ void CIRGenModule::buildCXXGlobalVarDeclInit(const VarDecl *varDecl, // For example, in the above CUDA code, the static local variable s has a // "shared" address space qualifier, but the constructor of StructWithCtor // expects "this" in the "generic" address space. - assert(!MissingFeatures::addressSpace()); + assert(!cir::MissingFeatures::addressSpace()); if (getLangOpts().OpenMP && !getLangOpts().OpenMPSimd && varDecl->hasAttr()) { diff --git a/clang/lib/CIR/CodeGen/CIRGenCall.cpp b/clang/lib/CIR/CodeGen/CIRGenCall.cpp index 6c594d91026b..8045ab001994 100644 --- a/clang/lib/CIR/CodeGen/CIRGenCall.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenCall.cpp @@ -139,16 +139,16 @@ void ClangToCIRArgMapping::construct(const ASTContext &Context, bool OnlyRequiredArgs) { unsigned CIRArgNo = 0; bool SwapThisWithSRet = false; - const ABIArgInfo &RetAI = FI.getReturnInfo(); + const cir::ABIArgInfo &RetAI = FI.getReturnInfo(); - assert(RetAI.getKind() != ABIArgInfo::Indirect && "NYI"); + assert(RetAI.getKind() != cir::ABIArgInfo::Indirect && "NYI"); unsigned ArgNo = 0; unsigned NumArgs = OnlyRequiredArgs ? FI.getNumRequiredArgs() : FI.arg_size(); for (CIRGenFunctionInfo::const_arg_iterator I = FI.arg_begin(); ArgNo < NumArgs; ++I, ++ArgNo) { assert(I != FI.arg_end()); - const ABIArgInfo &AI = I->info; + const cir::ABIArgInfo &AI = I->info; // Collect data about CIR arguments corresponding to Clang argument ArgNo. auto &CIRArgs = ArgInfo[ArgNo]; @@ -157,15 +157,15 @@ void ClangToCIRArgMapping::construct(const ASTContext &Context, switch (AI.getKind()) { default: llvm_unreachable("NYI"); - case ABIArgInfo::Extend: - case ABIArgInfo::Direct: { + case cir::ABIArgInfo::Extend: + case cir::ABIArgInfo::Direct: { // Postpone splitting structs into elements since this makes it way // more complicated for analysis to obtain information on the original // arguments. // // TODO(cir): a LLVM lowering prepare pass should break this down into // the appropriated pieces. - assert(!MissingFeatures::constructABIArgDirectExtend()); + assert(!cir::MissingFeatures::constructABIArgDirectExtend()); CIRArgs.NumberOfArgs = 1; break; } @@ -206,16 +206,16 @@ mlir::cir::FuncType CIRGenTypes::GetFunctionType(const CIRGenFunctionInfo &FI) { assert(Inserted && "Recursively being processed?"); mlir::Type resultType = nullptr; - const ABIArgInfo &retAI = FI.getReturnInfo(); + const cir::ABIArgInfo &retAI = FI.getReturnInfo(); switch (retAI.getKind()) { - case ABIArgInfo::Ignore: + case cir::ABIArgInfo::Ignore: // TODO(CIR): This should probably be the None type from the builtin // dialect. resultType = nullptr; break; - case ABIArgInfo::Extend: - case ABIArgInfo::Direct: + case cir::ABIArgInfo::Extend: + case cir::ABIArgInfo::Direct: resultType = retAI.getCoerceToType(); break; @@ -245,8 +245,8 @@ mlir::cir::FuncType CIRGenTypes::GetFunctionType(const CIRGenFunctionInfo &FI) { switch (ArgInfo.getKind()) { default: llvm_unreachable("NYI"); - case ABIArgInfo::Extend: - case ABIArgInfo::Direct: { + case cir::ABIArgInfo::Extend: + case cir::ABIArgInfo::Direct: { mlir::Type argType = ArgInfo.getCoerceToType(); // TODO: handle the test against llvm::StructType from codegen assert(NumCIRArgs == 1); @@ -306,7 +306,7 @@ void CIRGenFunction::buildAggregateStore(mlir::Value Val, Address Dest, } static Address emitAddressAtOffset(CIRGenFunction &CGF, Address addr, - const ABIArgInfo &info) { + const cir::ABIArgInfo &info) { if (unsigned offset = info.getDirectOffset()) { llvm_unreachable("NYI"); } @@ -456,7 +456,7 @@ void CIRGenModule::constructAttributeList(StringRef Name, if (TargetDecl->hasAttr() && getLangOpts().OffloadUniformBlock) - assert(!MissingFeatures::CUDA()); + assert(!cir::MissingFeatures::CUDA()); if (TargetDecl->hasAttr()) ; @@ -592,7 +592,7 @@ RValue CIRGenFunction::buildCall(const CIRGenFunctionInfo &CallInfo, // Some architectures (such as x86-64) have the ABI changed based on // attribute-target/features. Give them a chance to diagnose. - assert(!MissingFeatures::checkFunctionCallABI()); + assert(!cir::MissingFeatures::checkFunctionCallABI()); } // TODO: add DNEBUG code @@ -615,7 +615,7 @@ RValue CIRGenFunction::buildCall(const CIRGenFunctionInfo &CallInfo, // When passing arguments using temporary allocas, we need to add the // appropriate lifetime markers. This vector keeps track of all the lifetime // markers that need to be ended right after the call. - assert(!MissingFeatures::shouldEmitLifetimeMarkers() && "NYI"); + assert(!cir::MissingFeatures::shouldEmitLifetimeMarkers() && "NYI"); // Translate all of the arguments as necessary to match the CIR lowering. assert(CallInfo.arg_size() == CallArgs.size() && @@ -624,7 +624,7 @@ RValue CIRGenFunction::buildCall(const CIRGenFunctionInfo &CallInfo, CIRGenFunctionInfo::const_arg_iterator info_it = CallInfo.arg_begin(); for (CallArgList::const_iterator I = CallArgs.begin(), E = CallArgs.end(); I != E; ++I, ++info_it, ++ArgNo) { - const ABIArgInfo &ArgInfo = info_it->info; + const cir::ABIArgInfo &ArgInfo = info_it->info; // Insert a padding argument to ensure proper alignment. assert(!CIRFunctionArgs.hasPaddingArg(ArgNo) && "Padding args NYI"); @@ -633,7 +633,7 @@ RValue CIRGenFunction::buildCall(const CIRGenFunctionInfo &CallInfo, std::tie(FirstCIRArg, NumCIRArgs) = CIRFunctionArgs.getCIRArgs(ArgNo); switch (ArgInfo.getKind()) { - case ABIArgInfo::Direct: { + case cir::ABIArgInfo::Direct: { if (!mlir::isa(ArgInfo.getCoerceToType()) && ArgInfo.getCoerceToType() == convertType(info_it->type) && ArgInfo.getDirectOffset() == 0) { @@ -866,11 +866,11 @@ RValue CIRGenFunction::buildCall(const CIRGenFunctionInfo &CallInfo, // Extract the return value. RValue ret = [&] { switch (RetAI.getKind()) { - case ABIArgInfo::Direct: { + case cir::ABIArgInfo::Direct: { mlir::Type RetCIRTy = convertType(RetTy); if (RetAI.getCoerceToType() == RetCIRTy && RetAI.getDirectOffset() == 0) { switch (getEvaluationKind(RetTy)) { - case TEK_Aggregate: { + case cir::TEK_Aggregate: { Address DestPtr = ReturnValue.getValue(); bool DestIsVolatile = ReturnValue.isVolatile(); @@ -886,7 +886,7 @@ RValue CIRGenFunction::buildCall(const CIRGenFunctionInfo &CallInfo, buildAggregateStore(Results[0], DestPtr, DestIsVolatile); return RValue::getAggregate(DestPtr); } - case TEK_Scalar: { + case cir::TEK_Scalar: { // If the argument doesn't match, perform a bitcast to coerce it. This // can happen due to trivial type mismatches. auto Results = theCall->getOpResults(); @@ -902,7 +902,7 @@ RValue CIRGenFunction::buildCall(const CIRGenFunctionInfo &CallInfo, } } - case ABIArgInfo::Ignore: + case cir::ABIArgInfo::Ignore: // If we are ignoring an argument that had a result, make sure to // construct the appropriate return value for our caller. return GetUndefRValue(RetTy); @@ -928,7 +928,7 @@ mlir::Value CIRGenFunction::buildRuntimeCall(mlir::Location loc, mlir::cir::FuncOp callee, ArrayRef args) { // TODO(cir): set the calling convention to this runtime call. - assert(!MissingFeatures::setCallingConv()); + assert(!cir::MissingFeatures::setCallingConv()); auto call = builder.createCallOp(loc, callee, args); assert(call->getNumResults() <= 1 && @@ -1210,7 +1210,7 @@ CIRGenTypes::arrangeCXXStructorDeclaration(GlobalDecl GD) { CanQualType resultType = Context.VoidTy; (void)resultType; - return arrangeCIRFunctionInfo(resultType, FnInfoOpts::IsInstanceMethod, + return arrangeCIRFunctionInfo(resultType, cir::FnInfoOpts::IsInstanceMethod, argTypes, extInfo, paramInfos, required); } @@ -1235,7 +1235,7 @@ CanQualType CIRGenTypes::DeriveThisType(const CXXRecordDecl *RD, /// Arrange the CIR function layout for a value of the given function type, on /// top of any implicit parameters already stored. static const CIRGenFunctionInfo & -arrangeCIRFunctionInfo(CIRGenTypes &CGT, FnInfoOpts instanceMethod, +arrangeCIRFunctionInfo(CIRGenTypes &CGT, cir::FnInfoOpts instanceMethod, SmallVectorImpl &prefix, CanQual FTP) { SmallVector paramInfos; @@ -1253,7 +1253,7 @@ arrangeCIRFunctionInfo(CIRGenTypes &CGT, FnInfoOpts instanceMethod, const CIRGenFunctionInfo & CIRGenTypes::arrangeFreeFunctionType(CanQual FTP) { SmallVector argTypes; - return ::arrangeCIRFunctionInfo(*this, FnInfoOpts::None, argTypes, FTP); + return ::arrangeCIRFunctionInfo(*this, cir::FnInfoOpts::None, argTypes, FTP); } /// Arrange the argument and result information for a value of the given @@ -1263,7 +1263,7 @@ CIRGenTypes::arrangeFreeFunctionType(CanQual FTNP) { // When translating an unprototyped function type, always use a // variadic type. return arrangeCIRFunctionInfo(FTNP->getReturnType().getUnqualifiedType(), - FnInfoOpts::None, std::nullopt, + cir::FnInfoOpts::None, std::nullopt, FTNP->getExtInfo(), {}, RequiredArgs(0)); } @@ -1314,7 +1314,7 @@ const CIRGenFunctionInfo &CIRGenTypes::arrangeCXXConstructorCall( // which never have param info. assert(!FPT->hasExtParameterInfos() && "NYI"); - return arrangeCIRFunctionInfo(ResultType, FnInfoOpts::IsInstanceMethod, + return arrangeCIRFunctionInfo(ResultType, cir::FnInfoOpts::IsInstanceMethod, ArgTypes, Info, ParamInfos, Required); } @@ -1396,9 +1396,9 @@ static const CIRGenFunctionInfo & arrangeFreeFunctionLikeCall(CIRGenTypes &CGT, CIRGenModule &CGM, const CallArgList &args, const FunctionType *fnType, unsigned numExtraRequiredArgs, - FnInfoOpts chainCall) { + cir::FnInfoOpts chainCall) { assert(args.size() >= numExtraRequiredArgs); - assert((chainCall != FnInfoOpts::IsChainCall) && "Chain call NYI"); + assert((chainCall != cir::FnInfoOpts::IsChainCall) && "Chain call NYI"); llvm::SmallVector paramInfos; @@ -1415,7 +1415,7 @@ arrangeFreeFunctionLikeCall(CIRGenTypes &CGT, CIRGenModule &CGM, addExtParameterInfosForCall(paramInfos, proto, numExtraRequiredArgs, args.size()); } else if (llvm::isa(fnType)) { - assert(!MissingFeatures::targetCodeGenInfoIsProtoCallVariadic()); + assert(!cir::MissingFeatures::targetCodeGenInfoIsProtoCallVariadic()); required = RequiredArgs(args.size()); } @@ -1465,7 +1465,7 @@ const CIRGenFunctionInfo &CIRGenTypes::arrangeCXXMethodCall( auto info = proto->getExtInfo(); return arrangeCIRFunctionInfo(GetReturnType(proto->getReturnType()), - FnInfoOpts::IsInstanceMethod, argTypes, info, + cir::FnInfoOpts::IsInstanceMethod, argTypes, info, paramInfos, required); } @@ -1477,7 +1477,7 @@ const CIRGenFunctionInfo &CIRGenTypes::arrangeFreeFunctionCall( assert(!ChainCall && "ChainCall NYI"); return arrangeFreeFunctionLikeCall( *this, CGM, args, fnType, ChainCall ? 1 : 0, - ChainCall ? FnInfoOpts::IsChainCall : FnInfoOpts::None); + ChainCall ? cir::FnInfoOpts::IsChainCall : cir::FnInfoOpts::None); } /// Set calling convention for CUDA/HIP kernel. @@ -1524,7 +1524,7 @@ CIRGenTypes::arrangeCXXMethodType(const CXXRecordDecl *RD, argTypes.push_back(DeriveThisType(RD, MD)); return ::arrangeCIRFunctionInfo( - *this, FnInfoOpts::IsChainCall, argTypes, + *this, cir::FnInfoOpts::IsChainCall, argTypes, FTP->getCanonicalTypeUnqualified().getAs()); } @@ -1544,7 +1544,7 @@ CIRGenTypes::arrangeFunctionDeclaration(const FunctionDecl *FD) { // When declaring a function without a prototype, always use a non-variadic // type. if (CanQual noProto = FTy.getAs()) { - return arrangeCIRFunctionInfo(noProto->getReturnType(), FnInfoOpts::None, + return arrangeCIRFunctionInfo(noProto->getReturnType(), cir::FnInfoOpts::None, std::nullopt, noProto->getExtInfo(), {}, RequiredArgs::All); } diff --git a/clang/lib/CIR/CodeGen/CIRGenClass.cpp b/clang/lib/CIR/CodeGen/CIRGenClass.cpp index ca91084cecd7..38e307a4edb6 100644 --- a/clang/lib/CIR/CodeGen/CIRGenClass.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenClass.cpp @@ -277,7 +277,7 @@ class ConstructorMemcpyizer : public FieldMemcpyizer { if (!MemcpyableCtor) return false; - assert(!MissingFeatures::fieldMemcpyizerBuildMemcpy()); + assert(!cir::MissingFeatures::fieldMemcpyizerBuildMemcpy()); return false; } @@ -740,11 +740,11 @@ void CIRGenFunction::initializeVTablePointer(mlir::Location loc, // // vtable field is derived from `this` pointer, therefore they should be in // the same addr space. - assert(!MissingFeatures::addressSpace()); + assert(!cir::MissingFeatures::addressSpace()); VTableField = builder.createElementBitCast(loc, VTableField, VTableAddressPoint.getType()); builder.createStore(loc, VTableAddressPoint, VTableField); - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); } void CIRGenFunction::initializeVTablePointers(mlir::Location loc, @@ -851,17 +851,17 @@ void CIRGenFunction::buildInitializerForField(FieldDecl *Field, LValue LHS, Expr *Init) { QualType FieldType = Field->getType(); switch (getEvaluationKind(FieldType)) { - case TEK_Scalar: + case cir::TEK_Scalar: if (LHS.isSimple()) { buildExprAsInit(Init, Field, LHS, false); } else { llvm_unreachable("NYI"); } break; - case TEK_Complex: + case cir::TEK_Complex: llvm_unreachable("NYI"); break; - case TEK_Aggregate: { + case cir::TEK_Aggregate: { AggValueSlot Slot = AggValueSlot::forLValue( LHS, AggValueSlot::IsDestructed, AggValueSlot::DoesNotNeedGCBarriers, AggValueSlot::IsNotAliased, getOverlapForFieldInit(Field), @@ -877,7 +877,7 @@ void CIRGenFunction::buildInitializerForField(FieldDecl *Field, LValue LHS, // constructor. QualType::DestructionKind dtorKind = FieldType.isDestructedType(); (void)dtorKind; - if (MissingFeatures::cleanups()) + if (cir::MissingFeatures::cleanups()) llvm_unreachable("NYI"); } @@ -924,7 +924,7 @@ void CIRGenFunction::buildImplicitAssignmentOperatorBody( // LexicalScope Scope(*this, RootCS->getSourceRange()); // FIXME(cir): add all of the below under a new scope. - assert(!MissingFeatures::incrementProfileCounter()); + assert(!cir::MissingFeatures::incrementProfileCounter()); AssignmentMemcpyizer AM(*this, AssignOp, Args); for (auto *I : RootCS->body()) AM.emitAssignment(I); @@ -945,7 +945,7 @@ void CIRGenFunction::buildForwardingCallToLambda( QualType resultType = FPT->getReturnType(); ReturnValueSlot returnSlot; if (!resultType->isVoidType() && - calleeFnInfo.getReturnInfo().getKind() == ABIArgInfo::Indirect && + calleeFnInfo.getReturnInfo().getKind() == cir::ABIArgInfo::Indirect && !hasScalarEvaluationKind(calleeFnInfo.getReturnType())) { llvm_unreachable("NYI"); } @@ -1137,7 +1137,7 @@ void CIRGenFunction::buildDestructorBody(FunctionArgList &Args) { Stmt *Body = Dtor->getBody(); if (Body) - assert(!MissingFeatures::incrementProfileCounter()); + assert(!cir::MissingFeatures::incrementProfileCounter()); // The call to operator delete in a deleting destructor happens // outside of the function-try-block, which means it's always @@ -1162,7 +1162,7 @@ void CIRGenFunction::buildDestructorBody(FunctionArgList &Args) { llvm_unreachable("NYI"); // EnterCXXTryStmt(*cast(Body), true); } - if (MissingFeatures::emitAsanPrologueOrEpilogue()) + if (cir::MissingFeatures::emitAsanPrologueOrEpilogue()) llvm_unreachable("NYI"); // Enter the epilogue cleanups. @@ -1325,7 +1325,7 @@ void CIRGenFunction::EnterDtorCleanups(const CXXDestructorDecl *DD, if (CGM.getCodeGenOpts().SanitizeMemoryUseAfterDtor && SanOpts.has(SanitizerKind::Memory) && ClassDecl->getNumVBases() && ClassDecl->isPolymorphic()) - assert(!MissingFeatures::sanitizeDtor()); + assert(!cir::MissingFeatures::sanitizeDtor()); // We push them in the forward order so that they'll be popped in // the reverse order. @@ -1337,7 +1337,7 @@ void CIRGenFunction::EnterDtorCleanups(const CXXDestructorDecl *DD, // Under SanitizeMemoryUseAfterDtor, poison the trivial base class // memory. For non-trival base classes the same is done in the class // destructor. - assert(!MissingFeatures::sanitizeDtor()); + assert(!cir::MissingFeatures::sanitizeDtor()); } else { EHStack.pushCleanup(NormalAndEHCleanup, BaseClassDecl, /*BaseIsVirtual*/ true); @@ -1353,7 +1353,7 @@ void CIRGenFunction::EnterDtorCleanups(const CXXDestructorDecl *DD, if (CGM.getCodeGenOpts().SanitizeMemoryUseAfterDtor && SanOpts.has(SanitizerKind::Memory) && !ClassDecl->getNumVBases() && ClassDecl->isPolymorphic()) - assert(!MissingFeatures::sanitizeDtor()); + assert(!cir::MissingFeatures::sanitizeDtor()); // Destroy non-virtual bases. for (const auto &Base : ClassDecl->bases()) { @@ -1366,7 +1366,7 @@ void CIRGenFunction::EnterDtorCleanups(const CXXDestructorDecl *DD, if (BaseClassDecl->hasTrivialDestructor()) { if (CGM.getCodeGenOpts().SanitizeMemoryUseAfterDtor && SanOpts.has(SanitizerKind::Memory) && !BaseClassDecl->isEmpty()) - assert(!MissingFeatures::sanitizeDtor()); + assert(!cir::MissingFeatures::sanitizeDtor()); } else { EHStack.pushCleanup(NormalAndEHCleanup, BaseClassDecl, /*BaseIsVirtual*/ false); @@ -1377,12 +1377,12 @@ void CIRGenFunction::EnterDtorCleanups(const CXXDestructorDecl *DD, // invoked, and before the base class destructor runs, is invalid. bool SanitizeFields = CGM.getCodeGenOpts().SanitizeMemoryUseAfterDtor && SanOpts.has(SanitizerKind::Memory); - assert(!MissingFeatures::sanitizeDtor()); + assert(!cir::MissingFeatures::sanitizeDtor()); // Destroy direct fields. for (const auto *Field : ClassDecl->fields()) { if (SanitizeFields) - assert(!MissingFeatures::sanitizeDtor()); + assert(!cir::MissingFeatures::sanitizeDtor()); QualType type = Field->getType(); QualType::DestructionKind dtorKind = type.isDestructedType(); @@ -1400,7 +1400,7 @@ void CIRGenFunction::EnterDtorCleanups(const CXXDestructorDecl *DD, } if (SanitizeFields) - assert(!MissingFeatures::sanitizeDtor()); + assert(!cir::MissingFeatures::sanitizeDtor()); } namespace { @@ -1571,7 +1571,7 @@ CIRGenFunction::getAddressOfBaseClass(Address Value, // Get the base pointer type. auto BaseValueTy = convertType((PathEnd[-1])->getType()); - assert(!MissingFeatures::addressSpace()); + assert(!cir::MissingFeatures::addressSpace()); // If there is no virtual base, use cir.base_class_addr. It takes care of // the adjustment and the null pointer check. @@ -1585,7 +1585,7 @@ CIRGenFunction::getAddressOfBaseClass(Address Value, } if (sanitizePerformTypeCheck()) { - assert(!MissingFeatures::sanitizeOther()); + assert(!cir::MissingFeatures::sanitizeOther()); } // Conversion to a virtual base. cir.base_class_addr can't handle this. @@ -1651,11 +1651,11 @@ mlir::Value CIRGenFunction::getVTablePtr(mlir::Location Loc, Address This, const CXXRecordDecl *RD) { Address VTablePtrSrc = builder.createElementBitCast(Loc, This, VTableTy); auto VTable = builder.createLoad(Loc, VTablePtrSrc); - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); if (CGM.getCodeGenOpts().OptimizationLevel > 0 && CGM.getCodeGenOpts().StrictVTablePointers) { - assert(!MissingFeatures::createInvariantGroup()); + assert(!cir::MissingFeatures::createInvariantGroup()); } return VTable; @@ -1664,7 +1664,7 @@ mlir::Value CIRGenFunction::getVTablePtr(mlir::Location Loc, Address This, Address CIRGenFunction::buildCXXMemberDataPointerAddress( const Expr *E, Address base, mlir::Value memberPtr, const MemberPointerType *memberPtrType, LValueBaseInfo *baseInfo) { - assert(!MissingFeatures::cxxABI()); + assert(!cir::MissingFeatures::cxxABI()); auto op = builder.createGetIndirectMember(getLoc(E->getSourceRange()), base.getPointer(), memberPtr); @@ -1896,7 +1896,7 @@ void CIRGenFunction::buildCXXConstructorCall(const clang::CXXConstructorDecl *D, // If this is a union copy constructor, we must emit a memcpy, because the AST // does not model that copy. if (isMemcpyEquivalentSpecialMember(D)) { - assert(!MissingFeatures::isMemcpyEquivalentSpecialMember()); + assert(!cir::MissingFeatures::isMemcpyEquivalentSpecialMember()); } const FunctionProtoType *FPT = D->getType()->castAs(); @@ -1928,10 +1928,10 @@ void CIRGenFunction::buildCXXConstructorCall( // In LLVM: do nothing. // In CIR: emit as a regular call, other later passes should lower the // ctor call into trivial initialization. - assert(!MissingFeatures::isTrivialCtorOrDtor()); + assert(!cir::MissingFeatures::isTrivialCtorOrDtor()); if (isMemcpyEquivalentSpecialMember(D)) { - assert(!MissingFeatures::isMemcpyEquivalentSpecialMember()); + assert(!cir::MissingFeatures::isMemcpyEquivalentSpecialMember()); } bool PassPrototypeArgs = true; @@ -2013,7 +2013,7 @@ void CIRGenFunction::buildInlinedInheritingCXXConstructorCall( llvm_unreachable("NYI"); InlinedInheritingConstructorScope Scope(*this, GD); // TODO(cir): ApplyInlineDebugLocation - assert(!MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::generateDebugInfo()); RunCleanupsScope RunCleanups(*this); // Save the arguments to be passed to the inherited constructor. diff --git a/clang/lib/CIR/CodeGen/CIRGenCleanup.cpp b/clang/lib/CIR/CodeGen/CIRGenCleanup.cpp index 5fe55892f861..679d9a9399f7 100644 --- a/clang/lib/CIR/CodeGen/CIRGenCleanup.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenCleanup.cpp @@ -38,7 +38,7 @@ mlir::cir::BrOp CIRGenFunction::buildBranchThroughCleanup(mlir::Location Loc, // Remove this once we go for making sure unreachable code is // well modeled (or not). assert(builder.getInsertionBlock() && "not yet implemented"); - assert(!MissingFeatures::ehStack()); + assert(!cir::MissingFeatures::ehStack()); // Insert a branch: to the cleanup block (unsolved) or to the already // materialized label. Keep track of unsolved goto's. @@ -260,7 +260,7 @@ static void buildCleanup(CIRGenFunction &CGF, EHScopeStack::Cleanup *Fn, // If there's an active flag, load it and skip the cleanup if it's // false. - cir::CIRGenBuilderTy &builder = CGF.getBuilder(); + CIRGenBuilderTy &builder = CGF.getBuilder(); mlir::Location loc = CGF.currSrcLoc ? *CGF.currSrcLoc : builder.getUnknownLoc(); @@ -502,7 +502,7 @@ void CIRGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) { // FIXME(cir): LLVM traditional codegen tries to simplify some of the // codegen here. Once we are further down with EH support revisit whether we // need to this during lowering. - assert(!MissingFeatures::simplifyCleanupEntry()); + assert(!cir::MissingFeatures::simplifyCleanupEntry()); } } diff --git a/clang/lib/CIR/CodeGen/CIRGenCoroutine.cpp b/clang/lib/CIR/CodeGen/CIRGenCoroutine.cpp index e46ebdd1357f..eed9019fdbbb 100644 --- a/clang/lib/CIR/CodeGen/CIRGenCoroutine.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenCoroutine.cpp @@ -296,7 +296,7 @@ CIRGenFunction::buildCoroutineBody(const CoroutineBodyStmt &S) { // FIXME(cir): create a new scope to copy out the params? // LLVM create scope cleanups here, but might be due to the use // of many basic blocks? - assert(!MissingFeatures::generateDebugInfo() && "NYI"); + assert(!cir::MissingFeatures::generateDebugInfo() && "NYI"); ParamReferenceReplacerRAII ParamReplacer(LocalDeclMap); // Create mapping between parameters and copy-params for coroutine @@ -306,7 +306,7 @@ CIRGenFunction::buildCoroutineBody(const CoroutineBodyStmt &S) { "ParamMoves and FnArgs should be the same size for coroutine " "function"); // For zipping the arg map into debug info. - assert(!MissingFeatures::generateDebugInfo() && "NYI"); + assert(!cir::MissingFeatures::generateDebugInfo() && "NYI"); // Create parameter copies. We do it before creating a promise, since an // evolution of coroutine TS may allow promise constructor to observe @@ -347,7 +347,7 @@ CIRGenFunction::buildCoroutineBody(const CoroutineBodyStmt &S) { // FIXME(cir): wrap buildBodyAndFallthrough with try/catch bits. if (S.getExceptionHandler()) - assert(!MissingFeatures::unhandledException() && "NYI"); + assert(!cir::MissingFeatures::unhandledException() && "NYI"); if (buildBodyAndFallthrough(*this, S, S.getBody(), currLexScope).failed()) return mlir::failure(); diff --git a/clang/lib/CIR/CodeGen/CIRGenDecl.cpp b/clang/lib/CIR/CodeGen/CIRGenDecl.cpp index fa3654262f9e..d68dceabbf22 100644 --- a/clang/lib/CIR/CodeGen/CIRGenDecl.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenDecl.cpp @@ -53,8 +53,8 @@ CIRGenFunction::buildAutoVarAlloca(const VarDecl &D, if (Ty->isVariablyModifiedType()) buildVariablyModifiedType(Ty); - assert(!MissingFeatures::generateDebugInfo()); - assert(!MissingFeatures::cxxABI()); + assert(!cir::MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::cxxABI()); Address address = Address::invalid(); Address allocaAddr = Address::invalid(); @@ -152,7 +152,7 @@ CIRGenFunction::buildAutoVarAlloca(const VarDecl &D, } // TODO: what about emitting lifetime markers for MSVC catch parameters? // TODO: something like @llvm.lifetime.start/end here? revisit this later. - assert(!MissingFeatures::shouldEmitLifetimeMarkers()); + assert(!cir::MissingFeatures::shouldEmitLifetimeMarkers()); } } else { // not openmp nor constant sized type bool VarAllocated = false; @@ -189,20 +189,20 @@ CIRGenFunction::buildAutoVarAlloca(const VarDecl &D, // If we have debug info enabled, properly describe the VLA dimensions for // this type by registering the vla size expression for each of the // dimensions. - assert(!MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::generateDebugInfo()); } emission.Addr = address; setAddrOfLocalVar(&D, emission.Addr); // Emit debug info for local var declaration. - assert(!MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::generateDebugInfo()); if (D.hasAttr()) buildVarAnnotations(&D, address.emitRawPointer()); // TODO(cir): in LLVM this calls @llvm.lifetime.end. - assert(!MissingFeatures::shouldEmitLifetimeMarkers()); + assert(!cir::MissingFeatures::shouldEmitLifetimeMarkers()); return emission; } @@ -231,12 +231,12 @@ static void emitStoresForConstant(CIRGenModule &CGM, const VarDecl &D, uint64_t ConstantSize = layout.getTypeAllocSize(Ty); if (!ConstantSize) return; - assert(!MissingFeatures::addAutoInitAnnotation()); - assert(!MissingFeatures::vectorConstants()); - assert(!MissingFeatures::shouldUseBZeroPlusStoresToInitialize()); - assert(!MissingFeatures::shouldUseMemSetToInitialize()); - assert(!MissingFeatures::shouldSplitConstantStore()); - assert(!MissingFeatures::shouldCreateMemCpyFromGlobal()); + assert(!cir::MissingFeatures::addAutoInitAnnotation()); + assert(!cir::MissingFeatures::vectorConstants()); + assert(!cir::MissingFeatures::shouldUseBZeroPlusStoresToInitialize()); + assert(!cir::MissingFeatures::shouldUseMemSetToInitialize()); + assert(!cir::MissingFeatures::shouldSplitConstantStore()); + assert(!cir::MissingFeatures::shouldCreateMemCpyFromGlobal()); // In CIR we want to emit a store for the whole thing, later lowering // prepare to LLVM should unwrap this into the best policy (see asserts // above). @@ -284,7 +284,7 @@ void CIRGenFunction::buildAutoVarInit(const AutoVarEmission &emission) { // Check whether this is a byref variable that's potentially // captured and moved by its own initializer. If so, we'll need to // emit the initializer first, then copy into the variable. - assert(!MissingFeatures::capturedByInit() && "NYI"); + assert(!cir::MissingFeatures::capturedByInit() && "NYI"); // Note: constexpr already initializes everything correctly. LangOptions::TrivialAutoVarInitKind trivialAutoVarInit = @@ -528,7 +528,7 @@ CIRGenModule::getOrCreateStaticVarDecl(const VarDecl &D, // never defer them. assert(isa(DC) && "unexpected parent code decl"); } - if (GD.getDecl() && MissingFeatures::openMP()) { + if (GD.getDecl() && cir::MissingFeatures::openMP()) { // Disable emission of the parent function for the OpenMP device codegen. llvm_unreachable("OpenMP is NYI"); } @@ -585,9 +585,9 @@ mlir::cir::GlobalOp CIRGenFunction::addInitializerToStaticVarDecl( GV.setGlobalVisibilityAttr(OldGV.getGlobalVisibilityAttr()); GV.setInitialValueAttr(Init); GV.setTlsModelAttr(OldGV.getTlsModelAttr()); - assert(!MissingFeatures::setDSOLocal()); - assert(!MissingFeatures::setComdat()); - assert(!MissingFeatures::addressSpaceInGlobalVar()); + assert(!cir::MissingFeatures::setDSOLocal()); + assert(!cir::MissingFeatures::setComdat()); + assert(!cir::MissingFeatures::addressSpaceInGlobalVar()); // Normally this should be done with a call to CGM.replaceGlobal(OldGV, GV), // but since at this point the current block hasn't been really attached, @@ -692,7 +692,7 @@ void CIRGenFunction::buildStaticVarDecl(const VarDecl &D, LocalDeclMap.find(&D)->second = Address(castedAddr, elemTy, alignment); CGM.setStaticLocalDeclAddress(&D, var); - assert(!MissingFeatures::reportGlobalToASan()); + assert(!cir::MissingFeatures::reportGlobalToASan()); // Emit global variable debug descriptor for static vars. auto *DI = getDebugInfo(); @@ -712,14 +712,14 @@ void CIRGenFunction::buildNullabilityCheck(LValue LHS, mlir::Value RHS, void CIRGenFunction::buildScalarInit(const Expr *init, mlir::Location loc, LValue lvalue, bool capturedByInit) { Qualifiers::ObjCLifetime lifetime = Qualifiers::ObjCLifetime::OCL_None; - assert(!MissingFeatures::objCLifetime()); + assert(!cir::MissingFeatures::objCLifetime()); if (!lifetime) { SourceLocRAIIObject Loc{*this, loc}; mlir::Value value = buildScalarExpr(init); if (capturedByInit) llvm_unreachable("NYI"); - assert(!MissingFeatures::emitNullabilityCheck()); + assert(!cir::MissingFeatures::emitNullabilityCheck()); buildStoreThroughLValue(RValue::get(value), lvalue, true); return; } @@ -743,10 +743,10 @@ void CIRGenFunction::buildExprAsInit(const Expr *init, const ValueDecl *D, return; } switch (CIRGenFunction::getEvaluationKind(type)) { - case TEK_Scalar: + case cir::TEK_Scalar: buildScalarInit(init, getLoc(D->getSourceRange()), lvalue); return; - case TEK_Complex: { + case cir::TEK_Complex: { mlir::Value complex = buildComplexExpr(init); if (capturedByInit) llvm_unreachable("NYI"); @@ -754,7 +754,7 @@ void CIRGenFunction::buildExprAsInit(const Expr *init, const ValueDecl *D, /*init*/ true); return; } - case TEK_Aggregate: + case cir::TEK_Aggregate: assert(!type->isAtomicType() && "NYI"); AggValueSlot::Overlap_t Overlap = AggValueSlot::MayOverlap; if (isa(D)) @@ -865,7 +865,7 @@ void CIRGenFunction::buildDecl(const Decl &D) { case Decl::Using: // using X; [C++] case Decl::UsingEnum: // using enum X; [C++] case Decl::UsingDirective: // using namespace X; [C++] - assert(!MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::generateDebugInfo()); return; case Decl::UsingPack: assert(0 && "Not implemented"); @@ -891,7 +891,7 @@ void CIRGenFunction::buildDecl(const Decl &D) { case Decl::TypeAlias: { // using X = int; [C++0x] QualType Ty = cast(D).getUnderlyingType(); if (auto *DI = getDebugInfo()) - assert(!MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::generateDebugInfo()); if (Ty->isVariablyModifiedType()) buildVariablyModifiedType(Ty); return; diff --git a/clang/lib/CIR/CodeGen/CIRGenException.cpp b/clang/lib/CIR/CodeGen/CIRGenException.cpp index 7101582af841..b7b6ba81b907 100644 --- a/clang/lib/CIR/CodeGen/CIRGenException.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenException.cpp @@ -215,7 +215,7 @@ struct FreeException final : EHScopeStack::Cleanup { FreeException(mlir::Value exn) : exn(exn) {} void Emit(CIRGenFunction &CGF, Flags flags) override { // OG LLVM codegen emits a no unwind call, CIR emits an operation. - cir::CIRGenBuilderTy &builder = CGF.getBuilder(); + CIRGenBuilderTy &builder = CGF.getBuilder(); mlir::Location loc = CGF.currSrcLoc ? *CGF.currSrcLoc : builder.getUnknownLoc(); builder.create( @@ -435,7 +435,7 @@ static void buildCatchDispatchBlock(CIRGenFunction &CGF, assert(typeValue && "fell into catch-all case!"); // Check for address space mismatch: if (typeValue->getType() != // argTy) - assert(!MissingFeatures::addressSpace()); + assert(!cir::MissingFeatures::addressSpace()); bool nextIsEnd = false; // If this is the last handler, we're at the end, and the next @@ -566,7 +566,7 @@ void CIRGenFunction::exitCXXTryStmt(const CXXTryStmt &S, bool IsFnTryBlock) { CGM.getCXXABI().emitBeginCatch(*this, C); // Emit the PGO counter increment. - assert(!MissingFeatures::incrementProfileCounter()); + assert(!cir::MissingFeatures::incrementProfileCounter()); // Perform the body of the catch. (void)buildStmt(C->getHandlerBlock(), /*useCurrentScope=*/true); @@ -601,7 +601,7 @@ void CIRGenFunction::exitCXXTryStmt(const CXXTryStmt &S, bool IsFnTryBlock) { llvm_unreachable("NYI"); } - assert(!MissingFeatures::incrementProfileCounter()); + assert(!cir::MissingFeatures::incrementProfileCounter()); } /// Check whether this is a non-EH scope, i.e. a scope which doesn't @@ -645,7 +645,7 @@ mlir::Operation *CIRGenFunction::buildLandingPad(mlir::cir::TryOp tryOp) { if (!catches || catches.empty()) { // Save the current CIR generation state. mlir::OpBuilder::InsertionGuard guard(builder); - assert(!MissingFeatures::generateDebugInfo() && "NYI"); + assert(!cir::MissingFeatures::generateDebugInfo() && "NYI"); // Traditional LLVM codegen creates the lpad basic block, extract // values, landing pad instructions, etc. diff --git a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp index 41721eb2d909..08b766eb35de 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp @@ -137,7 +137,7 @@ static Address buildPointerWithAlignment(const Expr *expr, CE->getSubExpr()->getType()->getAs()) { if (PtrTy->getPointeeType()->isVoidType()) break; - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); LValueBaseInfo innerBaseInfo; Address addr = cgf.buildPointerWithAlignment( @@ -146,7 +146,7 @@ static Address buildPointerWithAlignment(const Expr *expr, *baseInfo = innerBaseInfo; if (isa(CE)) { - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); LValueBaseInfo TargetTypeBaseInfo; CharUnits Align = cgf.CGM.getNaturalPointeeTypeAlignment( @@ -173,7 +173,7 @@ static Address buildPointerWithAlignment(const Expr *expr, addr = cgf.getBuilder().createElementBitCast( cgf.getLoc(expr->getSourceRange()), addr, ElemTy); if (CE->getCastKind() == CK_AddressSpaceConversion) { - assert(!MissingFeatures::addressSpace()); + assert(!cir::MissingFeatures::addressSpace()); llvm_unreachable("NYI"); } return addr; @@ -189,7 +189,7 @@ static Address buildPointerWithAlignment(const Expr *expr, // TODO: Support accesses to members of base classes in TBAA. For now, we // conservatively pretend that the complete object is of the base class // type. - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); Address Addr = cgf.buildPointerWithAlignment(CE->getSubExpr(), baseInfo); auto Derived = CE->getSubExpr()->getType()->getPointeeCXXRecordDecl(); return cgf.getAddressOfBaseClass( @@ -211,7 +211,7 @@ static Address buildPointerWithAlignment(const Expr *expr, LValue LV = cgf.buildLValue(UO->getSubExpr()); if (baseInfo) *baseInfo = LV.getBaseInfo(); - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); return LV.getAddress(); } } @@ -290,7 +290,7 @@ LValue CIRGenFunction::buildLValueForBitField(LValue base, QualType fieldType = field->getType().withCVRQualifiers(base.getVRQualifiers()); - assert(!MissingFeatures::tbaa() && "NYI TBAA for bit fields"); + assert(!cir::MissingFeatures::tbaa() && "NYI TBAA for bit fields"); LValueBaseInfo fieldBaseInfo(BaseInfo.getAlignmentSource()); return LValue::MakeBitfield(Addr, info, fieldType, fieldBaseInfo, TBAAAccessInfo()); @@ -309,15 +309,15 @@ LValue CIRGenFunction::buildLValueForField(LValue base, const RecordDecl *rec = field->getParent(); AlignmentSource BaseAlignSource = BaseInfo.getAlignmentSource(); LValueBaseInfo FieldBaseInfo(getFieldAlignmentSource(BaseAlignSource)); - if (MissingFeatures::tbaa() || rec->hasAttr() || + if (cir::MissingFeatures::tbaa() || rec->hasAttr() || FieldType->isVectorType()) { - assert(!MissingFeatures::tbaa() && "NYI"); + assert(!cir::MissingFeatures::tbaa() && "NYI"); } else if (rec->isUnion()) { - assert(!MissingFeatures::tbaa() && "NYI"); + assert(!cir::MissingFeatures::tbaa() && "NYI"); } else { // If no base type been assigned for the base access, then try to generate // one for this base lvalue. - assert(!MissingFeatures::tbaa() && "NYI"); + assert(!cir::MissingFeatures::tbaa() && "NYI"); } Address addr = base.getAddress(); @@ -342,11 +342,11 @@ LValue CIRGenFunction::buildLValueForField(LValue base, hasAnyVptr(FieldType, getContext())) // Because unions can easily skip invariant.barriers, we need to add // a barrier every time CXXRecord field with vptr is referenced. - assert(!MissingFeatures::createInvariantGroup()); + assert(!cir::MissingFeatures::createInvariantGroup()); if (IsInPreservedAIRegion || (getDebugInfo() && rec->hasAttr())) { - assert(!MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::generateDebugInfo()); } if (FieldType->isReferenceType()) @@ -368,7 +368,7 @@ LValue CIRGenFunction::buildLValueForField(LValue base, // If this is a reference field, load the reference right now. if (FieldType->isReferenceType()) { - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); LValue RefLVal = makeAddrLValue(addr, FieldType, FieldBaseInfo); if (RecordCVR & Qualifiers::Volatile) RefLVal.getQuals().addVolatile(); @@ -390,7 +390,7 @@ LValue CIRGenFunction::buildLValueForField(LValue base, if (field->hasAttr()) llvm_unreachable("NYI"); - if (MissingFeatures::tbaa()) + if (cir::MissingFeatures::tbaa()) // Next line should take a TBAA object llvm_unreachable("NYI"); LValue LV = makeAddrLValue(addr, FieldType, FieldBaseInfo); @@ -426,7 +426,7 @@ LValue CIRGenFunction::buildLValueForFieldInitialization( LValueBaseInfo BaseInfo = Base.getBaseInfo(); AlignmentSource FieldAlignSource = BaseInfo.getAlignmentSource(); LValueBaseInfo FieldBaseInfo(getFieldAlignmentSource(FieldAlignSource)); - assert(!MissingFeatures::tbaa() && "NYI"); + assert(!cir::MissingFeatures::tbaa() && "NYI"); return makeAddrLValue(V, FieldType, FieldBaseInfo); } @@ -482,7 +482,7 @@ static CIRGenCallee buildDirectCallee(CIRGenModule &CGM, GlobalDecl GD) { bool IsPredefinedLibFunction = CGM.getASTContext().BuiltinInfo.isPredefinedLibFunction(builtinID); bool HasAttributeNoBuiltin = false; - assert(!MissingFeatures::attributeNoBuiltin() && "NYI"); + assert(!cir::MissingFeatures::attributeNoBuiltin() && "NYI"); // bool HasAttributeNoBuiltin = // CGF.CurFn->getAttributes().hasFnAttr(NoBuiltinFD) || // CGF.CurFn->getAttributes().hasFnAttr(NoBuiltins); @@ -639,7 +639,7 @@ void CIRGenFunction::buildStoreOfScalar(mlir::Value value, Address addr, llvm_unreachable("NYI"); } - if (MissingFeatures::tbaa()) + if (cir::MissingFeatures::tbaa()) llvm_unreachable("NYI"); } @@ -736,7 +736,7 @@ RValue CIRGenFunction::buildLoadOfBitfieldLValue(LValue LV, auto field = builder.createGetBitfield(getLoc(Loc), resLTy, ptr.getPointer(), ptr.getElementType(), info, LV.isVolatile(), useVolatile); - assert(!MissingFeatures::emitScalarRangeCheck() && "NYI"); + assert(!cir::MissingFeatures::emitScalarRangeCheck() && "NYI"); return RValue::get(field); } @@ -917,7 +917,7 @@ static LValue buildGlobalVarDeclLValue(CIRGenFunction &CGF, const Expr *E, assert(0 && "NYI"); else LV = CGF.makeAddrLValue(Addr, T, AlignmentSource::Decl); - assert(!MissingFeatures::setObjCGCLValueClass() && "NYI"); + assert(!cir::MissingFeatures::setObjCGCLValueClass() && "NYI"); return LV; } @@ -973,12 +973,12 @@ LValue CIRGenFunction::buildDeclRefLValue(const DeclRefExpr *E) { VD = VD->getCanonicalDecl(); if (auto *FD = LambdaCaptureFields.lookup(VD)) return buildCapturedFieldLValue(*this, FD, CXXABIThisValue); - assert(!MissingFeatures::CGCapturedStmtInfo() && "NYI"); + assert(!cir::MissingFeatures::CGCapturedStmtInfo() && "NYI"); // TODO[OpenMP]: Find the appropiate captured variable value and return // it. // TODO[OpenMP]: Set non-temporal information in the captured LVal. // LLVM codegen: - assert(!MissingFeatures::openMP()); + assert(!cir::MissingFeatures::openMP()); // Address addr = GetAddrOfBlockDecl(VD); // return MakeAddrLValue(addr, T, AlignmentSource::Decl); } @@ -1051,15 +1051,15 @@ LValue CIRGenFunction::buildDeclRefLValue(const DeclRefExpr *E) { bool NonGCable = isLocalStorage && !VD->getType()->isReferenceType() && !isBlockByref; - if (NonGCable && MissingFeatures::setNonGC()) { + if (NonGCable && cir::MissingFeatures::setNonGC()) { llvm_unreachable("garbage collection is NYI"); } bool isImpreciseLifetime = (isLocalStorage && !VD->hasAttr()); - if (isImpreciseLifetime && MissingFeatures::ARC()) + if (isImpreciseLifetime && cir::MissingFeatures::ARC()) llvm_unreachable("imprecise lifetime is NYI"); - assert(!MissingFeatures::setObjCGCLValueClass()); + assert(!cir::MissingFeatures::setObjCGCLValueClass()); // Statics are defined as globals, so they are not include in the function's // symbol table. @@ -1074,7 +1074,7 @@ LValue CIRGenFunction::buildDeclRefLValue(const DeclRefExpr *E) { // Emit debuginfo for the function declaration if the target wants to. if (getContext().getTargetInfo().allowDebugInfoForExternalRef()) - assert(!MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::generateDebugInfo()); return LV; } @@ -1118,7 +1118,7 @@ CIRGenFunction::buildPointerToDataMemberBinaryExpr(const BinaryOperator *E) { LValueBaseInfo baseInfo; // TODO(cir): add TBAA - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); auto memberAddr = buildCXXMemberDataPointerAddress(E, baseAddr, memberPtr, memberPtrTy, &baseInfo); @@ -1136,7 +1136,7 @@ CIRGenFunction::buildExtVectorElementExpr(const ExtVectorElementExpr *E) { // it. LValueBaseInfo BaseInfo; // TODO(cir): Support TBAA - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); Address Ptr = buildPointerWithAlignment(E->getBase(), &BaseInfo); const auto *PT = E->getBase()->getType()->castAs(); base = makeAddrLValue(Ptr, PT->getPointeeType(), BaseInfo); @@ -1206,7 +1206,7 @@ LValue CIRGenFunction::buildBinaryOperatorLValue(const BinaryOperator *E) { // evaluated first just in case the variable gets moved by the RHS. switch (CIRGenFunction::getEvaluationKind(E->getType())) { - case TEK_Scalar: { + case cir::TEK_Scalar: { assert(E->getLHS()->getType().getObjCLifetime() == clang::Qualifiers::ObjCLifetime::OCL_None && "not implemented"); @@ -1227,9 +1227,9 @@ LValue CIRGenFunction::buildBinaryOperatorLValue(const BinaryOperator *E) { return LV; } - case TEK_Complex: + case cir::TEK_Complex: return buildComplexAssignmentLValue(E); - case TEK_Aggregate: + case cir::TEK_Aggregate: assert(0 && "not implemented"); } llvm_unreachable("bad evaluation kind"); @@ -1313,7 +1313,7 @@ LValue CIRGenFunction::buildUnaryOpLValue(const UnaryOperator *E) { ? buildAddrOfRealComponent(Loc, LV.getAddress(), LV.getType()) : buildAddrOfImagComponent(Loc, LV.getAddress(), LV.getType())); // TODO(cir): TBAA info. - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); LValue ElemLV = makeAddrLValue(Component, T, LV.getBaseInfo()); ElemLV.getQuals().addQualifiers(LV.getQuals()); return ElemLV; @@ -1340,11 +1340,11 @@ LValue CIRGenFunction::buildUnaryOpLValue(const UnaryOperator *E) { RValue CIRGenFunction::buildAnyExpr(const Expr *E, AggValueSlot aggSlot, bool ignoreResult) { switch (CIRGenFunction::getEvaluationKind(E->getType())) { - case TEK_Scalar: + case cir::TEK_Scalar: return RValue::get(buildScalarExpr(E)); - case TEK_Complex: + case cir::TEK_Complex: return RValue::getComplex(buildComplexExpr(E)); - case TEK_Aggregate: { + case cir::TEK_Aggregate: { if (!ignoreResult && aggSlot.isIgnored()) aggSlot = CreateAggTemp(E->getType(), getLoc(E->getSourceRange()), getCounterAggTmpAsString()); @@ -1384,18 +1384,18 @@ RValue CIRGenFunction::GetUndefRValue(QualType ty) { return RValue::get(nullptr); switch (getEvaluationKind(ty)) { - case TEK_Complex: { + case cir::TEK_Complex: { llvm_unreachable("NYI"); } // If this is a use of an undefined aggregate type, the aggregate must have // an identifiable address. Just because the contents of the value are // undefined doesn't mean that the address can't be taken and compared. - case TEK_Aggregate: { + case cir::TEK_Aggregate: { llvm_unreachable("NYI"); } - case TEK_Scalar: + case cir::TEK_Scalar: llvm_unreachable("NYI"); } llvm_unreachable("bad evaluation kind"); @@ -1489,8 +1489,8 @@ RValue CIRGenFunction::buildCall(clang::QualType CalleeType, // Chain calls use the same code path to add the inviisble chain parameter to // the function type. if (isa(FnType) || Chain) { - assert(!MissingFeatures::chainCall()); - assert(!MissingFeatures::addressSpace()); + assert(!cir::MissingFeatures::chainCall()); + assert(!cir::MissingFeatures::addressSpace()); auto CalleeTy = getTypes().GetFunctionType(FnInfo); // get non-variadic function type CalleeTy = mlir::cir::FuncType::get(CalleeTy.getInputs(), @@ -1568,7 +1568,7 @@ Address CIRGenFunction::buildArrayToPointerDecay(const Expr *E, QualType EltType = E->getType()->castAsArrayTypeUnsafe()->getElementType(); if (BaseInfo) *BaseInfo = LV.getBaseInfo(); - assert(!MissingFeatures::tbaa() && "NYI"); + assert(!cir::MissingFeatures::tbaa() && "NYI"); mlir::Value ptr = CGM.getBuilder().maybeBuildArrayDecay( CGM.getLoc(E->getSourceRange()), Addr.getPointer(), @@ -1664,7 +1664,7 @@ buildArraySubscriptPtr(CIRGenFunction &CGF, mlir::Location beginLoc, // TODO(cir): LLVM codegen emits in bound gep check here, is there anything // that would enhance tracking this later in CIR? if (inbounds) - assert(!MissingFeatures::emitCheckedInBoundsGEP() && "NYI"); + assert(!cir::MissingFeatures::emitCheckedInBoundsGEP() && "NYI"); return CGM.getBuilder().getArrayElement(beginLoc, endLoc, ptr, eltTy, idx, shouldDecay); } @@ -1764,7 +1764,7 @@ LValue CIRGenFunction::buildArraySubscriptExpr(const ArraySubscriptExpr *E, llvm_unreachable("extvector subscript is NYI"); } - assert(!MissingFeatures::tbaa() && "TBAA is NYI"); + assert(!cir::MissingFeatures::tbaa() && "TBAA is NYI"); LValueBaseInfo EltBaseInfo; Address Addr = Address::invalid(); if (const VariableArrayType *vla = @@ -1816,11 +1816,11 @@ LValue CIRGenFunction::buildArraySubscriptExpr(const ArraySubscriptExpr *E, E->getBase()); EltBaseInfo = ArrayLV.getBaseInfo(); // TODO(cir): EltTBAAInfo - assert(!MissingFeatures::tbaa() && "TBAA is NYI"); + assert(!cir::MissingFeatures::tbaa() && "TBAA is NYI"); } else { // The base must be a pointer; emit it with an estimate of its alignment. // TODO(cir): EltTBAAInfo - assert(!MissingFeatures::tbaa() && "TBAA is NYI"); + assert(!cir::MissingFeatures::tbaa() && "TBAA is NYI"); Addr = buildPointerWithAlignment(E->getBase(), &EltBaseInfo); auto Idx = EmitIdxAfterBase(/*Promote*/ true); QualType ptrType = E->getBase()->getType(); @@ -1979,7 +1979,7 @@ LValue CIRGenFunction::buildCastLValue(const CastExpr *E) { // TODO: Support accesses to members of base classes in TBAA. For now, we // conservatively pretend that the complete object is of the base class // type. - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); return makeAddrLValue(Base, E->getType(), LV.getBaseInfo()); } case CK_ToUnion: @@ -1998,7 +1998,7 @@ LValue CIRGenFunction::buildCastLValue(const CastExpr *E) { auto DestAS = builder.getAddrSpaceAttr(E->getType().getAddressSpace()); mlir::Value V = getTargetHooks().performAddrSpaceCast( *this, LV.getPointer(), SrcAS, DestAS, ConvertType(DestTy)); - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); return makeAddrLValue(Address(V, getTypes().convertTypeForMem(E->getType()), LV.getAddress().getAlignment()), E->getType(), LV.getBaseInfo()); @@ -2099,7 +2099,7 @@ LValue CIRGenFunction::buildMemberExpr(const MemberExpr *E) { NamedDecl *ND = E->getMemberDecl(); if (auto *Field = dyn_cast(ND)) { LValue LV = buildLValueForField(BaseLV, Field); - assert(!MissingFeatures::setObjCGCLValueClass() && "NYI"); + assert(!cir::MissingFeatures::setObjCGCLValueClass() && "NYI"); if (getLangOpts().OpenMP) { // If the member was explicitly marked as nontemporal, mark it as // nontemporal. If the base lvalue is marked as nontemporal, mark access @@ -2134,11 +2134,11 @@ void CIRGenFunction::buildAnyExprToMem(const Expr *E, Address Location, Qualifiers Quals, bool IsInit) { // FIXME: This function should take an LValue as an argument. switch (getEvaluationKind(E->getType())) { - case TEK_Complex: + case cir::TEK_Complex: assert(0 && "NYI"); return; - case TEK_Aggregate: { + case cir::TEK_Aggregate: { buildAggExpr(E, AggValueSlot::forAddr(Location, Quals, AggValueSlot::IsDestructed_t(IsInit), AggValueSlot::DoesNotNeedGCBarriers, @@ -2147,7 +2147,7 @@ void CIRGenFunction::buildAnyExprToMem(const Expr *E, Address Location, return; } - case TEK_Scalar: { + case cir::TEK_Scalar: { RValue RV = RValue::get(buildScalarExpr(E)); LValue LV = makeAddrLValue(Location, E->getType()); buildStoreThroughLValue(RV, LV); @@ -2304,7 +2304,7 @@ LValue CIRGenFunction::buildMaterializeTemporaryExpr( } else { switch (M->getStorageDuration()) { case SD_Automatic: - assert(!MissingFeatures::shouldEmitLifetimeMarkers()); + assert(!cir::MissingFeatures::shouldEmitLifetimeMarkers()); break; case SD_FullExpression: { @@ -2381,7 +2381,7 @@ std::optional HandleConditionalOperatorLValueSimpleCase( if (!CGF.ContainsLabel(Dead)) { // If the true case is live, we need to track its region. if (CondExprBool) { - assert(!MissingFeatures::incrementProfileCounter()); + assert(!cir::MissingFeatures::incrementProfileCounter()); } // If a throw expression we emit it and return an undefined lvalue // because it can't be used. @@ -2455,7 +2455,7 @@ CIRGenFunction::buildConditionalBlocks(const AbstractConditionalOperator *E, *this, loc, b.getInsertionBlock()}; CGF.currLexScope->setAsTernary(); - assert(!MissingFeatures::incrementProfileCounter()); + assert(!cir::MissingFeatures::incrementProfileCounter()); eval.begin(CGF); Info.LHS = BranchGenFunc(CGF, trueExpr); auto lhs = Info.LHS->getPointer(); @@ -2476,7 +2476,7 @@ CIRGenFunction::buildConditionalBlocks(const AbstractConditionalOperator *E, *this, loc, b.getInsertionBlock()}; CGF.currLexScope->setAsTernary(); - assert(!MissingFeatures::incrementProfileCounter()); + assert(!cir::MissingFeatures::incrementProfileCounter()); eval.begin(CGF); Info.RHS = BranchGenFunc(CGF, falseExpr); auto rhs = Info.RHS->getPointer(); @@ -2529,7 +2529,7 @@ LValue CIRGenFunction::buildConditionalOperatorLValue( AlignmentSource alignSource = std::max(Info.LHS->getBaseInfo().getAlignmentSource(), Info.RHS->getBaseInfo().getAlignmentSource()); - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); return makeAddrLValue(result, expr->getType(), LValueBaseInfo(alignSource)); } else { llvm_unreachable("NYI"); @@ -2643,11 +2643,11 @@ RValue CIRGenFunction::convertTempToRValue(Address addr, clang::QualType type, clang::SourceLocation loc) { LValue lvalue = makeAddrLValue(addr, type, AlignmentSource::Decl); switch (getEvaluationKind(type)) { - case TEK_Complex: + case cir::TEK_Complex: llvm_unreachable("NYI"); - case TEK_Aggregate: + case cir::TEK_Aggregate: return lvalue.asAggregateRValue(); - case TEK_Scalar: + case cir::TEK_Scalar: return RValue::get(buildLoadOfScalar(lvalue, loc)); } llvm_unreachable("NYI"); @@ -2739,7 +2739,7 @@ mlir::Value CIRGenFunction::buildOpOnBoolExpr(mlir::Location loc, // This should be done in CIR prior to LLVM lowering, if we do now // we can make CIR based diagnostics misleading. // cir.ternary(!x, t, f) -> cir.ternary(x, f, t) - assert(!MissingFeatures::shouldReverseUnaryCondOnBoolExpr()); + assert(!cir::MissingFeatures::shouldReverseUnaryCondOnBoolExpr()); } if (const ConditionalOperator *CondOp = dyn_cast(cond)) { @@ -2775,7 +2775,7 @@ mlir::Value CIRGenFunction::buildOpOnBoolExpr(mlir::Location loc, // Don't bother if not optimizing because that metadata would not be used. auto *Call = dyn_cast(cond->IgnoreImpCasts()); if (Call && CGM.getCodeGenOpts().OptimizationLevel != 0) { - assert(!MissingFeatures::insertBuiltinUnpredictable()); + assert(!cir::MissingFeatures::insertBuiltinUnpredictable()); } // Emit the code with the fully general case. @@ -2914,8 +2914,8 @@ mlir::Value CIRGenFunction::buildLoadOfScalar(Address addr, bool isVolatile, llvm_unreachable("NYI"); } - assert(!MissingFeatures::tbaa() && "NYI"); - assert(!MissingFeatures::emitScalarRangeCheck() && "NYI"); + assert(!cir::MissingFeatures::tbaa() && "NYI"); + assert(!cir::MissingFeatures::emitScalarRangeCheck() && "NYI"); return buildFromMemory(Load, ty); } @@ -2968,7 +2968,7 @@ Address CIRGenFunction::buildLoadOfReference(LValue refLVal, mlir::Location loc, refLVal.getAddress().getPointer()); // TODO(cir): DecorateInstructionWithTBAA relevant for us? - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); QualType pointeeType = refLVal.getType()->getPointeeType(); CharUnits align = diff --git a/clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp b/clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp index bf256ab01455..d8bd131c278d 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp @@ -208,7 +208,7 @@ class AggExprEmitter : public StmtVisitor { void VisitCallExpr(const CallExpr *E); void VisitStmtExpr(const StmtExpr *E) { - assert(!MissingFeatures::stmtExprEvaluation() && "NYI"); + assert(!cir::MissingFeatures::stmtExprEvaluation() && "NYI"); CGF.buildCompoundStmt(*E->getSubStmt(), /*getLast=*/true, Dest); } @@ -235,7 +235,7 @@ class AggExprEmitter : public StmtVisitor { // do an atomic copy. if (lhs.getType()->isAtomicType() || CGF.LValueIsSuitableForInlineAtomic(lhs)) { - assert(!MissingFeatures::atomicTypes()); + assert(!cir::MissingFeatures::atomicTypes()); return; } @@ -246,7 +246,7 @@ class AggExprEmitter : public StmtVisitor { // A non-volatile aggregate destination might have volatile member. if (!lhsSlot.isVolatile() && CGF.hasVolatileMember(E->getLHS()->getType())) - assert(!MissingFeatures::atomicTypes()); + assert(!cir::MissingFeatures::atomicTypes()); CGF.buildAggExpr(E->getRHS(), lhsSlot); @@ -386,7 +386,7 @@ void AggExprEmitter::buildAggLoadOfLValue(const Expr *E) { // If the type of the l-value is atomic, then do an atomic load. if (LV.getType()->isAtomicType() || CGF.LValueIsSuitableForInlineAtomic(LV) || - MissingFeatures::atomicTypes()) + cir::MissingFeatures::atomicTypes()) llvm_unreachable("atomic load is NYI"); buildFinalDestCopy(E->getType(), LV); @@ -411,7 +411,7 @@ void AggExprEmitter::buildFinalDestCopy(QualType type, const LValue &src, // Copy non-trivial C structs here. if (Dest.isVolatile()) - assert(!MissingFeatures::volatileTypes()); + assert(!cir::MissingFeatures::volatileTypes()); if (SrcValueKind == EVK_RValue) { if (type.isNonTrivialToPrimitiveDestructiveMove() == QualType::PCK_Struct) { @@ -594,7 +594,7 @@ void AggExprEmitter::buildArrayInit(Address DestPtr, mlir::cir::ArrayType AType, [&](mlir::OpBuilder &b, mlir::Location loc) { auto currentElement = builder.createLoad(loc, tmpAddr); - if (MissingFeatures::cleanups()) + if (cir::MissingFeatures::cleanups()) llvm_unreachable("NYI"); // Emit the actual filler expression. @@ -831,17 +831,17 @@ void AggExprEmitter::buildInitializationToLValue(Expr *E, LValue LV) { } switch (CGF.getEvaluationKind(type)) { - case TEK_Complex: + case cir::TEK_Complex: llvm_unreachable("NYI"); return; - case TEK_Aggregate: + case cir::TEK_Aggregate: CGF.buildAggExpr( E, AggValueSlot::forLValue(LV, AggValueSlot::IsDestructed, AggValueSlot::DoesNotNeedGCBarriers, AggValueSlot::IsNotAliased, AggValueSlot::MayOverlap, Dest.isZeroed())); return; - case TEK_Scalar: + case cir::TEK_Scalar: if (LV.isSimple()) { CGF.buildScalarInit(E, CGF.getLoc(E->getSourceRange()), LV); } else { @@ -887,7 +887,7 @@ void AggExprEmitter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) { } void AggExprEmitter::VisitExprWithCleanups(ExprWithCleanups *E) { - if (MissingFeatures::cleanups()) + if (cir::MissingFeatures::cleanups()) llvm_unreachable("NYI"); auto &builder = CGF.getBuilder(); @@ -1002,7 +1002,7 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) { // If we're loading from a volatile type, force the destination // into existence. if (E->getSubExpr()->getType().isVolatileQualified() || - MissingFeatures::volatileTypes()) { + cir::MissingFeatures::volatileTypes()) { bool Destruct = !Dest.isExternallyDestructed() && E->getType().isDestructedType() == QualType::DK_nontrivial_c_struct; @@ -1119,14 +1119,14 @@ void AggExprEmitter::withReturnValueSlot( (RequiresDestruction && !Dest.getAddress().isValid()); Address RetAddr = Address::invalid(); - assert(!MissingFeatures::shouldEmitLifetimeMarkers() && "NYI"); + assert(!cir::MissingFeatures::shouldEmitLifetimeMarkers() && "NYI"); if (!UseTemp) { RetAddr = Dest.getAddress(); } else { RetAddr = CGF.CreateMemTemp(RetTy, CGF.getLoc(E->getSourceRange()), "tmp", &RetAddr); - assert(!MissingFeatures::shouldEmitLifetimeMarkers() && "NYI"); + assert(!cir::MissingFeatures::shouldEmitLifetimeMarkers() && "NYI"); } RValue Src = @@ -1143,7 +1143,7 @@ void AggExprEmitter::withReturnValueSlot( // If there's no dtor to run, the copy was the last use of our temporary. // Since we're not guaranteed to be in an ExprWithCleanups, clean up // eagerly. - assert(!MissingFeatures::shouldEmitLifetimeMarkers() && "NYI"); + assert(!cir::MissingFeatures::shouldEmitLifetimeMarkers() && "NYI"); } } @@ -1345,7 +1345,7 @@ void AggExprEmitter::VisitCXXParenListOrInitListExpr( LValue LV = CGF.buildLValueForFieldInitialization(DestLV, field, field->getName()); // We never generate write-barries for initialized fields. - assert(!MissingFeatures::setNonGC()); + assert(!cir::MissingFeatures::setNonGC()); if (curInitIndex < NumInitElements) { // Store the initializer into the field. @@ -1401,7 +1401,7 @@ void AggExprEmitter::VisitAbstractConditionalOperator( // Bind the common expression if necessary. CIRGenFunction::OpaqueValueMapping binding(CGF, E); CIRGenFunction::ConditionalEvaluation eval(CGF); - assert(!MissingFeatures::getProfileCount()); + assert(!cir::MissingFeatures::getProfileCount()); // Save whether the destination's lifetime is externally managed. bool isExternallyDestructed = Dest.isExternallyDestructed(); @@ -1418,7 +1418,7 @@ void AggExprEmitter::VisitAbstractConditionalOperator( CIRGenFunction::LexicalScope lexScope{CGF, loc, builder.getInsertionBlock()}; Dest.setExternallyDestructed(isExternallyDestructed); - assert(!MissingFeatures::incrementProfileCounter()); + assert(!cir::MissingFeatures::incrementProfileCounter()); Visit(E->getTrueExpr()); } eval.end(CGF); @@ -1435,7 +1435,7 @@ void AggExprEmitter::VisitAbstractConditionalOperator( // with us, and we can safely emit the RHS into the same slot, but // we shouldn't claim that it's already being destructed. Dest.setExternallyDestructed(isExternallyDestructed); - assert(!MissingFeatures::incrementProfileCounter()); + assert(!cir::MissingFeatures::incrementProfileCounter()); Visit(E->getFalseExpr()); } eval.end(CGF); @@ -1444,7 +1444,7 @@ void AggExprEmitter::VisitAbstractConditionalOperator( if (destructNonTrivialCStruct) llvm_unreachable("NYI"); - assert(!MissingFeatures::incrementProfileCounter()); + assert(!cir::MissingFeatures::incrementProfileCounter()); } void AggExprEmitter::VisitBinComma(const BinaryOperator *E) { @@ -1715,7 +1715,7 @@ void CIRGenFunction::buildAggregateCopy(LValue Dest, LValue Src, QualType Ty, // Determine the metadata to describe the position of any padding in this // memcpy, as well as the TBAA tags for the members of the struct, in case // the optimizer wishes to expand it in to scalar memory operations. - if (CGM.getCodeGenOpts().NewStructPathTBAA || MissingFeatures::tbaa()) + if (CGM.getCodeGenOpts().NewStructPathTBAA || cir::MissingFeatures::tbaa()) llvm_unreachable("TBAA is NYI"); } diff --git a/clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp b/clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp index fb5d277a721e..6d5a20cbd4ea 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp @@ -183,7 +183,7 @@ RValue CIRGenFunction::buildCXXMemberOrOperatorMemberCallExpr( // one or the one of the full expression, we would have to build // a derived-to-base cast to compute the correct this pointer, but // we don't have support for that yet, so do a virtual call. - assert(!MissingFeatures::buildDerivedToBaseCastForDevirt()); + assert(!cir::MissingFeatures::buildDerivedToBaseCastForDevirt()); DevirtualizedMethod = nullptr; } } @@ -218,7 +218,7 @@ RValue CIRGenFunction::buildCXXMemberOrOperatorMemberCallExpr( LValue This; if (IsArrow) { LValueBaseInfo BaseInfo; - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); Address ThisValue = buildPointerWithAlignment(Base, &BaseInfo); This = makeAddrLValue(ThisValue, Base->getType(), BaseInfo); } else { @@ -284,7 +284,7 @@ RValue CIRGenFunction::buildCXXMemberOrOperatorMemberCallExpr( SkippedChecks.set(SanitizerKind::Null, true); } - if (MissingFeatures::buildTypeCheck()) + if (cir::MissingFeatures::buildTypeCheck()) llvm_unreachable("NYI"); // C++ [class.virtual]p12: @@ -726,14 +726,14 @@ static void StoreAnyExprIntoOneUnit(CIRGenFunction &CGF, const Expr *Init, AggValueSlot::Overlap_t MayOverlap) { // FIXME: Refactor with buildExprAsInit. switch (CGF.getEvaluationKind(AllocType)) { - case TEK_Scalar: + case cir::TEK_Scalar: CGF.buildScalarInit(Init, CGF.getLoc(Init->getSourceRange()), CGF.makeAddrLValue(NewPtr, AllocType), false); return; - case TEK_Complex: + case cir::TEK_Complex: llvm_unreachable("NYI"); return; - case TEK_Aggregate: { + case cir::TEK_Aggregate: { AggValueSlot Slot = AggValueSlot::forAddr( NewPtr, AllocType.getQualifiers(), AggValueSlot::IsDestructed, AggValueSlot::DoesNotNeedGCBarriers, AggValueSlot::IsNotAliased, @@ -750,7 +750,7 @@ static void buildNewInitializer(CIRGenFunction &CGF, const CXXNewExpr *E, QualType ElementType, mlir::Type ElementTy, Address NewPtr, mlir::Value NumElements, mlir::Value AllocSizeWithoutCookie) { - assert(!MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::generateDebugInfo()); if (E->isArray()) { llvm_unreachable("NYI"); } else if (const Expr *Init = E->getInitializer()) { @@ -872,7 +872,7 @@ static bool EmitObjectDelete(CIRGenFunction &CGF, const CXXDeleteExpr *DE, // In traditional LLVM codegen null checks are emitted to save a delete call. // In CIR we optimize for size by default, the null check should be added into // this function callers. - assert(!MissingFeatures::emitNullCheckForDeleteCalls()); + assert(!cir::MissingFeatures::emitNullCheckForDeleteCalls()); CGF.PopCleanupBlock(); return false; @@ -892,7 +892,7 @@ void CIRGenFunction::buildCXXDeleteExpr(const CXXDeleteExpr *E) { // // CIR note: emit the code size friendly by default for now, such as mentioned // in `EmitObjectDelete`. - assert(!MissingFeatures::emitNullCheckForDeleteCalls()); + assert(!cir::MissingFeatures::emitNullCheckForDeleteCalls()); QualType DeleteTy = E->getDestroyedType(); // A destroying operator delete overrides the entire operation of the @@ -998,7 +998,7 @@ mlir::Value CIRGenFunction::buildCXXNewExpr(const CXXNewExpr *E) { buildNewDeleteCall(*this, allocator, allocatorType, allocatorArgs); // Set !heapallocsite metadata on the call to operator new. - assert(!MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::generateDebugInfo()); // If this was a call to a global replaceable allocation function that does // not take an alignment argument, the allocator is known to produce storage @@ -1198,7 +1198,7 @@ static RValue buildNewDeleteCall(CIRGenFunction &CGF, /// to a replaceable global allocation function. /// /// We model such elidable calls with the 'builtin' attribute. - assert(!MissingFeatures::attributeBuiltin()); + assert(!cir::MissingFeatures::attributeBuiltin()); return RV; } diff --git a/clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp b/clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp index 2b104c8e66a6..2113539bda98 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp @@ -54,7 +54,7 @@ class ComplexExprEmitter : public StmtVisitor { //===--------------------------------------------------------------------===// mlir::Value Visit(Expr *E) { - assert(!MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::generateDebugInfo()); return StmtVisitor::Visit(E); } @@ -489,7 +489,7 @@ mlir::Value ComplexExprEmitter::buildCast(CastKind CK, Expr *Op, case CK_FloatingRealToComplex: case CK_IntegralRealToComplex: { - assert(!MissingFeatures::CGFPOptionsRAII()); + assert(!cir::MissingFeatures::CGFPOptionsRAII()); return buildScalarToComplexCast(CGF.buildScalarExpr(Op), Op->getType(), DestTy, Op->getExprLoc()); } @@ -498,7 +498,7 @@ mlir::Value ComplexExprEmitter::buildCast(CastKind CK, Expr *Op, case CK_FloatingComplexToIntegralComplex: case CK_IntegralComplexCast: case CK_IntegralComplexToFloatingComplex: { - assert(!MissingFeatures::CGFPOptionsRAII()); + assert(!cir::MissingFeatures::CGFPOptionsRAII()); return buildComplexToComplexCast(Visit(Op), Op->getType(), DestTy, Op->getExprLoc()); } @@ -657,7 +657,7 @@ LValue ComplexExprEmitter::buildCompoundAssignLValue( BinOpInfo OpInfo{CGF.getLoc(E->getExprLoc())}; OpInfo.FPFeatures = E->getFPFeaturesInEffect(CGF.getLangOpts()); - assert(!MissingFeatures::CGFPOptionsRAII()); + assert(!cir::MissingFeatures::CGFPOptionsRAII()); // Load the RHS and LHS operands. // __block variables need to have the rhs evaluated first, plus this should @@ -771,12 +771,12 @@ mlir::Value ComplexExprEmitter::buildCompoundAssign( } mlir::Value ComplexExprEmitter::buildBinAdd(const BinOpInfo &Op) { - assert(!MissingFeatures::CGFPOptionsRAII()); + assert(!cir::MissingFeatures::CGFPOptionsRAII()); return CGF.getBuilder().createComplexAdd(Op.Loc, Op.LHS, Op.RHS); } mlir::Value ComplexExprEmitter::buildBinSub(const BinOpInfo &Op) { - assert(!MissingFeatures::CGFPOptionsRAII()); + assert(!cir::MissingFeatures::CGFPOptionsRAII()); return CGF.getBuilder().createComplexSub(Op.Loc, Op.LHS, Op.RHS); } @@ -797,14 +797,14 @@ getComplexRangeAttr(LangOptions::ComplexRangeKind range) { } mlir::Value ComplexExprEmitter::buildBinMul(const BinOpInfo &Op) { - assert(!MissingFeatures::CGFPOptionsRAII()); + assert(!cir::MissingFeatures::CGFPOptionsRAII()); return CGF.getBuilder().createComplexMul( Op.Loc, Op.LHS, Op.RHS, getComplexRangeAttr(Op.FPFeatures.getComplexRange()), FPHasBeenPromoted); } mlir::Value ComplexExprEmitter::buildBinDiv(const BinOpInfo &Op) { - assert(!MissingFeatures::CGFPOptionsRAII()); + assert(!cir::MissingFeatures::CGFPOptionsRAII()); return CGF.getBuilder().createComplexDiv( Op.Loc, Op.LHS, Op.RHS, getComplexRangeAttr(Op.FPFeatures.getComplexRange()), FPHasBeenPromoted); diff --git a/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp b/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp index c970af934607..ce27635e3f44 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp @@ -51,7 +51,7 @@ buildArrayConstant(CIRGenModule &CGM, mlir::Type DesiredType, struct ConstantAggregateBuilderUtils { CIRGenModule &CGM; - CIRDataLayout dataLayout; + cir::CIRDataLayout dataLayout; ConstantAggregateBuilderUtils(CIRGenModule &CGM) : CGM(CGM), dataLayout{CGM.getModule()} {} @@ -1295,7 +1295,7 @@ class ConstantLValueEmitter /// Return GEP-like value offset mlir::ArrayAttr getOffset(mlir::Type Ty) { auto Offset = Value.getLValueOffset().getQuantity(); - CIRDataLayout Layout(CGM.getModule()); + cir::CIRDataLayout Layout(CGM.getModule()); SmallVector Idx; CGM.getBuilder().computeGlobalViewIndicesFromFlatOffset(Offset, Ty, Layout, Idx); @@ -1872,7 +1872,7 @@ mlir::Attribute ConstantEmitter::tryEmitPrivate(const APValue &Value, Desired, mlir::ArrayAttr::get(CGM.getBuilder().getContext(), Elts)); } case APValue::MemberPointer: { - assert(!MissingFeatures::cxxABI()); + assert(!cir::MissingFeatures::cxxABI()); const ValueDecl *memberDecl = Value.getMemberPointerDecl(); assert(!Value.isMemberPointerToDerivedMember() && "NYI"); @@ -1924,7 +1924,7 @@ mlir::Value CIRGenModule::buildNullConstant(QualType T, mlir::Location loc) { } mlir::Value CIRGenModule::buildMemberPointerConstant(const UnaryOperator *E) { - assert(!MissingFeatures::cxxABI()); + assert(!cir::MissingFeatures::cxxABI()); auto loc = getLoc(E->getSourceRange()); diff --git a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp index ca7b07283624..b25c7a814d58 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp @@ -60,7 +60,7 @@ struct BinOpInfo { return true; llvm::APInt Result; - assert(!MissingFeatures::mayHaveIntegerOverflow()); + assert(!cir::MissingFeatures::mayHaveIntegerOverflow()); llvm_unreachable("NYI"); return false; } @@ -284,7 +284,7 @@ class ScalarExprEmitter : public StmtVisitor { // Do we need anything like TestAndClearIgnoreResultAssign()? if (E->getBase()->getType()->isVectorType()) { - assert(!MissingFeatures::scalableVectors() && + assert(!cir::MissingFeatures::scalableVectors() && "NYI: index into scalable vector"); // Subscript of vector type. This is handled differently, with a custom // operation. @@ -360,7 +360,7 @@ class ScalarExprEmitter : public StmtVisitor { mlir::Value VisitCallExpr(const CallExpr *E); mlir::Value VisitStmtExpr(StmtExpr *E) { - assert(!MissingFeatures::stmtExprEvaluation() && "NYI"); + assert(!cir::MissingFeatures::stmtExprEvaluation() && "NYI"); Address retAlloca = CGF.buildCompoundStmt(*E->getSubStmt(), !E->getType()->isVoidType()); if (!retAlloca.isValid()) @@ -493,14 +493,14 @@ class ScalarExprEmitter : public StmtVisitor { } else { value = builder.create(loc, value.getType(), value, amt); - assert(!MissingFeatures::emitCheckedInBoundsGEP()); + assert(!cir::MissingFeatures::emitCheckedInBoundsGEP()); } } } else if (type->isVectorType()) { llvm_unreachable("no vector inc/dec yet"); } else if (type->isRealFloatingType()) { // TODO(cir): CGFPOptionsRAII - assert(!MissingFeatures::CGFPOptionsRAII()); + assert(!cir::MissingFeatures::CGFPOptionsRAII()); if (type->isHalfType() && !CGF.getContext().getLangOpts().NativeHalfType) { @@ -848,7 +848,7 @@ class ScalarExprEmitter : public StmtVisitor { Result.Opcode = E->getOpcode(); Result.Loc = E->getSourceRange(); // TODO: Result.FPFeatures - assert(!MissingFeatures::getFPFeaturesInEffect()); + assert(!cir::MissingFeatures::getFPFeaturesInEffect()); Result.E = E; return Result; } @@ -1499,7 +1499,7 @@ mlir::Value ScalarExprEmitter::buildSub(const BinOpInfo &Ops) { // LLVM we shall take VLA's, division by element size, etc. // // See more in `EmitSub` in CGExprScalar.cpp. - assert(!MissingFeatures::llvmLoweringPtrDiffConsidersPointee()); + assert(!cir::MissingFeatures::llvmLoweringPtrDiffConsidersPointee()); return Builder.create(CGF.getLoc(Ops.Loc), CGF.PtrDiffTy, Ops.LHS, Ops.RHS); } @@ -1614,7 +1614,7 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { LValue DestLVal = CGF.makeAddrLValue(DestAddr, DestTy); if (Kind == CK_LValueToRValueBitCast) - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); return buildLoadOfLValue(DestLVal, CE->getExprLoc()); } @@ -1626,7 +1626,7 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { auto Src = Visit(const_cast(E)); mlir::Type DstTy = CGF.convertType(DestTy); - assert(!MissingFeatures::addressSpace()); + assert(!cir::MissingFeatures::addressSpace()); if (CGF.SanOpts.has(SanitizerKind::CFIUnrelatedCast)) { llvm_unreachable("NYI"); } @@ -1636,17 +1636,17 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { } // Update heapallocsite metadata when there is an explicit pointer cast. - assert(!MissingFeatures::addHeapAllocSiteMetadata()); + assert(!cir::MissingFeatures::addHeapAllocSiteMetadata()); // If Src is a fixed vector and Dst is a scalable vector, and both have the // same element type, use the llvm.vector.insert intrinsic to perform the // bitcast. - assert(!MissingFeatures::scalableVectors()); + assert(!cir::MissingFeatures::scalableVectors()); // If Src is a scalable vector and Dst is a fixed vector, and both have the // same element type, use the llvm.vector.extract intrinsic to perform the // bitcast. - assert(!MissingFeatures::scalableVectors()); + assert(!cir::MissingFeatures::scalableVectors()); // Perform VLAT <-> VLST bitcast through memory. // TODO: since the llvm.experimental.vector.{insert,extract} intrinsics @@ -1654,7 +1654,7 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { // need to keep this around for bitcasts between VLAT <-> VLST where // the element types of the vectors are not the same, until we figure // out a better way of doing these casts. - assert(!MissingFeatures::scalableVectors()); + assert(!cir::MissingFeatures::scalableVectors()); return CGF.getBuilder().createBitcast(CGF.getLoc(E->getSourceRange()), Src, DstTy); @@ -1707,10 +1707,10 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { // C++11 [expr.static.cast]p11: Behavior is undefined if a downcast is // performed and the object is not of the derived type. if (CGF.sanitizePerformTypeCheck()) - assert(!MissingFeatures::sanitizeOther()); + assert(!cir::MissingFeatures::sanitizeOther()); if (CGF.SanOpts.has(SanitizerKind::CFIDerivedCast)) - assert(!MissingFeatures::sanitizeOther()); + assert(!cir::MissingFeatures::sanitizeOther()); return CGF.getAsNaturalPointerTo(Derived, CE->getType()->getPointeeType()); } @@ -1741,7 +1741,7 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { if (MustVisitNullValue(E)) CGF.buildIgnoredExpr(E); - assert(!MissingFeatures::cxxABI()); + assert(!cir::MissingFeatures::cxxABI()); const MemberPointerType *MPT = CE->getType()->getAs(); if (MPT->isMemberFunctionPointerType()) { @@ -1894,14 +1894,14 @@ mlir::Value ScalarExprEmitter::VisitCallExpr(const CallExpr *E) { return buildLoadOfLValue(E); auto V = CGF.buildCallExpr(E).getScalarVal(); - assert(!MissingFeatures::buildLValueAlignmentAssumption()); + assert(!cir::MissingFeatures::buildLValueAlignmentAssumption()); return V; } mlir::Value ScalarExprEmitter::VisitMemberExpr(MemberExpr *E) { // TODO(cir): Folding all this constants sound like work for MLIR optimizers, // keep assertion for now. - assert(!MissingFeatures::tryEmitAsConstant()); + assert(!cir::MissingFeatures::tryEmitAsConstant()); Expr::EvalResult Result; if (E->EvaluateAsInt(Result, CGF.getContext(), Expr::SE_AllowSideEffects)) { llvm::APSInt Value = Result.Val.getInt(); @@ -1971,8 +1971,8 @@ mlir::Value ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) { llvm_unreachable("NYI"); if (E->getType()->isVectorType()) { - assert(!MissingFeatures::scalableVectors() && "NYI: scalable vector init"); - assert(!MissingFeatures::vectorConstants() && "NYI: vector constants"); + assert(!cir::MissingFeatures::scalableVectors() && "NYI: scalable vector init"); + assert(!cir::MissingFeatures::vectorConstants() && "NYI: vector constants"); auto VectorType = mlir::dyn_cast(CGF.getCIRType(E->getType())); SmallVector Elements; @@ -2458,7 +2458,7 @@ mlir::Value ScalarExprEmitter::VisitAbstractConditionalOperator( // If the dead side doesn't have labels we need, just emit the Live part. if (!CGF.ContainsLabel(dead)) { if (CondExprBool) - assert(!MissingFeatures::incrementProfileCounter()); + assert(!cir::MissingFeatures::incrementProfileCounter()); auto Result = Visit(live); // If the live part is a throw expression, it acts like it has a void @@ -2496,7 +2496,7 @@ mlir::Value ScalarExprEmitter::VisitAbstractConditionalOperator( isCheapEnoughToEvaluateUnconditionally(rhsExpr, CGF)) { bool lhsIsVoid = false; auto condV = CGF.evaluateExprAsBool(condExpr); - assert(!MissingFeatures::incrementProfileCounter()); + assert(!cir::MissingFeatures::incrementProfileCounter()); return builder .create( @@ -2556,7 +2556,7 @@ mlir::Value ScalarExprEmitter::VisitAbstractConditionalOperator( b.getInsertionBlock()}; CGF.currLexScope->setAsTernary(); - assert(!MissingFeatures::incrementProfileCounter()); + assert(!cir::MissingFeatures::incrementProfileCounter()); eval.begin(CGF); auto lhs = Visit(lhsExpr); eval.end(CGF); @@ -2576,7 +2576,7 @@ mlir::Value ScalarExprEmitter::VisitAbstractConditionalOperator( b.getInsertionBlock()}; CGF.currLexScope->setAsTernary(); - assert(!MissingFeatures::incrementProfileCounter()); + assert(!cir::MissingFeatures::incrementProfileCounter()); eval.begin(CGF); auto rhs = Visit(rhsExpr); eval.end(CGF); @@ -2777,7 +2777,7 @@ mlir::Value ScalarExprEmitter::VisitVAArgExpr(VAArgExpr *VE) { QualType Ty = VE->getType(); if (Ty->isVariablyModifiedType()) - assert(!MissingFeatures::variablyModifiedTypeEmission() && "NYI"); + assert(!cir::MissingFeatures::variablyModifiedTypeEmission() && "NYI"); Address ArgValue = Address::invalid(); mlir::Value Val = CGF.buildVAArg(VE, ArgValue); @@ -2837,6 +2837,6 @@ mlir::Value CIRGenFunction::buildCheckedInBoundsGEP( // TODO(cir): the unreachable code below hides a substantial amount of code // from the original codegen related with pointer overflow sanitizer. - assert(MissingFeatures::pointerOverflowSanitizer()); + assert(cir::MissingFeatures::pointerOverflowSanitizer()); llvm_unreachable("pointer overflow sanitizer NYI"); } diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.cpp b/clang/lib/CIR/CodeGen/CIRGenFunction.cpp index f8a546aa205e..a312bb868244 100644 --- a/clang/lib/CIR/CodeGen/CIRGenFunction.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenFunction.cpp @@ -54,14 +54,14 @@ CIRGenFunction::~CIRGenFunction() { "missed to deactivate a cleanup"); // TODO(cir): set function is finished. - assert(!MissingFeatures::openMPRuntime()); + assert(!cir::MissingFeatures::openMPRuntime()); // If we have an OpenMPIRBuilder we want to finalize functions (incl. // outlining etc) at some point. Doing it once the function codegen is done // seems to be a reasonable spot. We do it here, as opposed to the deletion // time of the CodeGenModule, because we have to ensure the IR has not yet // been "emitted" to the outside, thus, modifications are still sensible. - assert(!MissingFeatures::openMPRuntime()); + assert(!cir::MissingFeatures::openMPRuntime()); } clang::ASTContext &CIRGenFunction::getContext() const { @@ -72,7 +72,7 @@ mlir::Type CIRGenFunction::ConvertType(QualType T) { return CGM.getTypes().ConvertType(T); } -TypeEvaluationKind CIRGenFunction::getEvaluationKind(QualType type) { +cir::TypeEvaluationKind CIRGenFunction::getEvaluationKind(QualType type) { type = type.getCanonicalType(); while (true) { switch (type->getTypeClass()) { @@ -108,11 +108,11 @@ TypeEvaluationKind CIRGenFunction::getEvaluationKind(QualType type) { case Type::ObjCObjectPointer: case Type::Pipe: case Type::BitInt: - return TEK_Scalar; + return cir::TEK_Scalar; // Complexes. case Type::Complex: - return TEK_Complex; + return cir::TEK_Complex; // Arrays, records, and Objective-C objects. case Type::ConstantArray: @@ -121,7 +121,7 @@ TypeEvaluationKind CIRGenFunction::getEvaluationKind(QualType type) { case Type::Record: case Type::ObjCObject: case Type::ObjCInterface: - return TEK_Aggregate; + return cir::TEK_Aggregate; // We operate on atomic values according to their underlying type. case Type::Atomic: @@ -281,11 +281,11 @@ void CIRGenFunction::buildAndUpdateRetAlloca(QualType ty, mlir::Location loc, // Count the implicit return. if (!endsWithReturn(CurFuncDecl)) ++NumReturnExprs; - } else if (CurFnInfo->getReturnInfo().getKind() == ABIArgInfo::Indirect) { + } else if (CurFnInfo->getReturnInfo().getKind() == cir::ABIArgInfo::Indirect) { // TODO(CIR): Consider this implementation in CIRtoLLVM llvm_unreachable("NYI"); // TODO(CIR): Consider this implementation in CIRtoLLVM - } else if (CurFnInfo->getReturnInfo().getKind() == ABIArgInfo::InAlloca) { + } else if (CurFnInfo->getReturnInfo().getKind() == cir::ABIArgInfo::InAlloca) { llvm_unreachable("NYI"); } else { auto addr = buildAlloca("__retval", ty, loc, alignment); @@ -349,7 +349,7 @@ void CIRGenFunction::LexicalScope::cleanup() { auto applyCleanup = [&]() { if (PerformCleanup) { // ApplyDebugLocation - assert(!MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::generateDebugInfo()); ForceCleanup(); } }; @@ -479,7 +479,7 @@ void CIRGenFunction::LexicalScope::buildImplicitReturn() { FD->getASTContext(), FD->getReturnType()); if (CGF.SanOpts.has(SanitizerKind::Return)) { - assert(!MissingFeatures::sanitizerReturn()); + assert(!cir::MissingFeatures::sanitizerReturn()); llvm_unreachable("NYI"); } else if (shouldEmitUnreachable) { if (CGF.CGM.getCodeGenOpts().OptimizationLevel == 0) { @@ -525,7 +525,7 @@ void CIRGenFunction::finishFunction(SourceLocation EndLoc) { // instructions will get the location of the return statements and // all will be fine. if (auto *DI = getDebugInfo()) - assert(!MissingFeatures::generateDebugInfo() && "NYI"); + assert(!cir::MissingFeatures::generateDebugInfo() && "NYI"); // Pop any cleanups that might have been associated with the // parameters. Do this in whatever block we're currently in; it's @@ -536,7 +536,7 @@ void CIRGenFunction::finishFunction(SourceLocation EndLoc) { // Make sure the line table doesn't jump back into the body for // the ret after it's been at EndLoc. if (auto *DI = getDebugInfo()) - assert(!MissingFeatures::generateDebugInfo() && "NYI"); + assert(!cir::MissingFeatures::generateDebugInfo() && "NYI"); // FIXME(cir): vla.c test currently crashes here. // PopCleanupBlocks(PrologueCleanupDepth); } @@ -547,41 +547,41 @@ void CIRGenFunction::finishFunction(SourceLocation EndLoc) { // this as part of LexicalScope instead, given CIR might have multiple // blocks with `cir.return`. if (ShouldInstrumentFunction()) { - assert(!MissingFeatures::shouldInstrumentFunction() && "NYI"); + assert(!cir::MissingFeatures::shouldInstrumentFunction() && "NYI"); } // Emit debug descriptor for function end. if (auto *DI = getDebugInfo()) - assert(!MissingFeatures::generateDebugInfo() && "NYI"); + assert(!cir::MissingFeatures::generateDebugInfo() && "NYI"); // Reset the debug location to that of the simple 'return' expression, if any // rather than that of the end of the function's scope '}'. - assert(!MissingFeatures::generateDebugInfo() && "NYI"); + assert(!cir::MissingFeatures::generateDebugInfo() && "NYI"); - assert(!MissingFeatures::emitFunctionEpilog() && "NYI"); - assert(!MissingFeatures::emitEndEHSpec() && "NYI"); + assert(!cir::MissingFeatures::emitFunctionEpilog() && "NYI"); + assert(!cir::MissingFeatures::emitEndEHSpec() && "NYI"); // FIXME(cir): vla.c test currently crashes here. // assert(EHStack.empty() && "did not remove all scopes from cleanup stack!"); // If someone did an indirect goto, emit the indirect goto block at the end of // the function. - assert(!MissingFeatures::indirectBranch() && "NYI"); + assert(!cir::MissingFeatures::indirectBranch() && "NYI"); // If some of our locals escaped, insert a call to llvm.localescape in the // entry block. - assert(!MissingFeatures::escapedLocals() && "NYI"); + assert(!cir::MissingFeatures::escapedLocals() && "NYI"); // If someone took the address of a label but never did an indirect goto, we // made a zero entry PHI node, which is illegal, zap it now. - assert(!MissingFeatures::indirectBranch() && "NYI"); + assert(!cir::MissingFeatures::indirectBranch() && "NYI"); // CIRGen doesn't need to emit EHResumeBlock, TerminateLandingPad, // TerminateHandler, UnreachableBlock, TerminateFunclets, NormalCleanupDest // here because the basic blocks aren't shared. - assert(!MissingFeatures::emitDeclMetadata() && "NYI"); - assert(!MissingFeatures::deferredReplacements() && "NYI"); + assert(!cir::MissingFeatures::emitDeclMetadata() && "NYI"); + assert(!cir::MissingFeatures::deferredReplacements() && "NYI"); // Add the min-legal-vector-width attribute. This contains the max width from: // 1. min-vector-width attribute used in the source program. @@ -590,10 +590,10 @@ void CIRGenFunction::finishFunction(SourceLocation EndLoc) { // 4. Width of vector arguments and return types for this function. // 5. Width of vector arguments and return types for functions called by // this function. - assert(!MissingFeatures::minLegalVectorWidthAttr() && "NYI"); + assert(!cir::MissingFeatures::minLegalVectorWidthAttr() && "NYI"); // Add vscale_range attribute if appropriate. - assert(!MissingFeatures::vscaleRangeAttr() && "NYI"); + assert(!cir::MissingFeatures::vscaleRangeAttr() && "NYI"); // In traditional LLVM codegen, if clang generated an unreachable return // block, it'd be deleted now. Same for unused ret allocas from ReturnValue @@ -631,7 +631,7 @@ CIRGenFunction::generateCode(clang::GlobalDecl GD, mlir::cir::FuncOp Fn, // Check if we should generate debug info for this function. if (FD->hasAttr()) { - assert(!MissingFeatures::noDebugInfo()); + assert(!cir::MissingFeatures::noDebugInfo()); } // The function might not have a body if we're generating thunks for a @@ -664,12 +664,12 @@ CIRGenFunction::generateCode(clang::GlobalDecl GD, mlir::cir::FuncOp Fn, // tests when the time comes, but CIR should be intrinsically scope // accurate, so no need to tie coroutines to such markers. if (isa(Body)) - assert(!MissingFeatures::shouldEmitLifetimeMarkers() && "NYI"); + assert(!cir::MissingFeatures::shouldEmitLifetimeMarkers() && "NYI"); // Initialize helper which will detect jumps which can cause invalid // lifetime markers. if (ShouldEmitLifetimeMarkers) - assert(!MissingFeatures::shouldEmitLifetimeMarkers() && "NYI"); + assert(!cir::MissingFeatures::shouldEmitLifetimeMarkers() && "NYI"); } // Create a scope in the symbol table to hold variable declarations. @@ -704,12 +704,12 @@ CIRGenFunction::generateCode(clang::GlobalDecl GD, mlir::cir::FuncOp Fn, // is required by certain optimizations. // In C++11 and up, the attribute will be removed if the body contains a // trivial empty loop. - if (MissingFeatures::mustProgress()) + if (cir::MissingFeatures::mustProgress()) llvm_unreachable("NYI"); // Generate the body of the function. // TODO: PGO.assignRegionCounters - assert(!MissingFeatures::shouldInstrumentFunction()); + assert(!cir::MissingFeatures::shouldInstrumentFunction()); if (isa(FD)) buildDestructorBody(Args); else if (isa(FD)) @@ -748,7 +748,7 @@ CIRGenFunction::generateCode(clang::GlobalDecl GD, mlir::cir::FuncOp Fn, // If we haven't marked the function nothrow through other means, do a quick // pass now to see if we can. - assert(!MissingFeatures::tryMarkNoThrow()); + assert(!cir::MissingFeatures::tryMarkNoThrow()); return Fn; } @@ -760,7 +760,7 @@ mlir::Value CIRGenFunction::createLoad(const VarDecl *VD, const char *Name) { } void CIRGenFunction::buildConstructorBody(FunctionArgList &Args) { - assert(!MissingFeatures::emitAsanPrologueOrEpilogue()); + assert(!cir::MissingFeatures::emitAsanPrologueOrEpilogue()); const auto *Ctor = cast(CurGD.getDecl()); auto CtorType = CurGD.getCtorType(); @@ -832,7 +832,7 @@ LValue CIRGenFunction::MakeNaturalAlignAddrLValue(mlir::Value val, QualType ty) { LValueBaseInfo baseInfo; TBAAAccessInfo tbaaInfo; - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); CharUnits alignment = CGM.getNaturalTypeAlignment(ty, &baseInfo, &tbaaInfo); Address addr(val, getTypes().convertTypeForMem(ty), alignment); return LValue::makeAddr(addr, ty, getContext(), baseInfo, tbaaInfo); @@ -969,49 +969,49 @@ void CIRGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, // TODO(cir): set llvm::Attribute::NoSanitizeBounds if (SanitizeBounds && !SanOpts.hasOneOf(SanitizerKind::Bounds)) - assert(!MissingFeatures::sanitizeOther()); + assert(!cir::MissingFeatures::sanitizeOther()); // TODO(cir): set llvm::Attribute::NoSanitizeCoverage if (NoSanitizeCoverage && CGM.getCodeGenOpts().hasSanitizeCoverage()) - assert(!MissingFeatures::sanitizeOther()); + assert(!cir::MissingFeatures::sanitizeOther()); // Some passes need the non-negated no_sanitize attribute. Pass them on. if (CGM.getCodeGenOpts().hasSanitizeBinaryMetadata()) { // TODO(cir): set no_sanitize_thread if (no_sanitize_mask & SanitizerKind::Thread) - assert(!MissingFeatures::sanitizeOther()); + assert(!cir::MissingFeatures::sanitizeOther()); } } if (ShouldSkipSanitizerInstrumentation()) { - assert(!MissingFeatures::sanitizeOther()); + assert(!cir::MissingFeatures::sanitizeOther()); } else { // Apply sanitizer attributes to the function. if (SanOpts.hasOneOf(SanitizerKind::Address | SanitizerKind::KernelAddress)) - assert(!MissingFeatures::sanitizeOther()); + assert(!cir::MissingFeatures::sanitizeOther()); if (SanOpts.hasOneOf(SanitizerKind::HWAddress | SanitizerKind::KernelHWAddress)) - assert(!MissingFeatures::sanitizeOther()); + assert(!cir::MissingFeatures::sanitizeOther()); if (SanOpts.has(SanitizerKind::MemtagStack)) - assert(!MissingFeatures::sanitizeOther()); + assert(!cir::MissingFeatures::sanitizeOther()); if (SanOpts.has(SanitizerKind::Thread)) - assert(!MissingFeatures::sanitizeOther()); + assert(!cir::MissingFeatures::sanitizeOther()); if (SanOpts.has(SanitizerKind::NumericalStability)) - assert(!MissingFeatures::sanitizeOther()); + assert(!cir::MissingFeatures::sanitizeOther()); if (SanOpts.hasOneOf(SanitizerKind::Memory | SanitizerKind::KernelMemory)) - assert(!MissingFeatures::sanitizeOther()); + assert(!cir::MissingFeatures::sanitizeOther()); } if (SanOpts.has(SanitizerKind::SafeStack)) - assert(!MissingFeatures::sanitizeOther()); + assert(!cir::MissingFeatures::sanitizeOther()); if (SanOpts.has(SanitizerKind::ShadowCallStack)) - assert(!MissingFeatures::sanitizeOther()); + assert(!cir::MissingFeatures::sanitizeOther()); if (SanOpts.has(SanitizerKind::Realtime)) llvm_unreachable("NYI"); // Apply fuzzing attribute to the function. if (SanOpts.hasOneOf(SanitizerKind::Fuzzer | SanitizerKind::FuzzerNoLink)) - assert(!MissingFeatures::sanitizeOther()); + assert(!cir::MissingFeatures::sanitizeOther()); // Ignore TSan memory acesses from within ObjC/ObjC++ dealloc, initialize, // .cxx_destruct, __destroy_helper_block_ and all of their calees at run time. @@ -1050,17 +1050,17 @@ void CIRGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, // Apply xray attributes to the function (as a string, for now) if (const auto *XRayAttr = D ? D->getAttr() : nullptr) { - assert(!MissingFeatures::xray()); + assert(!cir::MissingFeatures::xray()); } else { - assert(!MissingFeatures::xray()); + assert(!cir::MissingFeatures::xray()); } if (ShouldXRayInstrumentFunction()) { - assert(!MissingFeatures::xray()); + assert(!cir::MissingFeatures::xray()); } if (CGM.getCodeGenOpts().getProfileInstr() != CodeGenOptions::ProfileNone) { - assert(!MissingFeatures::getProfileCount()); + assert(!cir::MissingFeatures::getProfileCount()); } unsigned Count, Offset; @@ -1168,17 +1168,17 @@ void CIRGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, llvm_unreachable("NYI"); } - if (MissingFeatures::stackrealign()) + if (cir::MissingFeatures::stackrealign()) llvm_unreachable("NYI"); - if (FD && FD->isMain() && MissingFeatures::zerocallusedregs()) + if (FD && FD->isMain() && cir::MissingFeatures::zerocallusedregs()) llvm_unreachable("NYI"); mlir::Block *EntryBB = &Fn.getBlocks().front(); // TODO: allocapt insertion? probably don't need for CIR - if (MissingFeatures::requiresReturnValueCheck()) + if (cir::MissingFeatures::requiresReturnValueCheck()) llvm_unreachable("NYI"); if (getDebugInfo()) { @@ -1205,7 +1205,7 @@ void CIRGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, llvm_unreachable("NYI"); } - assert(!MissingFeatures::emitStartEHSpec() && "NYI"); + assert(!cir::MissingFeatures::emitStartEHSpec() && "NYI"); // FIXME(cir): vla.c test currently crashes here. // PrologueCleanupDepth = EHStack.stable_begin(); @@ -1249,7 +1249,7 @@ void CIRGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, // TODO: this should live in `buildFunctionProlog` bool isPromoted = isa(paramVar) && cast(paramVar)->isKNRPromoted(); - assert(!MissingFeatures::constructABIArgDirectExtend()); + assert(!cir::MissingFeatures::constructABIArgDirectExtend()); if (isPromoted) paramVal = emitArgumentDemotion(*this, paramVar, paramVal); @@ -1312,7 +1312,7 @@ void CIRGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, MD->getParent()->getLambdaCaptureDefault() == LCD_None) SkippedChecks.set(SanitizerKind::Null, true); - assert(!MissingFeatures::buildTypeCheck() && "NYI"); + assert(!cir::MissingFeatures::buildTypeCheck() && "NYI"); } } @@ -1509,7 +1509,7 @@ void CIRGenFunction::CIRGenFPOptionsRAII::ConstructorHelper( return; // TODO(cir): create guard to restore fast math configurations. - assert(!MissingFeatures::fastMathGuard()); + assert(!cir::MissingFeatures::fastMathGuard()); llvm::RoundingMode NewRoundingBehavior = FPFeatures.getRoundingMode(); // TODO(cir): override rounding behaviour once FM configs are guarded. @@ -1519,17 +1519,17 @@ void CIRGenFunction::CIRGenFPOptionsRAII::ConstructorHelper( // TODO(cir): override exception behaviour once FM configs are guarded. // TODO(cir): override FP flags once FM configs are guarded. - assert(!MissingFeatures::fastMathFlags()); + assert(!cir::MissingFeatures::fastMathFlags()); assert((CGF.CurFuncDecl == nullptr || CGF.builder.getIsFPConstrained() || isa(CGF.CurFuncDecl) || isa(CGF.CurFuncDecl) || - (NewExceptionBehavior == fp::ebIgnore && + (NewExceptionBehavior == cir::fp::ebIgnore && NewRoundingBehavior == llvm::RoundingMode::NearestTiesToEven)) && "FPConstrained should be enabled on entire function"); // TODO(cir): mark CIR function with fast math attributes. - assert(!MissingFeatures::fastMathFuncAttributes()); + assert(!cir::MissingFeatures::fastMathFuncAttributes()); } CIRGenFunction::CIRGenFPOptionsRAII::~CIRGenFPOptionsRAII() { @@ -1561,7 +1561,7 @@ bool CIRGenFunction::shouldNullCheckClassCastValue(const CastExpr *CE) { void CIRGenFunction::buildDeclRefExprDbgValue(const DeclRefExpr *E, const APValue &Init) { - assert(!MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::generateDebugInfo()); } Address CIRGenFunction::buildVAListRef(const Expr *E) { @@ -1773,7 +1773,7 @@ void CIRGenFunction::buildVariablyModifiedType(QualType type) { mlir::Value &entry = VLASizeMap[sizeExpr]; if (!entry) { mlir::Value size = buildScalarExpr(sizeExpr); - assert(!MissingFeatures::sanitizeVLABound()); + assert(!cir::MissingFeatures::sanitizeVLABound()); // Always zexting here would be wrong if it weren't // undefined behavior to have a negative bound. diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.h b/clang/lib/CIR/CodeGen/CIRGenFunction.h index 8c612d2492a4..0ed7d735eda2 100644 --- a/clang/lib/CIR/CodeGen/CIRGenFunction.h +++ b/clang/lib/CIR/CodeGen/CIRGenFunction.h @@ -158,7 +158,7 @@ class CIRGenFunction : public CIRGenTypeCache { // Work around an extremely aggressive peephole optimization in // EmitScalarConversion which assumes that all other uses of a // value are extant. - assert(!MissingFeatures::peepholeProtection() && "NYI"); + assert(!cir::MissingFeatures::peepholeProtection() && "NYI"); return data; } @@ -172,7 +172,7 @@ class CIRGenFunction : public CIRGenTypeCache { CGF.OpaqueLValues.erase(OpaqueValue); } else { CGF.OpaqueRValues.erase(OpaqueValue); - assert(!MissingFeatures::peepholeProtection() && "NYI"); + assert(!cir::MissingFeatures::peepholeProtection() && "NYI"); } } }; @@ -508,7 +508,7 @@ class CIRGenFunction : public CIRGenTypeCache { void ConstructorHelper(clang::FPOptions FPFeatures); CIRGenFunction &CGF; clang::FPOptions OldFPFeatures; - fp::ExceptionBehavior OldExcept; + cir::fp::ExceptionBehavior OldExcept; llvm::RoundingMode OldRounding; }; clang::FPOptions CurFPFeatures; @@ -560,15 +560,15 @@ class CIRGenFunction : public CIRGenTypeCache { return ConvertType(getContext().getTypeDeclType(T)); } - /// Return the TypeEvaluationKind of QualType \c T. - static TypeEvaluationKind getEvaluationKind(clang::QualType T); + /// Return the cir::TypeEvaluationKind of QualType \c T. + static cir::TypeEvaluationKind getEvaluationKind(clang::QualType T); static bool hasScalarEvaluationKind(clang::QualType T) { - return getEvaluationKind(T) == TEK_Scalar; + return getEvaluationKind(T) == cir::TEK_Scalar; } static bool hasAggregateEvaluationKind(clang::QualType T) { - return getEvaluationKind(T) == TEK_Aggregate; + return getEvaluationKind(T) == cir::TEK_Aggregate; } CIRGenFunction(CIRGenModule &CGM, CIRGenBuilderTy &builder, @@ -1008,8 +1008,8 @@ class CIRGenFunction : public CIRGenTypeCache { mlir::Value buildCommonNeonBuiltinExpr( unsigned builtinID, unsigned llvmIntrinsic, unsigned altLLVMIntrinsic, const char *nameHint, unsigned modifier, const CallExpr *e, - llvm::SmallVectorImpl &ops, cir::Address ptrOp0, - cir::Address ptrOp1, llvm::Triple::ArchType arch); + llvm::SmallVectorImpl &ops, Address ptrOp0, + Address ptrOp1, llvm::Triple::ArchType arch); mlir::Value buildAlignmentAssumption(mlir::Value ptrValue, QualType ty, SourceLocation loc, @@ -1058,7 +1058,7 @@ class CIRGenFunction : public CIRGenTypeCache { bool currentFunctionUsesSEHTry() const { return !!CurSEHParent; } /// Returns true inside SEH __try blocks. - bool isSEHTryScope() const { return MissingFeatures::isSEHTryScope(); } + bool isSEHTryScope() const { return cir::MissingFeatures::isSEHTryScope(); } mlir::Operation *CurrentFuncletPad = nullptr; @@ -2145,7 +2145,7 @@ class CIRGenFunction : public CIRGenTypeCache { ~LexicalScope() { // EmitLexicalBlockEnd - assert(!MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::generateDebugInfo()); // If we should perform a cleanup, force them now. Note that // this ends the cleanup scope before rescoping any labels. cleanup(); diff --git a/clang/lib/CIR/CodeGen/CIRGenFunctionInfo.h b/clang/lib/CIR/CodeGen/CIRGenFunctionInfo.h index 6be016e5878e..22fbf8ee5848 100644 --- a/clang/lib/CIR/CodeGen/CIRGenFunctionInfo.h +++ b/clang/lib/CIR/CodeGen/CIRGenFunctionInfo.h @@ -26,7 +26,7 @@ namespace clang::CIRGen { struct CIRGenFunctionInfoArgInfo { clang::CanQualType type; - ABIArgInfo info; + cir::ABIArgInfo info; }; /// A class for recording the number of arguments that a function signature @@ -264,8 +264,8 @@ class CIRGenFunctionInfo final clang::CanQualType getReturnType() const { return getArgsBuffer()[0].type; } - ABIArgInfo &getReturnInfo() { return getArgsBuffer()[0].info; } - const ABIArgInfo &getReturnInfo() const { return getArgsBuffer()[0].info; } + cir::ABIArgInfo &getReturnInfo() { return getArgsBuffer()[0].info; } + const cir::ABIArgInfo &getReturnInfo() const { return getArgsBuffer()[0].info; } bool isChainCall() const { return ChainCall; } diff --git a/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp b/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp index 677b9f4ab081..dd79a1b7aaff 100644 --- a/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp @@ -34,7 +34,7 @@ using namespace clang; using namespace clang::CIRGen; namespace { -class CIRGenItaniumCXXABI : public cir::CIRGenCXXABI { +class CIRGenItaniumCXXABI : public CIRGenCXXABI { /// All the vtables which have been defined. llvm::DenseMap VTables; @@ -44,7 +44,7 @@ class CIRGenItaniumCXXABI : public cir::CIRGenCXXABI { bool Use32BitVTableOffsetABI; ItaniumMangleContext &getMangleContext() { - return cast(cir::CIRGenCXXABI::getMangleContext()); + return cast(CIRGenCXXABI::getMangleContext()); } bool isVTableHidden(const CXXRecordDecl *RD) const { @@ -396,14 +396,14 @@ bool CIRGenItaniumCXXABI::NeedsVTTParameter(GlobalDecl GD) { return false; } -CIRGenCXXABI *cir::CreateCIRGenItaniumCXXABI(CIRGenModule &CGM) { +CIRGenCXXABI *clang::CIRGen::CreateCIRGenItaniumCXXABI(CIRGenModule &CGM) { switch (CGM.getASTContext().getCXXABIKind()) { case TargetCXXABI::GenericItanium: case TargetCXXABI::GenericAArch64: 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()); + assert(!cir::MissingFeatures::appleArm64CXXABI()); return new CIRGenItaniumCXXABI(CGM); default: @@ -733,8 +733,8 @@ static void InitCatchParam(CIRGenFunction &CGF, const VarDecl &CatchParam, } // Scalars and complexes. - TypeEvaluationKind TEK = CGF.getEvaluationKind(CatchType); - if (TEK != TEK_Aggregate) { + cir::TypeEvaluationKind TEK = CGF.getEvaluationKind(CatchType); + if (TEK != cir::TEK_Aggregate) { // Notes for LLVM lowering: // If the catch type is a pointer type, __cxa_begin_catch returns // the pointer by value. @@ -745,7 +745,7 @@ static void InitCatchParam(CIRGenFunction &CGF, const VarDecl &CatchParam, case Qualifiers::OCL_Strong: llvm_unreachable("NYI"); // arc retain non block: - assert(!MissingFeatures::ARC()); + assert(!cir::MissingFeatures::ARC()); [[fallthrough]]; case Qualifiers::OCL_None: @@ -758,7 +758,7 @@ static void InitCatchParam(CIRGenFunction &CGF, const VarDecl &CatchParam, case Qualifiers::OCL_Weak: llvm_unreachable("NYI"); // arc init weak: - assert(!MissingFeatures::ARC()); + assert(!cir::MissingFeatures::ARC()); return; } llvm_unreachable("bad ownership qualifier!"); @@ -770,15 +770,15 @@ static void InitCatchParam(CIRGenFunction &CGF, const VarDecl &CatchParam, LValue srcLV = CGF.MakeNaturalAlignAddrLValue(catchParam, CatchType); LValue destLV = CGF.makeAddrLValue(ParamAddr, CatchType); switch (TEK) { - case TEK_Complex: + case cir::TEK_Complex: llvm_unreachable("NYI"); return; - case TEK_Scalar: { + case cir::TEK_Scalar: { auto exnLoad = CGF.buildLoadOfScalar(srcLV, catchParam.getLoc()); CGF.buildStoreOfScalar(exnLoad, destLV, /*init*/ true); return; } - case TEK_Aggregate: + case cir::TEK_Aggregate: llvm_unreachable("evaluation kind filtered out!"); } llvm_unreachable("bad evaluation kind"); @@ -882,7 +882,7 @@ CIRGenItaniumCXXABI::getAddrOfVTable(const CXXRecordDecl *RD, mlir::cir::GlobalLinkageKind::ExternalLinkage, getContext().toCharUnitsFromBits(PAlign)); // LLVM codegen handles unnamedAddr - assert(!MissingFeatures::unnamedAddr()); + assert(!cir::MissingFeatures::unnamedAddr()); // In MS C++ if you have a class with virtual functions in which you are using // selective member import/export, then all virtual functions must be exported @@ -1511,8 +1511,8 @@ mlir::Attribute CIRGenItaniumRTTIBuilder::BuildTypeInfo(mlir::Location loc, // Give the type_info object and name the formal visibility of the // type itself. - assert(!MissingFeatures::hiddenVisibility()); - assert(!MissingFeatures::protectedVisibility()); + assert(!cir::MissingFeatures::hiddenVisibility()); + assert(!cir::MissingFeatures::protectedVisibility()); mlir::SymbolTable::Visibility symVisibility; if (mlir::cir::isLocalLinkage(Linkage)) // If the linkage is local, only default visibility makes sense. @@ -1523,7 +1523,7 @@ mlir::Attribute CIRGenItaniumRTTIBuilder::BuildTypeInfo(mlir::Location loc, else symVisibility = CIRGenModule::getCIRVisibility(Ty->getVisibility()); - assert(!MissingFeatures::setDLLStorageClass()); + assert(!cir::MissingFeatures::setDLLStorageClass()); return BuildTypeInfo(loc, Ty, Linkage, symVisibility); } @@ -1656,7 +1656,7 @@ void CIRGenItaniumRTTIBuilder::BuildVTablePointer(mlir::Location loc, CGM.getBuilder().getUInt8PtrTy()); } - if (MissingFeatures::setDSOLocal()) + if (cir::MissingFeatures::setDSOLocal()) llvm_unreachable("NYI"); // The vtable address point is 2. @@ -1896,7 +1896,7 @@ mlir::Attribute CIRGenItaniumRTTIBuilder::BuildTypeInfo( mlir::Location loc, QualType Ty, mlir::cir::GlobalLinkageKind Linkage, mlir::SymbolTable::Visibility Visibility) { auto &builder = CGM.getBuilder(); - assert(!MissingFeatures::setDLLStorageClass()); + assert(!cir::MissingFeatures::setDLLStorageClass()); // Add the vtable pointer. BuildVTablePointer(loc, cast(Ty)); @@ -2013,7 +2013,7 @@ mlir::Attribute CIRGenItaniumRTTIBuilder::BuildTypeInfo( break; } - assert(!MissingFeatures::setDLLImportDLLExport()); + assert(!cir::MissingFeatures::setDLLImportDLLExport()); auto init = builder.getTypeInfo(builder.getArrayAttr(Fields)); SmallString<256> Name; @@ -2044,7 +2044,7 @@ mlir::Attribute CIRGenItaniumRTTIBuilder::BuildTypeInfo( } if (CGM.supportsCOMDAT() && mlir::cir::isWeakForLinker(GV.getLinkage())) { - assert(!MissingFeatures::setComdat()); + assert(!cir::MissingFeatures::setComdat()); llvm_unreachable("NYI"); } @@ -2068,16 +2068,16 @@ mlir::Attribute CIRGenItaniumRTTIBuilder::BuildTypeInfo( // object and the type_info name be uniqued when weakly emitted. // TODO(cir): setup other bits for TypeName - assert(!MissingFeatures::setDLLStorageClass()); - assert(!MissingFeatures::setPartition()); - assert(!MissingFeatures::setDSOLocal()); + assert(!cir::MissingFeatures::setDLLStorageClass()); + assert(!cir::MissingFeatures::setPartition()); + assert(!cir::MissingFeatures::setDSOLocal()); mlir::SymbolTable::setSymbolVisibility( TypeName, CIRGenModule::getMLIRVisibility(TypeName)); // TODO(cir): setup other bits for GV - assert(!MissingFeatures::setDLLStorageClass()); - assert(!MissingFeatures::setPartition()); - assert(!MissingFeatures::setDSOLocal()); + assert(!cir::MissingFeatures::setDLLStorageClass()); + assert(!cir::MissingFeatures::setPartition()); + assert(!cir::MissingFeatures::setDSOLocal()); CIRGenModule::setInitializer(GV, init); return builder.getGlobalViewAttr(builder.getUInt8PtrTy(), GV); @@ -2113,7 +2113,7 @@ void CIRGenItaniumCXXABI::emitVTableDefinitions(CIRGenVTables &CGVT, VTable.setLinkage(Linkage); if (CGM.supportsCOMDAT() && mlir::cir::isWeakForLinker(Linkage)) { - assert(!MissingFeatures::setComdat()); + assert(!cir::MissingFeatures::setComdat()); } // Set the right visibility. @@ -2150,7 +2150,7 @@ void CIRGenItaniumCXXABI::emitVTableDefinitions(CIRGenVTables &CGVT, if (isDeclarationForLinker) { llvm_unreachable("NYI"); assert(CGM.getCodeGenOpts().WholeProgramVTables); - assert(!MissingFeatures::addCompilerUsedGlobal()); + assert(!cir::MissingFeatures::addCompilerUsedGlobal()); } } @@ -2286,7 +2286,7 @@ void CIRGenItaniumCXXABI::buildThrow(CIRGenFunction &CGF, mlir::FlatSymbolRefAttr dtor{}; if (const RecordType *recordTy = clangThrowType->getAs()) { CXXRecordDecl *rec = cast(recordTy->getDecl()); - assert(!MissingFeatures::isTrivialCtorOrDtor()); + assert(!cir::MissingFeatures::isTrivialCtorOrDtor()); if (!rec->hasTrivialDestructor()) { CXXDestructorDecl *dtorD = rec->getDestructor(); dtor = mlir::FlatSymbolRefAttr::get( @@ -2336,7 +2336,7 @@ static mlir::cir::FuncOp getBadCastFn(CIRGenFunction &CGF) { // Prototype: void __cxa_bad_cast(); // TODO(cir): set the calling convention of the runtime function. - assert(!MissingFeatures::setCallingConv()); + assert(!cir::MissingFeatures::setCallingConv()); mlir::cir::FuncType FTy = CGF.getBuilder().getFuncType({}, CGF.getBuilder().getVoidTy()); @@ -2345,7 +2345,7 @@ static mlir::cir::FuncOp getBadCastFn(CIRGenFunction &CGF) { static void buildCallToBadCast(CIRGenFunction &CGF, mlir::Location loc) { // TODO(cir): set the calling convention to the runtime function. - assert(!MissingFeatures::setCallingConv()); + assert(!cir::MissingFeatures::setCallingConv()); CGF.buildRuntimeCall(loc, getBadCastFn(CGF)); CGF.getBuilder().create(loc); @@ -2421,7 +2421,7 @@ static mlir::cir::FuncOp getItaniumDynamicCastFn(CIRGenFunction &CGF) { // TODO(cir): mark the function as nowind readonly. // TODO(cir): set the calling convention of the runtime function. - assert(!MissingFeatures::setCallingConv()); + assert(!cir::MissingFeatures::setCallingConv()); mlir::cir::FuncType FTy = CGF.getBuilder().getFuncType( {VoidPtrTy, RTTIPtrTy, RTTIPtrTy, PtrDiffTy}, VoidPtrTy); @@ -2513,7 +2513,7 @@ buildExactDynamicCast(CIRGenItaniumCXXABI &ABI, CIRGenFunction &CGF, ABI.getVTableAddressPoint(BaseSubobject(SrcDecl, *Offset), DestDecl); // TODO(cir): handle address space here. - assert(!MissingFeatures::addressSpace()); + assert(!cir::MissingFeatures::addressSpace()); mlir::Type VPtrTy = ExpectedVPtr.getType(); mlir::Type VPtrPtrTy = CGF.getBuilder().getPointerTo(VPtrTy); Address SrcVPtrPtr( @@ -2522,7 +2522,7 @@ buildExactDynamicCast(CIRGenItaniumCXXABI &ABI, CIRGenFunction &CGF, mlir::Value SrcVPtr = CGF.getBuilder().createLoad(Loc, SrcVPtrPtr); // TODO(cir): decorate SrcVPtr with TBAA info. - assert(!MissingFeatures::tbaa()); + assert(!cir::MissingFeatures::tbaa()); mlir::Value Success = CGF.getBuilder().createCompare( Loc, mlir::cir::CmpOpKind::eq, SrcVPtr, ExpectedVPtr); @@ -2532,7 +2532,7 @@ buildExactDynamicCast(CIRGenItaniumCXXABI &ABI, CIRGenFunction &CGF, return CGF.getBuilder().createBitcast(Src.getPointer(), DestCIRTy); // TODO(cir): handle address space here. - assert(!MissingFeatures::addressSpace()); + assert(!cir::MissingFeatures::addressSpace()); mlir::Type U8PtrTy = CGF.getBuilder().getPointerTo(CGF.getBuilder().getUInt8Ty()); diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp index 59b1f47f2ddb..cdf3f4b93ac0 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp @@ -388,7 +388,7 @@ static bool shouldAssumeDSOLocal(const CIRGenModule &CGM, // DLLImport explicitly marks the GV as external. // so it shouldn't be dso_local // But we don't have the info set now - assert(!MissingFeatures::setDLLImportDLLExport()); + assert(!cir::MissingFeatures::setDLLImportDLLExport()); const llvm::Triple &TT = CGM.getTriple(); const auto &CGOpts = CGM.getCodeGenOpts(); @@ -506,15 +506,15 @@ void CIRGenModule::buildGlobal(GlobalDecl GD) { if (langOpts.OpenMP) { // If this is OpenMP, check if it is legal to emit this global normally. if (openMPRuntime && openMPRuntime->emitTargetGlobal(GD)) { - assert(!MissingFeatures::openMPRuntime()); + assert(!cir::MissingFeatures::openMPRuntime()); return; } if (auto *DRD = dyn_cast(Global)) { - assert(!MissingFeatures::openMP()); + assert(!cir::MissingFeatures::openMP()); return; } if (auto *DMD = dyn_cast(Global)) { - assert(!MissingFeatures::openMP()); + assert(!cir::MissingFeatures::openMP()); return; } } @@ -721,10 +721,10 @@ void CIRGenModule::setCommonAttributes(GlobalDecl GD, mlir::Operation *GV) { if (isa_and_nonnull(D)) setGVProperties(GV, dyn_cast(D)); else - assert(!MissingFeatures::setDefaultVisibility()); + assert(!cir::MissingFeatures::setDefaultVisibility()); if (D && D->hasAttr()) - assert(!MissingFeatures::addUsedOrCompilerUsedGlobal()); + assert(!cir::MissingFeatures::addUsedOrCompilerUsedGlobal()); if (const auto *VD = dyn_cast_if_present(D); VD && @@ -733,7 +733,7 @@ void CIRGenModule::setCommonAttributes(GlobalDecl GD, mlir::Operation *GV) { VD->getStorageDuration() == SD_Thread)) || (codeGenOpts.KeepStaticConsts && VD->getStorageDuration() == SD_Static && VD->getType().isConstQualified()))) - assert(!MissingFeatures::addUsedOrCompilerUsedGlobal()); + assert(!cir::MissingFeatures::addUsedOrCompilerUsedGlobal()); } void CIRGenModule::setNonAliasAttributes(GlobalDecl GD, mlir::Operation *GO) { @@ -744,40 +744,40 @@ void CIRGenModule::setNonAliasAttributes(GlobalDecl GD, mlir::Operation *GO) { auto GV = llvm::dyn_cast_or_null(GO); if (GV) { if (D->hasAttr()) - assert(!MissingFeatures::addUsedGlobal()); + assert(!cir::MissingFeatures::addUsedGlobal()); if (auto *SA = D->getAttr()) - assert(!MissingFeatures::addSectionAttributes()); + assert(!cir::MissingFeatures::addSectionAttributes()); if (auto *SA = D->getAttr()) - assert(!MissingFeatures::addSectionAttributes()); + assert(!cir::MissingFeatures::addSectionAttributes()); if (auto *SA = D->getAttr()) - assert(!MissingFeatures::addSectionAttributes()); + assert(!cir::MissingFeatures::addSectionAttributes()); if (auto *SA = D->getAttr()) - assert(!MissingFeatures::addSectionAttributes()); + assert(!cir::MissingFeatures::addSectionAttributes()); } auto F = llvm::dyn_cast_or_null(GO); if (F) { if (D->hasAttr()) - assert(!MissingFeatures::addUsedGlobal()); + assert(!cir::MissingFeatures::addUsedGlobal()); if (auto *SA = D->getAttr()) if (!D->getAttr()) - assert(!MissingFeatures::setSectionForFuncOp()); + assert(!cir::MissingFeatures::setSectionForFuncOp()); - assert(!MissingFeatures::updateCPUAndFeaturesAttributes()); + assert(!cir::MissingFeatures::updateCPUAndFeaturesAttributes()); } if (const auto *CSA = D->getAttr()) { - assert(!MissingFeatures::setSectionForFuncOp()); + assert(!cir::MissingFeatures::setSectionForFuncOp()); if (GV) GV.setSection(CSA->getName()); if (F) - assert(!MissingFeatures::setSectionForFuncOp()); + assert(!cir::MissingFeatures::setSectionForFuncOp()); } else if (const auto *SA = D->getAttr()) if (GV) GV.setSection(SA->getName()); if (F) - assert(!MissingFeatures::setSectionForFuncOp()); + assert(!cir::MissingFeatures::setSectionForFuncOp()); } - assert(!MissingFeatures::setTargetAttributes()); + assert(!cir::MissingFeatures::setTargetAttributes()); } void CIRGenModule::replaceGlobal(mlir::cir::GlobalOp Old, @@ -884,7 +884,7 @@ CIRGenModule::getOrCreateCIRGlobal(StringRef MangledName, mlir::Type Ty, // Handle dropped DLL attributes. if (D && !D->hasAttr() && !D->hasAttr()) - assert(!MissingFeatures::setDLLStorageClass() && "NYI"); + assert(!cir::MissingFeatures::setDLLStorageClass() && "NYI"); if (langOpts.OpenMP && !langOpts.OpenMPSimd && D) getOpenMPRuntime().registerTargetGlobalVariable(D, Entry); @@ -1334,11 +1334,11 @@ void CIRGenModule::buildGlobalVarDefinition(const clang::VarDecl *D, GV.setVisibility(getMLIRVisibilityFromCIRLinkage(Linkage)); // TODO(cir): handle DLL storage classes in CIR? if (D->hasAttr()) - assert(!MissingFeatures::setDLLStorageClass()); + assert(!cir::MissingFeatures::setDLLStorageClass()); else if (D->hasAttr()) - assert(!MissingFeatures::setDLLStorageClass()); + assert(!cir::MissingFeatures::setDLLStorageClass()); else - assert(!MissingFeatures::setDLLStorageClass()); + assert(!cir::MissingFeatures::setDLLStorageClass()); if (Linkage == mlir::cir::GlobalLinkageKind::CommonLinkage) { // common vars aren't constant even if declared const. @@ -1372,8 +1372,8 @@ void CIRGenModule::buildGlobalVarDefinition(const clang::VarDecl *D, // TODO(cir): sanitizers (reportGlobalToASan) and global variable debug // information. - assert(!MissingFeatures::sanitizeOther()); - assert(!MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::sanitizeOther()); + assert(!cir::MissingFeatures::generateDebugInfo()); } void CIRGenModule::buildGlobalDefinition(GlobalDecl GD, mlir::Operation *Op) { @@ -1765,7 +1765,7 @@ void CIRGenModule::buildTopLevelDecl(Decl *decl) { break; case Decl::ClassTemplateSpecialization: { // const auto *Spec = cast(decl); - assert(!MissingFeatures::generateDebugInfo() && "NYI"); + assert(!cir::MissingFeatures::generateDebugInfo() && "NYI"); } [[fallthrough]]; case Decl::CXXRecord: { @@ -1792,7 +1792,7 @@ void CIRGenModule::buildTopLevelDecl(Decl *decl) { case Decl::UsingEnum: // using enum X; [C++] case Decl::NamespaceAlias: case Decl::UsingDirective: // using namespace X; [C++] - assert(!MissingFeatures::generateDebugInfo() && "NYI"); + assert(!cir::MissingFeatures::generateDebugInfo() && "NYI"); break; case Decl::CXXConstructor: getCXXABI().buildCXXConstructors(cast(decl)); @@ -1813,7 +1813,7 @@ void CIRGenModule::buildTopLevelDecl(Decl *decl) { case Decl::TypeAlias: // using foo = bar; [C++11] case Decl::Record: case Decl::Enum: - assert(!MissingFeatures::generateDebugInfo() && "NYI"); + assert(!cir::MissingFeatures::generateDebugInfo() && "NYI"); break; } } @@ -2081,9 +2081,9 @@ void CIRGenModule::ReplaceUsesOfNonProtoTypeWithRealFunction( return; // TODO(cir): this RAUW ignores the features below. - assert(!MissingFeatures::exceptions() && "Call vs Invoke NYI"); - assert(!MissingFeatures::parameterAttributes()); - assert(!MissingFeatures::operandBundles()); + assert(!cir::MissingFeatures::exceptions() && "Call vs Invoke NYI"); + assert(!cir::MissingFeatures::parameterAttributes()); + assert(!cir::MissingFeatures::operandBundles()); assert(OldFn->getAttrs().size() > 1 && "Attribute forwarding NYI"); // Mark new function as originated from a no-proto declaration. @@ -2157,7 +2157,7 @@ void CIRGenModule::buildAliasForGlobal(StringRef mangledName, alias, mlir::SymbolTable::Visibility::Private); // Alias constructors and destructors are always unnamed_addr. - assert(!MissingFeatures::unnamedAddr()); + assert(!cir::MissingFeatures::unnamedAddr()); // Switch any previous uses to the alias. if (op) { @@ -2354,11 +2354,11 @@ void CIRGenModule::buildTentativeDefinition(const VarDecl *D) { void CIRGenModule::setGlobalVisibility(mlir::Operation *GV, const NamedDecl *D) const { - assert(!MissingFeatures::setGlobalVisibility()); + assert(!cir::MissingFeatures::setGlobalVisibility()); } void CIRGenModule::setDSOLocal(mlir::Operation *Op) const { - assert(!MissingFeatures::setDSOLocal()); + assert(!cir::MissingFeatures::setDSOLocal()); if (auto globalValue = dyn_cast(Op)) { setDSOLocal(globalValue); } @@ -2366,7 +2366,7 @@ void CIRGenModule::setDSOLocal(mlir::Operation *Op) const { void CIRGenModule::setGVProperties(mlir::Operation *Op, const NamedDecl *D) const { - assert(!MissingFeatures::setDLLImportDLLExport()); + assert(!cir::MissingFeatures::setDLLImportDLLExport()); setGVPropertiesAux(Op, D); } @@ -2374,7 +2374,7 @@ void CIRGenModule::setGVPropertiesAux(mlir::Operation *Op, const NamedDecl *D) const { setGlobalVisibility(Op, D); setDSOLocal(Op); - assert(!MissingFeatures::setPartition()); + assert(!cir::MissingFeatures::setPartition()); } bool CIRGenModule::lookupRepresentativeDecl(StringRef MangledName, @@ -2613,7 +2613,7 @@ void CIRGenModule::setFunctionAttributes(GlobalDecl globalDecl, } // TODO(cir): Complete the remaining part of the function. - assert(!MissingFeatures::setFunctionAttributes()); + assert(!cir::MissingFeatures::setFunctionAttributes()); // TODO(cir): This needs a lot of work to better match CodeGen. That // ultimately ends up in setGlobalVisibility, which already has the linkage of @@ -2808,7 +2808,7 @@ mlir::cir::FuncOp CIRGenModule::GetOrCreateCIRFunction( } // TODO(cir): Might need bitcast to different address space. - assert(!MissingFeatures::addressSpace()); + assert(!cir::MissingFeatures::addressSpace()); return F; } @@ -3135,7 +3135,7 @@ bool CIRGenModule::shouldEmitFunction(GlobalDecl globalDecl) { return false; if (func->hasAttr() && !func->hasAttr()) - assert(!MissingFeatures::setDLLImportDLLExport() && + assert(!cir::MissingFeatures::setDLLImportDLLExport() && "shouldEmitFunction for dllimport is NYI"); // PR9614. Avoid cases where the source code is lying to us. An available @@ -3158,7 +3158,7 @@ void CIRGenModule::maybeSetTrivialComdat(const Decl &d, mlir::Operation *op) { globalOp.setComdat(true); // Keep it as missing feature as we need to implement comdat for FuncOp. // in the future. - assert(!MissingFeatures::setComdat() && "NYI"); + assert(!cir::MissingFeatures::setComdat() && "NYI"); } bool CIRGenModule::isInNoSanitizeList(SanitizerMask Kind, mlir::cir::FuncOp Fn, @@ -3230,7 +3230,7 @@ void CIRGenModule::buildExplicitCastExprType(const ExplicitCastExpr *E, if (CGF && E->getType()->isVariablyModifiedType()) llvm_unreachable("NYI"); - assert(!MissingFeatures::generateDebugInfo() && "NYI"); + assert(!cir::MissingFeatures::generateDebugInfo() && "NYI"); } void CIRGenModule::HandleCXXStaticMemberVarInstantiation(VarDecl *VD) { @@ -3347,7 +3347,7 @@ mlir::cir::GlobalOp CIRGenModule::getOrInsertGlobal( // If the variable exists but has the wrong type, return a bitcast to the // right type. auto GVTy = GV.getSymType(); - assert(!MissingFeatures::addressSpace()); + assert(!cir::MissingFeatures::addressSpace()); auto PTy = builder.getPointerTo(Ty); if (GVTy != PTy) diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.h b/clang/lib/CIR/CodeGen/CIRGenModule.h index 9a28f2d10ebf..5094370c9d2f 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.h +++ b/clang/lib/CIR/CodeGen/CIRGenModule.h @@ -159,7 +159,7 @@ class CIRGenModule : public CIRGenTypeCache { CIRGenTypes &getTypes() { return genTypes; } const clang::LangOptions &getLangOpts() const { return langOpts; } CIRGenFunction *getCurrCIRGenFun() const { return CurCGF; } - const CIRDataLayout getDataLayout() const { + const cir::CIRDataLayout getDataLayout() const { // FIXME(cir): instead of creating a CIRDataLayout every time, set it as an // attribute for the CIRModule class. return {theModule}; diff --git a/clang/lib/CIR/CodeGen/CIRGenOpenCL.cpp b/clang/lib/CIR/CodeGen/CIRGenOpenCL.cpp index 3afca743a6e2..116255b36f26 100644 --- a/clang/lib/CIR/CodeGen/CIRGenOpenCL.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenOpenCL.cpp @@ -71,7 +71,7 @@ void CIRGenModule::genKernelArgMetadata(mlir::cir::FuncOp Fn, SmallVector argNames; // OpenCL image and pipe types require special treatments for some metadata - assert(!MissingFeatures::openCLBuiltinTypes()); + assert(!cir::MissingFeatures::openCLBuiltinTypes()); if (FD && CGF) for (unsigned i = 0, e = FD->getNumParams(); i != e; ++i) { diff --git a/clang/lib/CIR/CodeGen/CIRGenOpenMPRuntime.cpp b/clang/lib/CIR/CodeGen/CIRGenOpenMPRuntime.cpp index fc0f67d803e2..382291fddfea 100644 --- a/clang/lib/CIR/CodeGen/CIRGenOpenMPRuntime.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenOpenMPRuntime.cpp @@ -21,35 +21,35 @@ CIRGenOpenMPRuntime::CIRGenOpenMPRuntime(CIRGenModule &CGM) : CGM(CGM) {} Address CIRGenOpenMPRuntime::getAddressOfLocalVariable(CIRGenFunction &CGF, const VarDecl *VD) { - assert(!MissingFeatures::openMPRuntime()); + assert(!cir::MissingFeatures::openMPRuntime()); return Address::invalid(); } void CIRGenOpenMPRuntime::checkAndEmitLastprivateConditional( CIRGenFunction &CGF, const Expr *LHS) { - assert(!MissingFeatures::openMPRuntime()); + assert(!cir::MissingFeatures::openMPRuntime()); return; } void CIRGenOpenMPRuntime::registerTargetGlobalVariable( const clang::VarDecl *VD, mlir::cir::GlobalOp globalOp) { - assert(!MissingFeatures::openMPRuntime()); + assert(!cir::MissingFeatures::openMPRuntime()); return; } void CIRGenOpenMPRuntime::emitDeferredTargetDecls() const { - assert(!MissingFeatures::openMPRuntime()); + assert(!cir::MissingFeatures::openMPRuntime()); return; } void CIRGenOpenMPRuntime::emitFunctionProlog(CIRGenFunction &CGF, const clang::Decl *D) { - assert(!MissingFeatures::openMPRuntime()); + assert(!cir::MissingFeatures::openMPRuntime()); return; } bool CIRGenOpenMPRuntime::emitTargetGlobal(clang::GlobalDecl &GD) { - assert(!MissingFeatures::openMPRuntime()); + assert(!cir::MissingFeatures::openMPRuntime()); return false; } @@ -70,14 +70,14 @@ void CIRGenOpenMPRuntime::emitTaskWaitCall(CIRGenBuilderTy &builder, } else { llvm_unreachable("NYI"); } - assert(!MissingFeatures::openMPRegionInfo()); + assert(!cir::MissingFeatures::openMPRegionInfo()); } void CIRGenOpenMPRuntime::emitBarrierCall(CIRGenBuilderTy &builder, CIRGenFunction &CGF, mlir::Location Loc) { - assert(!MissingFeatures::openMPRegionInfo()); + assert(!cir::MissingFeatures::openMPRegionInfo()); if (CGF.CGM.getLangOpts().OpenMPIRBuilder) { builder.create(Loc); @@ -103,5 +103,5 @@ void CIRGenOpenMPRuntime::emitTaskyieldCall(CIRGenBuilderTy &builder, llvm_unreachable("NYI"); } - assert(!MissingFeatures::openMPRegionInfo()); + assert(!cir::MissingFeatures::openMPRegionInfo()); } diff --git a/clang/lib/CIR/CodeGen/CIRGenPointerAuth.cpp b/clang/lib/CIR/CodeGen/CIRGenPointerAuth.cpp index 992efb5a25f8..77451800b388 100644 --- a/clang/lib/CIR/CodeGen/CIRGenPointerAuth.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenPointerAuth.cpp @@ -18,6 +18,6 @@ using namespace clang::CIRGen; Address CIRGenFunction::getAsNaturalAddressOf(Address Addr, QualType PointeeTy) { - assert(!MissingFeatures::ptrAuth() && "NYI"); + assert(!cir::MissingFeatures::ptrAuth() && "NYI"); return Addr; } diff --git a/clang/lib/CIR/CodeGen/CIRGenStmt.cpp b/clang/lib/CIR/CodeGen/CIRGenStmt.cpp index 107173eb65c2..8d39419a2b97 100644 --- a/clang/lib/CIR/CodeGen/CIRGenStmt.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenStmt.cpp @@ -83,7 +83,7 @@ Address CIRGenFunction::buildCompoundStmt(const CompoundStmt &S, bool getLast, } void CIRGenFunction::buildStopPoint(const Stmt *S) { - assert(!MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::generateDebugInfo()); } // Build CIR for a statement. useCurrentScope should be true if no @@ -425,11 +425,11 @@ mlir::LogicalResult CIRGenFunction::buildIfStmt(const IfStmt &S) { // TODO(cir): there is still an empty cir.scope generated by the caller. return mlir::success(); } - assert(!MissingFeatures::constantFoldsToSimpleInteger()); + assert(!cir::MissingFeatures::constantFoldsToSimpleInteger()); } - assert(!MissingFeatures::emitCondLikelihoodViaExpectIntrinsic()); - assert(!MissingFeatures::incrementProfileCounter()); + assert(!cir::MissingFeatures::emitCondLikelihoodViaExpectIntrinsic()); + assert(!cir::MissingFeatures::incrementProfileCounter()); return buildIfOnBoolExpr(S.getCond(), S.getThen(), S.getElse()); }; @@ -461,7 +461,7 @@ mlir::LogicalResult CIRGenFunction::buildDeclStmt(const DeclStmt &S) { } mlir::LogicalResult CIRGenFunction::buildReturnStmt(const ReturnStmt &S) { - assert(!MissingFeatures::requiresReturnValueCheck()); + assert(!cir::MissingFeatures::requiresReturnValueCheck()); auto loc = getLoc(S.getSourceRange()); // Emit the result value, even if unused, to evaluate the side effects. @@ -479,7 +479,7 @@ mlir::LogicalResult CIRGenFunction::buildReturnStmt(const ReturnStmt &S) { auto handleReturnVal = [&]() { if (getContext().getLangOpts().ElideConstructors && S.getNRVOCandidate() && S.getNRVOCandidate()->isNRVOVariable()) { - assert(!MissingFeatures::openMP()); + assert(!cir::MissingFeatures::openMP()); // Apply the named return value optimization for this return statement, // which means doing nothing: the appropriate result has already been // constructed into the NRVO variable. @@ -504,16 +504,16 @@ mlir::LogicalResult CIRGenFunction::buildReturnStmt(const ReturnStmt &S) { } else { mlir::Value V = nullptr; switch (CIRGenFunction::getEvaluationKind(RV->getType())) { - case TEK_Scalar: + case cir::TEK_Scalar: V = buildScalarExpr(RV); builder.CIRBaseBuilderTy::createStore(loc, V, *FnRetAlloca); break; - case TEK_Complex: + case cir::TEK_Complex: buildComplexExprIntoLValue(RV, makeAddrLValue(ReturnValue, RV->getType()), /*isInit*/ true); break; - case TEK_Aggregate: + case cir::TEK_Aggregate: buildAggExpr( RV, AggValueSlot::forAddr( ReturnValue, Qualifiers(), AggValueSlot::IsDestructed, @@ -802,19 +802,19 @@ CIRGenFunction::buildCXXForRangeStmt(const CXXForRangeStmt &S, if (buildStmt(S.getEndStmt(), /*useCurrentScope=*/true).failed()) return mlir::failure(); - assert(!MissingFeatures::loopInfoStack()); + assert(!cir::MissingFeatures::loopInfoStack()); // From LLVM: if there are any cleanups between here and the loop-exit // scope, create a block to stage a loop exit along. // We probably already do the right thing because of ScopeOp, but make // sure we handle all cases. - assert(!MissingFeatures::requiresCleanups()); + assert(!cir::MissingFeatures::requiresCleanups()); forOp = builder.createFor( getLoc(S.getSourceRange()), /*condBuilder=*/ [&](mlir::OpBuilder &b, mlir::Location loc) { - assert(!MissingFeatures::createProfileWeightsForLoop()); - assert(!MissingFeatures::emitCondLikelihoodViaExpectIntrinsic()); + assert(!cir::MissingFeatures::createProfileWeightsForLoop()); + assert(!cir::MissingFeatures::emitCondLikelihoodViaExpectIntrinsic()); mlir::Value condVal = evaluateExprAsBool(S.getCond()); builder.createCondition(condVal); }, @@ -869,19 +869,19 @@ mlir::LogicalResult CIRGenFunction::buildForStmt(const ForStmt &S) { if (S.getInit()) if (buildStmt(S.getInit(), /*useCurrentScope=*/true).failed()) return mlir::failure(); - assert(!MissingFeatures::loopInfoStack()); + assert(!cir::MissingFeatures::loopInfoStack()); // From LLVM: if there are any cleanups between here and the loop-exit // scope, create a block to stage a loop exit along. // We probably already do the right thing because of ScopeOp, but make // sure we handle all cases. - assert(!MissingFeatures::requiresCleanups()); + assert(!cir::MissingFeatures::requiresCleanups()); forOp = builder.createFor( getLoc(S.getSourceRange()), /*condBuilder=*/ [&](mlir::OpBuilder &b, mlir::Location loc) { - assert(!MissingFeatures::createProfileWeightsForLoop()); - assert(!MissingFeatures::emitCondLikelihoodViaExpectIntrinsic()); + assert(!cir::MissingFeatures::createProfileWeightsForLoop()); + assert(!cir::MissingFeatures::emitCondLikelihoodViaExpectIntrinsic()); mlir::Value condVal; if (S.getCond()) { // If the for statement has a condition scope, @@ -944,19 +944,19 @@ mlir::LogicalResult CIRGenFunction::buildDoStmt(const DoStmt &S) { // TODO: pass in array of attributes. auto doStmtBuilder = [&]() -> mlir::LogicalResult { auto loopRes = mlir::success(); - assert(!MissingFeatures::loopInfoStack()); + assert(!cir::MissingFeatures::loopInfoStack()); // From LLVM: if there are any cleanups between here and the loop-exit // scope, create a block to stage a loop exit along. // We probably already do the right thing because of ScopeOp, but make // sure we handle all cases. - assert(!MissingFeatures::requiresCleanups()); + assert(!cir::MissingFeatures::requiresCleanups()); doWhileOp = builder.createDoWhile( getLoc(S.getSourceRange()), /*condBuilder=*/ [&](mlir::OpBuilder &b, mlir::Location loc) { - assert(!MissingFeatures::createProfileWeightsForLoop()); - assert(!MissingFeatures::emitCondLikelihoodViaExpectIntrinsic()); + assert(!cir::MissingFeatures::createProfileWeightsForLoop()); + assert(!cir::MissingFeatures::emitCondLikelihoodViaExpectIntrinsic()); // C99 6.8.5p2/p4: The first substatement is executed if the // expression compares unequal to 0. The condition must be a // scalar type. @@ -994,19 +994,19 @@ mlir::LogicalResult CIRGenFunction::buildWhileStmt(const WhileStmt &S) { // TODO: pass in array of attributes. auto whileStmtBuilder = [&]() -> mlir::LogicalResult { auto loopRes = mlir::success(); - assert(!MissingFeatures::loopInfoStack()); + assert(!cir::MissingFeatures::loopInfoStack()); // From LLVM: if there are any cleanups between here and the loop-exit // scope, create a block to stage a loop exit along. // We probably already do the right thing because of ScopeOp, but make // sure we handle all cases. - assert(!MissingFeatures::requiresCleanups()); + assert(!cir::MissingFeatures::requiresCleanups()); whileOp = builder.createWhile( getLoc(S.getSourceRange()), /*condBuilder=*/ [&](mlir::OpBuilder &b, mlir::Location loc) { - assert(!MissingFeatures::createProfileWeightsForLoop()); - assert(!MissingFeatures::emitCondLikelihoodViaExpectIntrinsic()); + assert(!cir::MissingFeatures::createProfileWeightsForLoop()); + assert(!cir::MissingFeatures::emitCondLikelihoodViaExpectIntrinsic()); mlir::Value condVal; // If the for statement has a condition scope, // emit the local variable declaration. diff --git a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp index ede4f3a85702..1e1263ae9756 100644 --- a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp @@ -773,14 +773,14 @@ mlir::Type CIRGenTypes::ConvertType(QualType T) { } const CIRGenFunctionInfo &CIRGenTypes::arrangeCIRFunctionInfo( - CanQualType resultType, FnInfoOpts opts, + CanQualType resultType, cir::FnInfoOpts opts, llvm::ArrayRef argTypes, FunctionType::ExtInfo info, llvm::ArrayRef paramInfos, RequiredArgs required) { assert(llvm::all_of(argTypes, [](CanQualType T) { return T.isCanonicalAsParam(); })); - bool instanceMethod = opts == FnInfoOpts::IsInstanceMethod; - bool chainCall = opts == FnInfoOpts::IsChainCall; + bool instanceMethod = opts == cir::FnInfoOpts::IsInstanceMethod; + bool chainCall = opts == cir::FnInfoOpts::IsChainCall; // Lookup or create unique function info. llvm::FoldingSetNodeID ID; @@ -817,7 +817,7 @@ const CIRGenFunctionInfo &CIRGenTypes::arrangeCIRFunctionInfo( // Loop over all of the computed argument and return value info. If any of // them are direct or extend without a specified coerce type, specify the // default now. - ABIArgInfo &retInfo = FI->getReturnInfo(); + cir::ABIArgInfo &retInfo = FI->getReturnInfo(); if (retInfo.canHaveCoerceToType() && retInfo.getCoerceToType() == nullptr) retInfo.setCoerceToType(ConvertType(FI->getReturnType())); @@ -861,7 +861,7 @@ void CIRGenTypes::UpdateCompletedType(const TagDecl *TD) { } // If necessary, provide the full definition of a type only used with a // declaration so far. - assert(!MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::generateDebugInfo()); return; } diff --git a/clang/lib/CIR/CodeGen/CIRGenTypes.h b/clang/lib/CIR/CodeGen/CIRGenTypes.h index a6ef7eb28275..16df1bc99ee8 100644 --- a/clang/lib/CIR/CodeGen/CIRGenTypes.h +++ b/clang/lib/CIR/CodeGen/CIRGenTypes.h @@ -78,7 +78,7 @@ class CIRGenBuilderTy; /// AST types to CIR types. class CIRGenTypes { clang::ASTContext &Context; - cir::CIRGenBuilderTy &Builder; + CIRGenBuilderTy &Builder; CIRGenModule &CGM; const clang::TargetInfo &Target; CIRGenCXXABI &TheCXXABI; @@ -118,7 +118,7 @@ class CIRGenTypes { CIRGenTypes(CIRGenModule &cgm); ~CIRGenTypes(); - cir::CIRGenBuilderTy &getBuilder() const { return Builder; } + CIRGenBuilderTy &getBuilder() const { return Builder; } CIRGenModule &getModule() const { return CGM; } /// Utility to check whether a function type can be converted to a CIR type @@ -270,7 +270,7 @@ class CIRGenTypes { /// /// \param argTypes - must all actually be canonical as params const CIRGenFunctionInfo &arrangeCIRFunctionInfo( - clang::CanQualType returnType, FnInfoOpts opts, + clang::CanQualType returnType, cir::FnInfoOpts opts, llvm::ArrayRef argTypes, clang::FunctionType::ExtInfo info, llvm::ArrayRef paramInfos, diff --git a/clang/lib/CIR/CodeGen/CIRGenVTables.cpp b/clang/lib/CIR/CodeGen/CIRGenVTables.cpp index f92d90256a89..1f12fed80243 100644 --- a/clang/lib/CIR/CodeGen/CIRGenVTables.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenVTables.cpp @@ -161,7 +161,7 @@ void CIRGenModule::buildVTable(CXXRecordDecl *rd) { } void CIRGenVTables::GenerateClassData(const CXXRecordDecl *RD) { - assert(!MissingFeatures::generateDebugInfo()); + assert(!cir::MissingFeatures::generateDebugInfo()); if (RD->getNumVBases()) CGM.getCXXABI().emitVirtualInheritanceTables(RD); @@ -248,7 +248,7 @@ void CIRGenVTables::addVTableComponent(ConstantArrayBuilder &builder, CGM.getBuilder().getFuncType({}, CGM.getBuilder().getVoidTy()); mlir::cir::FuncOp fnPtr = CGM.createRuntimeFunction(fnTy, name); // LLVM codegen handles unnamedAddr - assert(!MissingFeatures::unnamedAddr()); + assert(!cir::MissingFeatures::unnamedAddr()); return fnPtr; }; @@ -371,7 +371,7 @@ mlir::cir::GlobalOp CIRGenVTables::generateConstructionVTable( Loc, Name, VTType, Linkage, CharUnits::fromQuantity(Align)); // V-tables are always unnamed_addr. - assert(!MissingFeatures::unnamedAddr() && "NYI"); + assert(!cir::MissingFeatures::unnamedAddr() && "NYI"); auto RTTI = CGM.getAddrOfRTTIDescriptor( Loc, CGM.getASTContext().getTagDeclType(Base.getBase())); @@ -652,7 +652,7 @@ void CIRGenVTables::buildVTTDefinition(mlir::cir::GlobalOp VTT, CIRGenModule::getMLIRVisibility(VTT)); if (CGM.supportsCOMDAT() && VTT.isWeakForLinker()) { - assert(!MissingFeatures::setComdat()); + assert(!cir::MissingFeatures::setComdat()); } } diff --git a/clang/lib/CIR/CodeGen/CIRRecordLayoutBuilder.cpp b/clang/lib/CIR/CodeGen/CIRRecordLayoutBuilder.cpp index 91d6c48d32b7..325927158384 100644 --- a/clang/lib/CIR/CodeGen/CIRRecordLayoutBuilder.cpp +++ b/clang/lib/CIR/CodeGen/CIRRecordLayoutBuilder.cpp @@ -215,7 +215,7 @@ struct CIRRecordLowering final { llvm::DenseMap bitFields; llvm::DenseMap nonVirtualBases; llvm::DenseMap virtualBases; - CIRDataLayout dataLayout; + cir::CIRDataLayout dataLayout; bool IsZeroInitializable : 1; bool IsZeroInitializableAsBase : 1; bool isPacked : 1; @@ -402,7 +402,7 @@ void CIRRecordLowering::computeVolatileBitfields() { return; for ([[maybe_unused]] auto &I : bitFields) { - assert(!MissingFeatures::armComputeVolatileBitfields()); + assert(!cir::MissingFeatures::armComputeVolatileBitfields()); } } diff --git a/clang/lib/CIR/CodeGen/ConstantInitFuture.h b/clang/lib/CIR/CodeGen/ConstantInitFuture.h index 34e596292e11..9a164e3c1154 100644 --- a/clang/lib/CIR/CodeGen/ConstantInitFuture.h +++ b/clang/lib/CIR/CodeGen/ConstantInitFuture.h @@ -29,8 +29,8 @@ class ConstantInitBuilderBase; } // namespace clang::CIRGen namespace llvm { -template <> struct PointerLikeTypeTraits<::cir::ConstantInitBuilderBase *> { - using T = ::cir::ConstantInitBuilderBase *; +template <> struct PointerLikeTypeTraits { + using T = clang::CIRGen::ConstantInitBuilderBase *; static inline void *getAsVoidPointer(T p) { return p; } static inline T getFromVoidPointer(void *p) { return static_cast(p); } @@ -85,8 +85,8 @@ class ConstantInitFuture { namespace llvm { -template <> struct PointerLikeTypeTraits<::cir::ConstantInitFuture> { - using T = ::cir::ConstantInitFuture; +template <> struct PointerLikeTypeTraits { + using T = clang::CIRGen::ConstantInitFuture; static inline void *getAsVoidPointer(T future) { return future.getOpaqueValue(); diff --git a/clang/lib/CIR/CodeGen/TargetInfo.cpp b/clang/lib/CIR/CodeGen/TargetInfo.cpp index 372c64af1c88..1ceb6d66c519 100644 --- a/clang/lib/CIR/CodeGen/TargetInfo.cpp +++ b/clang/lib/CIR/CodeGen/TargetInfo.cpp @@ -44,9 +44,9 @@ class DefaultABIInfo : public ABIInfo { virtual ~DefaultABIInfo() = default; - ABIArgInfo classifyReturnType(QualType RetTy) const { + cir::ABIArgInfo classifyReturnType(QualType RetTy) const { if (RetTy->isVoidType()) - return ABIArgInfo::getIgnore(); + return cir::ABIArgInfo::getIgnore(); if (isAggregateTypeForABI(RetTy)) llvm_unreachable("NYI"); @@ -58,11 +58,11 @@ class DefaultABIInfo : public ABIInfo { if (const auto *EIT = RetTy->getAs()) llvm_unreachable("NYI"); - return (isPromotableIntegerTypeForABI(RetTy) ? ABIArgInfo::getExtend(RetTy) - : ABIArgInfo::getDirect()); + return (isPromotableIntegerTypeForABI(RetTy) ? cir::ABIArgInfo::getExtend(RetTy) + : cir::ABIArgInfo::getDirect()); } - ABIArgInfo classifyArgumentType(QualType Ty) const { + cir::ABIArgInfo classifyArgumentType(QualType Ty) const { Ty = useFirstFieldIfTransparentUnion(Ty); if (isAggregateTypeForABI(Ty)) { @@ -76,8 +76,8 @@ class DefaultABIInfo : public ABIInfo { if (const auto *EIT = Ty->getAs()) llvm_unreachable("NYI"); - return (isPromotableIntegerTypeForABI(Ty) ? ABIArgInfo::getExtend(Ty) - : ABIArgInfo::getDirect()); + return (isPromotableIntegerTypeForABI(Ty) ? cir::ABIArgInfo::getExtend(Ty) + : cir::ABIArgInfo::getDirect()); } void computeInfo(CIRGenFunctionInfo &FI) const override { @@ -114,8 +114,8 @@ class AArch64ABIInfo : public ABIInfo { ABIKind getABIKind() const { return Kind; } bool isDarwinPCS() const { return Kind == DarwinPCS; } - ABIArgInfo classifyReturnType(QualType RetTy, bool IsVariadic) const; - ABIArgInfo classifyArgumentType(QualType RetTy, bool IsVariadic, + cir::ABIArgInfo classifyReturnType(QualType RetTy, bool IsVariadic) const; + cir::ABIArgInfo classifyArgumentType(QualType RetTy, bool IsVariadic, unsigned CallingConvention) const; void computeInfo(CIRGenFunctionInfo &FI) const override { @@ -126,15 +126,15 @@ class AArch64ABIInfo : public ABIInfo { ie = FI.arg_end(); it != ie; ++it) { if (testIfIsVoidTy(it->type)) - it->info = ABIArgInfo::getIgnore(); + it->info = cir::ABIArgInfo::getIgnore(); else - it->info = ABIArgInfo::getDirect(CGT.ConvertType(it->type)); + it->info = cir::ABIArgInfo::getDirect(CGT.ConvertType(it->type)); } auto RetTy = FI.getReturnType(); if (testIfIsVoidTy(RetTy)) - FI.getReturnInfo() = ABIArgInfo::getIgnore(); + FI.getReturnInfo() = cir::ABIArgInfo::getIgnore(); else - FI.getReturnInfo() = ABIArgInfo::getDirect(CGT.ConvertType(RetTy)); + FI.getReturnInfo() = cir::ABIArgInfo::getDirect(CGT.ConvertType(RetTy)); return; } @@ -158,7 +158,7 @@ namespace { using X86AVXABILevel = ::cir::X86AVXABILevel; class X86_64ABIInfo : public ABIInfo { - using Class = X86ArgClass; + using Class = cir::X86ArgClass; // X86AVXABILevel AVXLevel; // Some ABIs (e.g. X32 ABI and Native Client OS) use 32 bit pointers on 64-bit @@ -204,9 +204,9 @@ class X86_64ABIInfo : public ABIInfo { clang::QualType SourceTy, unsigned SourceOffset) const; - ABIArgInfo classifyReturnType(QualType RetTy) const; + cir::ABIArgInfo classifyReturnType(QualType RetTy) const; - ABIArgInfo classifyArgumentType(clang::QualType Ty, unsigned freeIntRegs, + cir::ABIArgInfo classifyArgumentType(clang::QualType Ty, unsigned freeIntRegs, unsigned &neededInt, unsigned &neededSSE, bool isNamedArg) const; @@ -219,7 +219,7 @@ class X86_64ABIInfo : public ABIInfo { /// /// \param freeIntRegs - The number of free integer registers remaining /// available. - ABIArgInfo getIndirectResult(QualType Ty, unsigned freeIntRegs) const; + cir::ABIArgInfo getIndirectResult(QualType Ty, unsigned freeIntRegs) const; }; class X86_64TargetCIRGenInfo : public TargetCIRGenInfo { @@ -263,7 +263,7 @@ class SPIRVABIInfo : public CommonSPIRABIInfo { } private: - ABIArgInfo classifyKernelArgumentType(QualType Ty) const { + cir::ABIArgInfo classifyKernelArgumentType(QualType Ty) const { assert(!getContext().getLangOpts().CUDAIsDevice && "NYI"); return classifyArgumentType(Ty); } @@ -318,7 +318,7 @@ CIRGenCXXABI &ABIInfo::getCXXABI() const { return CGT.getCXXABI(); } clang::ASTContext &ABIInfo::getContext() const { return CGT.getContext(); } -ABIArgInfo X86_64ABIInfo::getIndirectResult(QualType Ty, +cir::ABIArgInfo X86_64ABIInfo::getIndirectResult(QualType Ty, unsigned freeIntRegs) const { assert(false && "NYI"); } @@ -330,15 +330,15 @@ void X86_64ABIInfo::computeInfo(CIRGenFunctionInfo &FI) const { for (CIRGenFunctionInfo::arg_iterator it = FI.arg_begin(), ie = FI.arg_end(); it != ie; ++it) { if (testIfIsVoidTy(it->type)) - it->info = ABIArgInfo::getIgnore(); + it->info = cir::ABIArgInfo::getIgnore(); else - it->info = ABIArgInfo::getDirect(CGT.ConvertType(it->type)); + it->info = cir::ABIArgInfo::getDirect(CGT.ConvertType(it->type)); } auto RetTy = FI.getReturnType(); if (testIfIsVoidTy(RetTy)) - FI.getReturnInfo() = ABIArgInfo::getIgnore(); + FI.getReturnInfo() = cir::ABIArgInfo::getIgnore(); else - FI.getReturnInfo() = ABIArgInfo::getDirect(CGT.ConvertType(RetTy)); + FI.getReturnInfo() = cir::ABIArgInfo::getDirect(CGT.ConvertType(RetTy)); } /// GetINTEGERTypeAtOffset - The ABI specifies that a value should be passed in @@ -365,7 +365,7 @@ mlir::Type X86_64ABIInfo::GetINTEGERTypeAtOffset(mlir::Type CIRType, return CIRType; } -ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty, +cir::ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty, unsigned int freeIntRegs, unsigned int &neededInt, unsigned int &neededSSE, @@ -403,7 +403,7 @@ ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty, assert(!Ty->getAs() && "NYI"); if (Ty->isSignedIntegerOrEnumerationType() && isPromotableIntegerTypeForABI(Ty)) - return ABIArgInfo::getExtend(Ty); + return cir::ABIArgInfo::getExtend(Ty); } break; @@ -429,7 +429,7 @@ ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty, assert(!HighPart && "NYI"); - return ABIArgInfo::getDirect(ResType); + return cir::ABIArgInfo::getDirect(ResType); } ABIInfo::~ABIInfo() {} @@ -501,7 +501,7 @@ mlir::Type X86_64ABIInfo::GetSSETypeAtOffset(mlir::Type CIRType, return CIRType; } -ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy) const { +cir::ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy) const { // AMD64-ABI 3.2.3p4: Rule 1. Classify the return type with the classification // algorithm. X86_64ABIInfo::Class Lo, Hi; @@ -520,7 +520,7 @@ ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy) const { switch (Lo) { case Class::NoClass: assert(Hi == Class::NoClass && "Only NoClass supported so far for Hi"); - return ABIArgInfo::getIgnore(); + return cir::ABIArgInfo::getIgnore(); // AMD64-ABI 3.2.3p4: Rule 3. If the class is INTEGER, the next available // register of the sequence %rax, %rdx is used. @@ -537,7 +537,7 @@ ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy) const { if (RetTy->isIntegralOrEnumerationType() && isPromotableIntegerTypeForABI(RetTy)) { - return ABIArgInfo::getExtend(RetTy); + return cir::ABIArgInfo::getExtend(RetTy); } } break; @@ -557,11 +557,11 @@ ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy) const { if (HighPart) assert(false && "NYI"); - return ABIArgInfo::getDirect(ResType); + return cir::ABIArgInfo::getDirect(ResType); } clang::LangAS -TargetCIRGenInfo::getGlobalVarAddressSpace(cir::CIRGenModule &CGM, +TargetCIRGenInfo::getGlobalVarAddressSpace(CIRGenModule &CGM, const clang::VarDecl *D) const { assert(!CGM.getLangOpts().OpenCL && !(CGM.getLangOpts().CUDA && CGM.getLangOpts().CUDAIsDevice) &&