diff --git a/clang/lib/CIR/CodeGen/CIRAsm.cpp b/clang/lib/CIR/CodeGen/CIRAsm.cpp index a20e75e07423..2513b92e8010 100644 --- a/clang/lib/CIR/CodeGen/CIRAsm.cpp +++ b/clang/lib/CIR/CodeGen/CIRAsm.cpp @@ -455,7 +455,7 @@ mlir::LogicalResult CIRGenFunction::emitAsmStmt(const AsmStmt &S) { uint64_t InputSize = getContext().getTypeSize(InputTy); if (getContext().getTypeSize(OutputType) < InputSize) { // Form the asm to return the value as a larger integer or fp type. - ResultRegTypes.back() = ConvertType(InputTy); + ResultRegTypes.back() = convertType(InputTy); } } if (mlir::Type AdjTy = getTargetHooks().adjustInlineAsmType( @@ -478,7 +478,7 @@ mlir::LogicalResult CIRGenFunction::emitAsmStmt(const AsmStmt &S) { // Otherwise there will be a mis-match if the matrix is also an // input-argument which is represented as vector. if (isa(OutExpr->getType().getCanonicalType())) - DestAddr = DestAddr.withElementType(ConvertType(OutExpr->getType())); + DestAddr = DestAddr.withElementType(convertType(OutExpr->getType())); ArgTypes.push_back(DestAddr.getType()); ArgElemTypes.push_back(DestAddr.getElementType()); diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp index 6274d7bca869..e7db6da60945 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp @@ -72,7 +72,7 @@ static RValue emitUnaryFPBuiltin(CIRGenFunction &CGF, const CallExpr &E) { template static RValue emitUnaryMaybeConstrainedFPToIntBuiltin(CIRGenFunction &CGF, const CallExpr &E) { - auto ResultType = CGF.ConvertType(E.getType()); + auto ResultType = CGF.convertType(E.getType()); auto Src = CGF.emitScalarExpr(E.getArg(0)); if (CGF.getBuilder().getIsFPConstrained()) @@ -88,7 +88,7 @@ static RValue emitBinaryFPBuiltin(CIRGenFunction &CGF, const CallExpr &E) { auto Arg1 = CGF.emitScalarExpr(E.getArg(1)); auto Loc = CGF.getLoc(E.getExprLoc()); - auto Ty = CGF.ConvertType(E.getType()); + auto Ty = CGF.convertType(E.getType()); auto Call = CGF.getBuilder().create(Loc, Ty, Arg0, Arg1); return RValue::get(Call->getResult(0)); @@ -101,7 +101,7 @@ static mlir::Value emitBinaryMaybeConstrainedFPBuiltin(CIRGenFunction &CGF, auto Arg1 = CGF.emitScalarExpr(E.getArg(1)); auto Loc = CGF.getLoc(E.getExprLoc()); - auto Ty = CGF.ConvertType(E.getType()); + auto Ty = CGF.convertType(E.getType()); if (CGF.getBuilder().getIsFPConstrained()) { CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII(CGF, &E); @@ -122,7 +122,7 @@ emitBuiltinBitOp(CIRGenFunction &CGF, const CallExpr *E, else arg = CGF.emitScalarExpr(E->getArg(0)); - auto resultTy = CGF.ConvertType(E->getType()); + auto resultTy = CGF.convertType(E->getType()); auto op = CGF.getBuilder().create(CGF.getLoc(E->getExprLoc()), resultTy, arg); return RValue::get(op); @@ -415,7 +415,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // of the type. We feel it should be Ok to use expression type because // it is hard to imagine a builtin function evaluates to // a value that over/underflows its own defined type. - mlir::Type resTy = getCIRType(E->getType()); + mlir::Type resTy = convertType(E->getType()); return RValue::get(builder.getConstFP(getLoc(E->getExprLoc()), resTy, Result.Val.getFloat())); } @@ -1173,7 +1173,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, return emitRotate(E, true); case Builtin::BI__builtin_constant_p: { - mlir::Type ResultType = ConvertType(E->getType()); + mlir::Type ResultType = convertType(E->getType()); const Expr *Arg = E->getArg(0); QualType ArgType = Arg->getType(); @@ -1199,7 +1199,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // Convert Objective-C objects to id because we cannot distinguish between // LLVM types for Obj-C classes as they are opaque. ArgType = CGM.getASTContext().getObjCIdType(); - ArgValue = builder.createBitcast(ArgValue, ConvertType(ArgType)); + ArgValue = builder.createBitcast(ArgValue, convertType(ArgType)); mlir::Value Result = builder.create( getLoc(E->getSourceRange()), ArgValue); @@ -1215,7 +1215,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, case Builtin::BI__builtin_object_size: { unsigned Type = E->getArg(1)->EvaluateKnownConstInt(getContext()).getZExtValue(); - auto ResType = mlir::dyn_cast(ConvertType(E->getType())); + auto ResType = mlir::dyn_cast(convertType(E->getType())); assert(ResType && "not sure what to do?"); // We pass this builtin onto the optimizer so that it can figure out the @@ -1306,7 +1306,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, llvm_unreachable("BI__builtin_nondeterministic_value NYI"); case Builtin::BI__builtin_elementwise_abs: { - mlir::Type cirTy = ConvertType(E->getArg(0)->getType()); + mlir::Type cirTy = convertType(E->getArg(0)->getType()); bool isIntTy = cir::isIntOrIntVectorTy(cirTy); if (!isIntTy) { mlir::Type eltTy = cirTy; @@ -1851,7 +1851,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, auto loc = getLoc(E->getBeginLoc()); return RValue::get(builder.createZExtOrBitCast( loc, emitSignBit(loc, *this, emitScalarExpr(E->getArg(0))), - ConvertType(E->getType()))); + convertType(E->getType()))); } case Builtin::BI__warn_memset_zero_len: @@ -1897,8 +1897,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, auto EncompassingCIRTy = cir::IntType::get( &getMLIRContext(), EncompassingInfo.Width, EncompassingInfo.Signed); - auto ResultCIRTy = - mlir::cast(CGM.getTypes().ConvertType(ResultQTy)); + auto ResultCIRTy = mlir::cast(CGM.convertType(ResultQTy)); mlir::Value Left = emitScalarExpr(LeftArg); mlir::Value Right = emitScalarExpr(RightArg); @@ -2008,8 +2007,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, clang::QualType ResultQTy = ResultArg->getType()->castAs()->getPointeeType(); - auto ResultCIRTy = - mlir::cast(CGM.getTypes().ConvertType(ResultQTy)); + auto ResultCIRTy = mlir::cast(CGM.convertType(ResultQTy)); auto Loc = getLoc(E->getSourceRange()); auto ArithResult = @@ -2304,7 +2302,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // FIXME: We should use builder.createZExt once createZExt is available. return RValue::get(builder.createZExtOrBitCast( Loc, builder.createIsFPClass(Loc, V, FPClassTest::fcNan), - ConvertType(E->getType()))); + convertType(E->getType()))); } case Builtin::BI__builtin_issignaling: { @@ -2314,7 +2312,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // FIXME: We should use builder.createZExt once createZExt is available. return RValue::get(builder.createZExtOrBitCast( Loc, builder.createIsFPClass(Loc, V, FPClassTest::fcSNan), - ConvertType(E->getType()))); + convertType(E->getType()))); } case Builtin::BI__builtin_isinf: { @@ -2326,7 +2324,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // FIXME: We should use builder.createZExt once createZExt is available. return RValue::get(builder.createZExtOrBitCast( Loc, builder.createIsFPClass(Loc, V, FPClassTest::fcInf), - ConvertType(E->getType()))); + convertType(E->getType()))); } case Builtin::BIfinite: @@ -2344,7 +2342,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // FIXME: We should use builder.createZExt once createZExt is available. return RValue::get(builder.createZExtOrBitCast( Loc, builder.createIsFPClass(Loc, V, FPClassTest::fcFinite), - ConvertType(E->getType()))); + convertType(E->getType()))); } case Builtin::BI__builtin_isnormal: { @@ -2354,7 +2352,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // FIXME: We should use builder.createZExt once createZExt is available. return RValue::get(builder.createZExtOrBitCast( Loc, builder.createIsFPClass(Loc, V, FPClassTest::fcNormal), - ConvertType(E->getType()))); + convertType(E->getType()))); } case Builtin::BI__builtin_issubnormal: { @@ -2364,7 +2362,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // FIXME: We should use builder.createZExt once createZExt is available. return RValue::get(builder.createZExtOrBitCast( Loc, builder.createIsFPClass(Loc, V, FPClassTest::fcSubnormal), - ConvertType(E->getType()))); + convertType(E->getType()))); } case Builtin::BI__builtin_iszero: { @@ -2374,7 +2372,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // FIXME: We should use builder.createZExt once createZExt is available. return RValue::get(builder.createZExtOrBitCast( Loc, builder.createIsFPClass(Loc, V, FPClassTest::fcZero), - ConvertType(E->getType()))); + convertType(E->getType()))); } case Builtin::BI__builtin_isfpclass: { @@ -2389,7 +2387,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // FIXME: We should use builder.createZExt once createZExt is available. return RValue::get(builder.createZExtOrBitCast( - Loc, builder.createIsFPClass(Loc, V, Test), ConvertType(E->getType()))); + Loc, builder.createIsFPClass(Loc, V, Test), convertType(E->getType()))); } } @@ -2706,6 +2704,6 @@ cir::FuncOp CIRGenModule::getBuiltinLibFunction(const FunctionDecl *FD, Name = astContext.BuiltinInfo.getName(BuiltinID).substr(10); } - auto Ty = getTypes().ConvertType(FD->getType()); + auto Ty = convertType(FD->getType()); return GetOrCreateCIRFunction(Name, Ty, D, /*ForVTable=*/false); } diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp index 43917da7f9cd..756bf7bd471b 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp @@ -2135,7 +2135,7 @@ static mlir::Value emitArmLdrexNon128Intrinsic(unsigned int builtinID, // Get Instrinc call CIRGenBuilderTy &builder = cgf.getBuilder(); QualType clangResTy = clangCallExpr->getType(); - mlir::Type realResTy = cgf.ConvertType(clangResTy); + mlir::Type realResTy = cgf.convertType(clangResTy); // Return type of LLVM intrinsic is defined in Intrinsic.td, // which can be found under LLVM IR directory. mlir::Type funcResTy = builder.getSInt64Ty(); @@ -2347,7 +2347,7 @@ emitCommonNeonCallPattern0(CIRGenFunction &cgf, llvm::StringRef intrincsName, mlir::Value res = emitNeonCall(builder, std::move(argTypes), ops, intrincsName, funcResTy, cgf.getLoc(e->getExprLoc())); - mlir::Type resultType = cgf.ConvertType(e->getType()); + mlir::Type resultType = cgf.convertType(e->getType()); return builder.createBitcast(res, resultType); } diff --git a/clang/lib/CIR/CodeGen/CIRGenCall.cpp b/clang/lib/CIR/CodeGen/CIRGenCall.cpp index 45bcdbf40cee..5a5bf3007c14 100644 --- a/clang/lib/CIR/CodeGen/CIRGenCall.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenCall.cpp @@ -1610,7 +1610,7 @@ void CIRGenFunction::emitNonNullArgCheck(RValue RV, QualType ArgType, mlir::Value CIRGenFunction::emitVAArg(VAArgExpr *VE, Address &VAListAddr) { assert(!VE->isMicrosoftABI() && "NYI"); auto loc = CGM.getLoc(VE->getExprLoc()); - auto type = ConvertType(VE->getType()); + auto type = convertType(VE->getType()); auto vaList = emitVAListRef(VE->getSubExpr()).getPointer(); return builder.create(loc, type, vaList); } diff --git a/clang/lib/CIR/CodeGen/CIRGenClass.cpp b/clang/lib/CIR/CodeGen/CIRGenClass.cpp index 13e6de13bbb0..755ff91aeb34 100644 --- a/clang/lib/CIR/CodeGen/CIRGenClass.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenClass.cpp @@ -582,7 +582,7 @@ Address CIRGenFunction::getAddressOfDirectBaseInCompleteClass( mlir::Location loc, Address This, const CXXRecordDecl *Derived, const CXXRecordDecl *Base, bool BaseIsVirtual) { // 'this' must be a pointer (in some address space) to Derived. - assert(This.getElementType() == ConvertType(Derived)); + assert(This.getElementType() == convertType(Derived)); // Compute the offset of the virtual base. CharUnits Offset; @@ -592,7 +592,7 @@ Address CIRGenFunction::getAddressOfDirectBaseInCompleteClass( else Offset = Layout.getBaseClassOffset(Base); - return builder.createBaseClassAddr(loc, This, ConvertType(Base), + return builder.createBaseClassAddr(loc, This, convertType(Base), Offset.getQuantity(), /*assume_not_null=*/true); } @@ -1591,7 +1591,7 @@ Address CIRGenFunction::getAddressOfDerivedClass( QualType derivedTy = getContext().getCanonicalType(getContext().getTagDeclType(derived)); - mlir::Type derivedValueTy = ConvertType(derivedTy); + mlir::Type derivedValueTy = convertType(derivedTy); CharUnits nonVirtualOffset = CGM.getNonVirtualBaseClassOffset(derived, pathBegin, pathEnd); diff --git a/clang/lib/CIR/CodeGen/CIRGenCoroutine.cpp b/clang/lib/CIR/CodeGen/CIRGenCoroutine.cpp index 6b6ed53faafa..0408ddc26449 100644 --- a/clang/lib/CIR/CodeGen/CIRGenCoroutine.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenCoroutine.cpp @@ -262,7 +262,7 @@ CIRGenFunction::emitCoroutineBody(const CoroutineBodyStmt &S) { // Initialize address of coroutine frame to null auto astVoidPtrTy = CGM.getASTContext().VoidPtrTy; - auto allocaTy = getTypes().convertTypeForMem(astVoidPtrTy); + auto allocaTy = convertTypeForMem(astVoidPtrTy); Address coroFrame = CreateTempAlloca(allocaTy, getContext().getTypeAlignInChars(astVoidPtrTy), openCurlyLoc, "__coro_frame_addr", diff --git a/clang/lib/CIR/CodeGen/CIRGenDecl.cpp b/clang/lib/CIR/CodeGen/CIRGenDecl.cpp index c4d53a8477ec..b44896241eff 100644 --- a/clang/lib/CIR/CodeGen/CIRGenDecl.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenDecl.cpp @@ -139,7 +139,7 @@ CIRGenFunction::emitAutoVarAlloca(const VarDecl &D, if (isEscapingByRef) llvm_unreachable("NYI"); - mlir::Type allocaTy = getTypes().convertTypeForMem(Ty); + mlir::Type allocaTy = convertTypeForMem(Ty); CharUnits allocaAlignment = alignment; // Create the temp alloca and declare variable using it. mlir::Value addrVal; @@ -482,7 +482,7 @@ CIRGenModule::getOrCreateStaticVarDecl(const VarDecl &D, if (D.hasAttr() || D.hasAttr()) llvm_unreachable("CUDA is NYI"); else if (Ty.getAddressSpace() != LangAS::opencl_local) - Init = builder.getZeroInitAttr(getTypes().ConvertType(Ty)); + Init = builder.getZeroInitAttr(convertType(Ty)); cir::GlobalOp GV = builder.createVersionedGlobal( getModule(), getLoc(D.getLocation()), Name, LTy, false, Linkage, AS); @@ -620,7 +620,7 @@ void CIRGenFunction::emitStaticVarDecl(const VarDecl &D, // Store into LocalDeclMap before generating initializer to handle // circular references. - mlir::Type elemTy = getTypes().convertTypeForMem(D.getType()); + mlir::Type elemTy = convertTypeForMem(D.getType()); setAddrOfLocalVar(&D, Address(addr, elemTy, alignment)); // We can't have a VLA here, but we can have a pointer to a VLA, diff --git a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp index 72a1855eaa9d..cc728325d54b 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp @@ -173,8 +173,7 @@ static Address emitPointerWithAlignment(const Expr *expr, llvm_unreachable("NYI"); } - auto ElemTy = - cgf.getTypes().convertTypeForMem(expr->getType()->getPointeeType()); + auto ElemTy = cgf.convertTypeForMem(expr->getType()->getPointeeType()); addr = cgf.getBuilder().createElementBitCast( cgf.getLoc(expr->getSourceRange()), addr, ElemTy); if (CE->getCastKind() == CK_AddressSpaceConversion) { @@ -443,7 +442,7 @@ LValue CIRGenFunction::emitLValueForFieldInitialization( FieldIndex); // Make sure that the address is pointing to the right type. - auto memTy = getTypes().convertTypeForMem(FieldType); + auto memTy = convertTypeForMem(FieldType); V = builder.createElementBitCast(getLoc(Field->getSourceRange()), V, memTy); // TODO: Generate TBAA information that describes this access as a structure @@ -887,7 +886,7 @@ void CIRGenFunction::emitStoreThroughBitfieldLValue(RValue Src, LValue Dst, llvm_unreachable("volatile bit-field is not implemented for the AACPS"); const CIRGenBitFieldInfo &info = Dst.getBitFieldInfo(); - mlir::Type resLTy = getTypes().convertTypeForMem(Dst.getType()); + mlir::Type resLTy = convertTypeForMem(Dst.getType()); Address ptr = Dst.getBitFieldAddress(); const bool useVolatile = @@ -919,7 +918,7 @@ static LValue emitGlobalVarDeclLValue(CIRGenFunction &CGF, const Expr *E, // as part of getAddrOfGlobalVar. auto V = CGF.CGM.getAddrOfGlobalVar(VD); - auto RealVarTy = CGF.getTypes().convertTypeForMem(VD->getType()); + auto RealVarTy = CGF.convertTypeForMem(VD->getType()); cir::PointerType realPtrTy = CGF.getBuilder().getPointerTo( RealVarTy, cast_if_present( cast(V.getType()).getAddrSpace())); @@ -986,9 +985,8 @@ static LValue emitFunctionDeclLValue(CIRGenFunction &CGF, const Expr *E, mlir::Value addr = CGF.getBuilder().create( loc, ptrTy, funcOp.getSymName()); - if (funcOp.getFunctionType() != - CGF.CGM.getTypes().ConvertType(FD->getType())) { - fnTy = CGF.CGM.getTypes().ConvertType(FD->getType()); + if (funcOp.getFunctionType() != CGF.convertType(FD->getType())) { + fnTy = CGF.convertType(FD->getType()); ptrTy = cir::PointerType::get(CGF.getBuilder().getContext(), fnTy); addr = CGF.getBuilder().create(addr.getLoc(), ptrTy, @@ -1616,7 +1614,7 @@ Address CIRGenFunction::emitArrayToPointerDecay(const Expr *E, mlir::Value ptr = CGM.getBuilder().maybeBuildArrayDecay( CGM.getLoc(E->getSourceRange()), Addr.getPointer(), - getTypes().convertTypeForMem(EltType)); + convertTypeForMem(EltType)); return Address(ptr, Addr.getAlignment()); } @@ -1757,7 +1755,7 @@ static Address emitArraySubscriptPtr( assert(0 && "NYI"); } - return Address(eltPtr, CGF.getTypes().convertTypeForMem(eltType), eltAlign); + return Address(eltPtr, CGF.convertTypeForMem(eltType), eltAlign); } LValue CIRGenFunction::emitArraySubscriptExpr(const ArraySubscriptExpr *E, @@ -1992,7 +1990,7 @@ LValue CIRGenFunction::emitCastLValue(const CastExpr *E) { if (LV.isSimple()) { Address V = LV.getAddress(); if (V.isValid()) { - auto T = getTypes().convertTypeForMem(E->getType()); + auto T = convertTypeForMem(E->getType()); if (V.getElementType() != T) LV.setAddress( builder.createElementBitCast(getLoc(E->getSourceRange()), V, T)); @@ -2036,8 +2034,8 @@ LValue CIRGenFunction::emitCastLValue(const CastExpr *E) { builder.getAddrSpaceAttr(E->getSubExpr()->getType().getAddressSpace()); auto DestAS = builder.getAddrSpaceAttr(E->getType().getAddressSpace()); mlir::Value V = getTargetHooks().performAddrSpaceCast( - *this, LV.getPointer(), SrcAS, DestAS, ConvertType(DestTy)); - return makeAddrLValue(Address(V, getTypes().convertTypeForMem(E->getType()), + *this, LV.getPointer(), SrcAS, DestAS, convertType(DestTy)); + return makeAddrLValue(Address(V, convertTypeForMem(E->getType()), LV.getAddress().getAlignment()), E->getType(), LV.getBaseInfo(), LV.getTBAAInfo()); } @@ -2872,7 +2870,7 @@ mlir::Value CIRGenFunction::emitAlloca(StringRef name, QualType ty, mlir::Location loc, CharUnits alignment, bool insertIntoFnEntryBlock, mlir::Value arraySize) { - return emitAlloca(name, getCIRType(ty), loc, alignment, + return emitAlloca(name, convertType(ty), loc, alignment, insertIntoFnEntryBlock, arraySize); } @@ -3011,7 +3009,7 @@ Address CIRGenFunction::emitLoadOfReference(LValue refLVal, mlir::Location loc, CharUnits align = CGM.getNaturalTypeAlignment(pointeeType, pointeeBaseInfo, pointeeTBAAInfo, /* forPointeeType= */ true); - return Address(load, getTypes().convertTypeForMem(pointeeType), align); + return Address(load, convertTypeForMem(pointeeType), align); } LValue CIRGenFunction::emitLoadOfReferenceLValue(LValue RefLVal, @@ -3046,9 +3044,8 @@ Address CIRGenFunction::CreateMemTemp(QualType Ty, CharUnits Align, mlir::Location Loc, const Twine &Name, Address *Alloca, mlir::OpBuilder::InsertPoint ip) { - Address Result = - CreateTempAlloca(getTypes().convertTypeForMem(Ty), Align, Loc, Name, - /*ArraySize=*/nullptr, Alloca, ip); + Address Result = CreateTempAlloca(convertTypeForMem(Ty), Align, Loc, Name, + /*ArraySize=*/nullptr, Alloca, ip); if (Ty->isConstantMatrixType()) { assert(0 && "NYI"); } diff --git a/clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp b/clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp index 44e214fb1f55..526559a0060c 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp @@ -528,7 +528,7 @@ void AggExprEmitter::emitArrayInit(Address DestPtr, cir::ArrayType AType, /*condBuilder=*/ [&](mlir::OpBuilder &b, mlir::Location loc) { auto currentElement = builder.createLoad(loc, tmpAddr); - mlir::Type boolTy = CGF.getCIRType(CGF.getContext().BoolTy); + mlir::Type boolTy = CGF.convertType(CGF.getContext().BoolTy); auto cmp = builder.create(loc, boolTy, cir::CmpOpKind::ne, currentElement, end); builder.createCondition(cmp); @@ -999,7 +999,7 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) { // GCC union extension QualType Ty = E->getSubExpr()->getType(); - Address CastPtr = Dest.getAddress().withElementType(CGF.ConvertType(Ty)); + Address CastPtr = Dest.getAddress().withElementType(CGF.convertType(Ty)); emitInitializationToLValue(E->getSubExpr(), CGF.makeAddrLValue(CastPtr, Ty)); break; diff --git a/clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp b/clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp index 068f060ca7c5..83af7ee98f58 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp @@ -1089,7 +1089,7 @@ mlir::Value CIRGenFunction::emitCXXNewExpr(const CXXNewExpr *E) { mlir::Type elementTy; Address result = Address::invalid(); auto createCast = [&]() { - elementTy = getTypes().convertTypeForMem(allocType); + elementTy = convertTypeForMem(allocType); result = builder.createElementBitCast(getLoc(E->getSourceRange()), allocation, elementTy); }; @@ -1240,7 +1240,7 @@ void CIRGenFunction::emitDeleteCall(const FunctionDecl *DeleteFD, // Pass the pointer itself. QualType ArgTy = *ParamTypeIt++; mlir::Value DeletePtr = - builder.createBitcast(Ptr.getLoc(), Ptr, ConvertType(ArgTy)); + builder.createBitcast(Ptr.getLoc(), Ptr, convertType(ArgTy)); DeleteArgs.add(RValue::get(DeletePtr), ArgTy); // Pass the std::destroying_delete tag if present. @@ -1254,7 +1254,7 @@ void CIRGenFunction::emitDeleteCall(const FunctionDecl *DeleteFD, QualType SizeType = *ParamTypeIt++; CharUnits DeleteTypeSize = getContext().getTypeSizeInChars(DeleteTy); assert(SizeTy && "expected cir::IntType"); - auto Size = builder.getConstInt(*currSrcLoc, ConvertType(SizeType), + auto Size = builder.getConstInt(*currSrcLoc, convertType(SizeType), DeleteTypeSize.getQuantity()); // For array new, multiply by the number of elements. @@ -1297,7 +1297,7 @@ void CIRGenFunction::emitDeleteCall(const FunctionDecl *DeleteFD, static mlir::Value emitDynamicCastToNull(CIRGenFunction &CGF, mlir::Location Loc, QualType DestTy) { - mlir::Type DestCIRTy = CGF.ConvertType(DestTy); + mlir::Type DestCIRTy = CGF.convertType(DestTy); assert(mlir::isa(DestCIRTy) && "result of dynamic_cast should be a ptr"); @@ -1351,7 +1351,7 @@ mlir::Value CIRGenFunction::emitDynamicCast(Address ThisAddr, if (DCE->isAlwaysNull()) return emitDynamicCastToNull(*this, loc, destTy); - auto destCirTy = mlir::cast(ConvertType(destTy)); + auto destCirTy = mlir::cast(convertType(destTy)); return CGM.getCXXABI().emitDynamicCast(*this, loc, srcRecordTy, destRecordTy, destCirTy, isRefCast, ThisAddr); } diff --git a/clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp b/clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp index 429d2f81af4e..754fa895afce 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp @@ -389,7 +389,7 @@ mlir::Value ComplexExprEmitter::emitComplexToComplexCast(mlir::Value Val, llvm_unreachable("unexpected src type or dest type"); return Builder.createCast(CGF.getLoc(Loc), CastOpKind, Val, - CGF.ConvertType(DestType)); + CGF.convertType(DestType)); } mlir::Value ComplexExprEmitter::emitScalarToComplexCast(mlir::Value Val, @@ -405,7 +405,7 @@ mlir::Value ComplexExprEmitter::emitScalarToComplexCast(mlir::Value Val, llvm_unreachable("unexpected src type"); return Builder.createCast(CGF.getLoc(Loc), CastOpKind, Val, - CGF.ConvertType(DestType)); + CGF.convertType(DestType)); } mlir::Value ComplexExprEmitter::emitCast(CastKind CK, Expr *Op, @@ -830,7 +830,7 @@ LValue ComplexExprEmitter::emitBinAssignLValue(const BinaryOperator *E, mlir::Value ComplexExprEmitter::VisitImaginaryLiteral(const ImaginaryLiteral *IL) { auto Loc = CGF.getLoc(IL->getExprLoc()); - auto Ty = mlir::cast(CGF.getCIRType(IL->getType())); + auto Ty = mlir::cast(CGF.convertType(IL->getType())); auto ElementTy = Ty.getElementTy(); mlir::TypedAttr RealValueAttr; @@ -865,7 +865,7 @@ mlir::Value ComplexExprEmitter::VisitInitListExpr(InitListExpr *E) { // Empty init list initializes to null assert(E->getNumInits() == 0 && "Unexpected number of inits"); QualType Ty = E->getType()->castAs()->getElementType(); - return Builder.getZero(CGF.getLoc(E->getExprLoc()), CGF.ConvertType(Ty)); + return Builder.getZero(CGF.getLoc(E->getExprLoc()), CGF.convertType(Ty)); } mlir::Value CIRGenFunction::emitPromotedComplexExpr(const Expr *E, @@ -879,7 +879,7 @@ mlir::Value CIRGenFunction::emitPromotedValue(mlir::Value result, mlir::cast(result.getType()).getElementTy()) && "integral complex will never be promoted"); return builder.createCast(cir::CastKind::float_complex, result, - ConvertType(PromotionType)); + convertType(PromotionType)); } mlir::Value CIRGenFunction::emitUnPromotedValue(mlir::Value result, @@ -888,7 +888,7 @@ mlir::Value CIRGenFunction::emitUnPromotedValue(mlir::Value result, mlir::cast(result.getType()).getElementTy()) && "integral complex will never be promoted"); return builder.createCast(cir::CastKind::float_complex, result, - ConvertType(UnPromotionType)); + convertType(UnPromotionType)); } mlir::Value CIRGenFunction::emitComplexExpr(const Expr *E) { diff --git a/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp b/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp index 3eb8627084f4..d6d04cd91ae7 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp @@ -787,7 +787,7 @@ bool ConstStructBuilder::Build(const APValue &Val, const RecordDecl *RD, mlir::Attribute ConstStructBuilder::Finalize(QualType Type) { Type = Type.getNonReferenceType(); RecordDecl *RD = Type->castAs()->getDecl(); - mlir::Type ValTy = CGM.getTypes().ConvertType(Type); + mlir::Type ValTy = CGM.convertType(Type); return Builder.build(ValTy, RD->hasFlexibleArrayMember()); } @@ -1015,7 +1015,7 @@ class ConstExprEmitter return {}; } - auto desiredType = CGM.getTypes().ConvertType(T); + auto desiredType = CGM.convertType(T); // FIXME(cir): A hack to handle the emission of arrays of unions directly. // See clang/test/CIR/CodeGen/union-array.c and // clang/test/CIR/Lowering/nested-union-array.c for example. The root @@ -1086,8 +1086,7 @@ class ConstExprEmitter } mlir::Attribute EmitVectorInitialization(InitListExpr *ILE, QualType T) { - cir::VectorType VecTy = - mlir::cast(CGM.getTypes().ConvertType(T)); + cir::VectorType VecTy = mlir::cast(CGM.convertType(T)); unsigned NumElements = VecTy.getSize(); unsigned NumInits = ILE->getNumInits(); assert(NumElements >= NumInits && "Too many initializers for a vector"); @@ -1110,7 +1109,7 @@ class ConstExprEmitter mlir::Attribute VisitImplicitValueInitExpr(ImplicitValueInitExpr *E, QualType T) { - return CGM.getBuilder().getZeroInitAttr(CGM.getCIRType(T)); + return CGM.getBuilder().getZeroInitAttr(CGM.convertType(T)); } mlir::Attribute VisitInitListExpr(InitListExpr *ILE, QualType T) { @@ -1161,7 +1160,7 @@ class ConstExprEmitter return nullptr; } - return CGM.getBuilder().getZeroInitAttr(CGM.getCIRType(Ty)); + return CGM.getBuilder().getZeroInitAttr(CGM.convertType(Ty)); } mlir::Attribute VisitStringLiteral(StringLiteral *E, QualType T) { @@ -1179,7 +1178,7 @@ class ConstExprEmitter } // Utility methods - mlir::Type ConvertType(QualType T) { return CGM.getTypes().ConvertType(T); } + mlir::Type convertType(QualType T) { return CGM.convertType(T); } }; static mlir::Attribute @@ -1641,7 +1640,7 @@ mlir::Attribute ConstantEmitter::tryEmitPrivateForVarInit(const VarDecl &D) { // be a problem for the near future. if (CD->isTrivial() && CD->isDefaultConstructor()) return cir::ZeroAttr::get(CGM.getBuilder().getContext(), - CGM.getTypes().ConvertType(D.getType())); + CGM.convertType(D.getType())); } } InConstantContext = D.hasConstantInitialization(); @@ -1800,7 +1799,7 @@ mlir::Attribute ConstantEmitter::tryEmitPrivate(const APValue &Value, // 'undef'. Find out what's better for CIR. assert(0 && "not implemented"); case APValue::Int: { - mlir::Type ty = CGM.getCIRType(DestType); + mlir::Type ty = CGM.convertType(DestType); if (mlir::isa(ty)) return builder.getCIRBoolAttr(Value.getInt().getZExtValue()); assert(mlir::isa(ty) && "expected integral type"); @@ -1813,7 +1812,7 @@ mlir::Attribute ConstantEmitter::tryEmitPrivate(const APValue &Value, CGM.getASTContext().getTargetInfo().useFP16ConversionIntrinsics()) assert(0 && "not implemented"); else { - mlir::Type ty = CGM.getCIRType(DestType); + mlir::Type ty = CGM.convertType(DestType); assert(mlir::isa(ty) && "expected floating-point type"); return CGM.getBuilder().getAttr(ty, Init); @@ -1861,7 +1860,7 @@ mlir::Attribute ConstantEmitter::tryEmitPrivate(const APValue &Value, Elts.push_back(typedC); } - auto Desired = CGM.getTypes().ConvertType(DestType); + auto Desired = CGM.convertType(DestType); auto typedFiller = llvm::dyn_cast_or_null(Filler); if (Filler && !typedFiller) @@ -1882,8 +1881,7 @@ mlir::Attribute ConstantEmitter::tryEmitPrivate(const APValue &Value, return {}; Elts.push_back(C); } - auto Desired = - mlir::cast(CGM.getTypes().ConvertType(DestType)); + auto Desired = mlir::cast(CGM.convertType(DestType)); return cir::ConstVectorAttr::get( Desired, mlir::ArrayAttr::get(CGM.getBuilder().getContext(), Elts)); } @@ -1896,8 +1894,7 @@ mlir::Attribute ConstantEmitter::tryEmitPrivate(const APValue &Value, if (const auto *memberFuncDecl = dyn_cast(memberDecl)) assert(0 && "not implemented"); - auto cirTy = - mlir::cast(CGM.getTypes().ConvertType(DestType)); + auto cirTy = mlir::cast(CGM.convertType(DestType)); const auto *fieldDecl = cast(memberDecl); return builder.getDataMemberAttr(cirTy, fieldDecl->getFieldIndex()); @@ -1948,7 +1945,7 @@ mlir::Value CIRGenModule::emitMemberPointerConstant(const UnaryOperator *E) { // A member function pointer. if (const auto *methodDecl = dyn_cast(decl)) { - auto ty = mlir::cast(getCIRType(E->getType())); + auto ty = mlir::cast(convertType(E->getType())); if (methodDecl->isVirtual()) return builder.create( loc, ty, getCXXABI().buildVirtualMethodAttr(ty, methodDecl)); @@ -1958,7 +1955,7 @@ mlir::Value CIRGenModule::emitMemberPointerConstant(const UnaryOperator *E) { loc, ty, builder.getMethodAttr(ty, methodFuncOp)); } - auto ty = mlir::cast(getCIRType(E->getType())); + auto ty = mlir::cast(convertType(E->getType())); // Otherwise, a member data pointer. const auto *fieldDecl = cast(decl); diff --git a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp index 2f0d83869731..c0b6ac3c78e7 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp @@ -107,7 +107,7 @@ class ScalarExprEmitter : public StmtVisitor { return I; } - mlir::Type ConvertType(QualType T) { return CGF.ConvertType(T); } + mlir::Type convertType(QualType T) { return CGF.convertType(T); } LValue emitLValue(const Expr *E) { return CGF.emitLValue(E); } LValue emitCheckedLValue(const Expr *E, CIRGenFunction::TypeCheckKind TCK) { return CGF.emitCheckedLValue(E, TCK); @@ -120,11 +120,11 @@ class ScalarExprEmitter : public StmtVisitor { mlir::Value emitNullValue(QualType Ty, mlir::Location loc); mlir::Value emitPromotedValue(mlir::Value result, QualType PromotionType) { - return Builder.createFloatingCast(result, ConvertType(PromotionType)); + return Builder.createFloatingCast(result, convertType(PromotionType)); } mlir::Value emitUnPromotedValue(mlir::Value result, QualType ExprType) { - return Builder.createFloatingCast(result, ConvertType(ExprType)); + return Builder.createFloatingCast(result, convertType(ExprType)); } mlir::Value emitPromoted(const Expr *E, QualType PromotionType); @@ -172,7 +172,7 @@ class ScalarExprEmitter : public StmtVisitor { // Leaves. mlir::Value VisitIntegerLiteral(const IntegerLiteral *E) { - mlir::Type Ty = CGF.getCIRType(E->getType()); + mlir::Type Ty = CGF.convertType(E->getType()); return Builder.create( CGF.getLoc(E->getExprLoc()), Ty, Builder.getAttr(Ty, E->getValue())); @@ -182,7 +182,7 @@ class ScalarExprEmitter : public StmtVisitor { llvm_unreachable("NYI"); } mlir::Value VisitFloatingLiteral(const FloatingLiteral *E) { - mlir::Type Ty = CGF.getCIRType(E->getType()); + mlir::Type Ty = CGF.convertType(E->getType()); assert(mlir::isa(Ty) && "expect floating-point type"); return Builder.create( @@ -190,7 +190,7 @@ class ScalarExprEmitter : public StmtVisitor { Builder.getAttr(Ty, E->getValue())); } mlir::Value VisitCharacterLiteral(const CharacterLiteral *E) { - mlir::Type Ty = CGF.getCIRType(E->getType()); + mlir::Type Ty = CGF.convertType(E->getType()); auto loc = CGF.getLoc(E->getExprLoc()); auto init = cir::IntAttr::get(Ty, E->getValue()); return Builder.create(loc, Ty, init); @@ -199,7 +199,7 @@ class ScalarExprEmitter : public StmtVisitor { llvm_unreachable("NYI"); } mlir::Value VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *E) { - mlir::Type Ty = CGF.getCIRType(E->getType()); + mlir::Type Ty = CGF.convertType(E->getType()); return Builder.create( CGF.getLoc(E->getExprLoc()), Ty, Builder.getCIRBoolAttr(E->getValue())); } @@ -323,7 +323,7 @@ class ScalarExprEmitter : public StmtVisitor { .getSExtValue())); } return CGF.builder.create( - CGF.getLoc(E->getSourceRange()), CGF.getCIRType(E->getType()), Vec1, + CGF.getLoc(E->getSourceRange()), CGF.convertType(E->getType()), Vec1, Vec2, CGF.builder.getArrayAttr(Indices)); } } @@ -420,7 +420,7 @@ class ScalarExprEmitter : public StmtVisitor { // Decrement does not have this property. if (isInc && type->isBooleanType()) { value = Builder.create(CGF.getLoc(E->getExprLoc()), - CGF.getCIRType(type), + CGF.convertType(type), Builder.getCIRBoolAttr(true)); } else if (type->isIntegerType()) { QualType promotedType; @@ -438,8 +438,8 @@ class ScalarExprEmitter : public StmtVisitor { // TODO(cir): Currently, we store bitwidths in CIR types only for // integers. This might also be required for other types. - auto srcCirTy = mlir::dyn_cast(ConvertType(type)); - auto promotedCirTy = mlir::dyn_cast(ConvertType(type)); + auto srcCirTy = mlir::dyn_cast(convertType(type)); + auto promotedCirTy = mlir::dyn_cast(convertType(type)); assert(srcCirTy && promotedCirTy && "Expected integer type"); assert( @@ -948,7 +948,7 @@ class ScalarExprEmitter : public StmtVisitor { // a vector. cir::CmpOpKind Kind = ClangCmpToCIRCmp(E->getOpcode()); Result = Builder.create( - CGF.getLoc(BOInfo.Loc), CGF.getCIRType(BOInfo.FullType), Kind, + CGF.getLoc(BOInfo.Loc), CGF.convertType(BOInfo.FullType), Kind, BOInfo.LHS, BOInfo.RHS); } } else if (BOInfo.isFixedPointOp()) { @@ -987,7 +987,7 @@ class ScalarExprEmitter : public StmtVisitor { // as a logical value again. // TODO: optimize this common case here or leave it for later // CIR passes? - mlir::Type boolTy = CGF.getCIRType(CGF.getContext().BoolTy); + mlir::Type boolTy = CGF.convertType(CGF.getContext().BoolTy); return Builder.create(loc, boolTy, cir::CastKind::int_to_bool, srcVal); } @@ -1047,7 +1047,7 @@ class ScalarExprEmitter : public StmtVisitor { if (DstType->isBooleanType()) return emitConversionToBool(Src, SrcType, CGF.getLoc(Loc)); - mlir::Type DstTy = ConvertType(DstType); + mlir::Type DstTy = convertType(DstType); // Cast from half through float if half isn't a native type. if (SrcType->isHalfType() && @@ -1378,17 +1378,17 @@ mlir::Value ScalarExprEmitter::emitMul(const BinOpInfo &Ops) { llvm_unreachable("NYI"); return Builder.create(CGF.getLoc(Ops.Loc), - CGF.getCIRType(Ops.FullType), + CGF.convertType(Ops.FullType), cir::BinOpKind::Mul, Ops.LHS, Ops.RHS); } mlir::Value ScalarExprEmitter::emitDiv(const BinOpInfo &Ops) { return Builder.create(CGF.getLoc(Ops.Loc), - CGF.getCIRType(Ops.FullType), + CGF.convertType(Ops.FullType), cir::BinOpKind::Div, Ops.LHS, Ops.RHS); } mlir::Value ScalarExprEmitter::emitRem(const BinOpInfo &Ops) { return Builder.create(CGF.getLoc(Ops.Loc), - CGF.getCIRType(Ops.FullType), + CGF.convertType(Ops.FullType), cir::BinOpKind::Rem, Ops.LHS, Ops.RHS); } @@ -1431,7 +1431,7 @@ mlir::Value ScalarExprEmitter::emitAdd(const BinOpInfo &Ops) { llvm_unreachable("NYI"); return Builder.create(CGF.getLoc(Ops.Loc), - CGF.getCIRType(Ops.FullType), + CGF.convertType(Ops.FullType), cir::BinOpKind::Add, Ops.LHS, Ops.RHS); } @@ -1474,7 +1474,7 @@ mlir::Value ScalarExprEmitter::emitSub(const BinOpInfo &Ops) { llvm_unreachable("NYI"); return Builder.create(CGF.getLoc(Ops.Loc), - CGF.getCIRType(Ops.FullType), + CGF.convertType(Ops.FullType), cir::BinOpKind::Sub, Ops.LHS, Ops.RHS); } @@ -1524,7 +1524,7 @@ mlir::Value ScalarExprEmitter::emitShl(const BinOpInfo &Ops) { } return Builder.create(CGF.getLoc(Ops.Loc), - CGF.getCIRType(Ops.FullType), Ops.LHS, + CGF.convertType(Ops.FullType), Ops.LHS, Ops.RHS, CGF.getBuilder().getUnitAttr()); } @@ -1548,22 +1548,22 @@ mlir::Value ScalarExprEmitter::emitShr(const BinOpInfo &Ops) { // Note that we don't need to distinguish unsigned treatment at this // point since it will be handled later by LLVM lowering. return Builder.create( - CGF.getLoc(Ops.Loc), CGF.getCIRType(Ops.FullType), Ops.LHS, Ops.RHS); + CGF.getLoc(Ops.Loc), CGF.convertType(Ops.FullType), Ops.LHS, Ops.RHS); } mlir::Value ScalarExprEmitter::emitAnd(const BinOpInfo &Ops) { return Builder.create(CGF.getLoc(Ops.Loc), - CGF.getCIRType(Ops.FullType), + CGF.convertType(Ops.FullType), cir::BinOpKind::And, Ops.LHS, Ops.RHS); } mlir::Value ScalarExprEmitter::emitXor(const BinOpInfo &Ops) { return Builder.create(CGF.getLoc(Ops.Loc), - CGF.getCIRType(Ops.FullType), + CGF.convertType(Ops.FullType), cir::BinOpKind::Xor, Ops.LHS, Ops.RHS); } mlir::Value ScalarExprEmitter::emitOr(const BinOpInfo &Ops) { return Builder.create(CGF.getLoc(Ops.Loc), - CGF.getCIRType(Ops.FullType), + CGF.convertType(Ops.FullType), cir::BinOpKind::Or, Ops.LHS, Ops.RHS); } @@ -1666,7 +1666,7 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { auto DestAS = CGF.builder.getAddrSpaceAttr( DestTy->getPointeeType().getAddressSpace()); return CGF.CGM.getTargetCIRGenInfo().performAddrSpaceCast( - CGF, Visit(E), SrcAS, DestAS, ConvertType(DestTy)); + CGF, Visit(E), SrcAS, DestAS, convertType(DestTy)); } case CK_AtomicToNonAtomic: llvm_unreachable("NYI"); @@ -1722,7 +1722,7 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { // FIXME: use MustVisitNullValue(E) and evaluate expr. // Note that DestTy is used as the MLIR type instead of a custom // nullptr type. - mlir::Type Ty = CGF.getCIRType(DestTy); + mlir::Type Ty = CGF.convertType(DestTy); return Builder.getNullPtr(Ty, CGF.getLoc(E->getExprLoc())); } @@ -1734,11 +1734,11 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { const MemberPointerType *MPT = CE->getType()->getAs(); if (MPT->isMemberFunctionPointerType()) { - auto Ty = mlir::cast(CGF.getCIRType(DestTy)); + auto Ty = mlir::cast(CGF.convertType(DestTy)); return Builder.getNullMethodPtr(Ty, CGF.getLoc(E->getExprLoc())); } - auto Ty = mlir::cast(CGF.getCIRType(DestTy)); + auto Ty = mlir::cast(CGF.convertType(DestTy)); return Builder.getNullDataMemberPtr(Ty, CGF.getLoc(E->getExprLoc())); } case CK_ReinterpretMemberPointer: @@ -1759,7 +1759,7 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { llvm_unreachable("NYI"); mlir::Location loc = CGF.getLoc(E->getExprLoc()); - mlir::Type resultTy = CGF.getCIRType(DestTy); + mlir::Type resultTy = CGF.convertType(DestTy); mlir::IntegerAttr offsetAttr = Builder.getIndexAttr(offset.getQuantity()); if (Kind == CK_BaseToDerivedMemberPointer) @@ -1798,7 +1798,7 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { return Visit(const_cast(E)); case CK_IntegralToPointer: { - auto DestCIRTy = ConvertType(DestTy); + auto DestCIRTy = convertType(DestTy); mlir::Value Src = Visit(const_cast(E)); // Properly resize by casting to an int of the same size as the pointer. @@ -1820,7 +1820,7 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { assert(!DestTy->isBooleanType() && "bool should use PointerToBool"); if (CGF.CGM.getCodeGenOpts().StrictVTablePointers) llvm_unreachable("NYI"); - return Builder.createPtrToInt(Visit(E), ConvertType(DestTy)); + return Builder.createPtrToInt(Visit(E), convertType(DestTy)); } case CK_ToVoid: { CGF.emitIgnoredExpr(E); @@ -1832,7 +1832,7 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { // Create a vector object and fill all elements with the same scalar value. assert(DestTy->isVectorType() && "CK_VectorSplat to non-vector type"); return CGF.getBuilder().create( - CGF.getLoc(E->getSourceRange()), CGF.getCIRType(DestTy), Visit(E)); + CGF.getLoc(E->getSourceRange()), CGF.convertType(DestTy), Visit(E)); } case CK_FixedPointCast: llvm_unreachable("NYI"); @@ -1945,14 +1945,14 @@ mlir::Value CIRGenFunction::emitComplexToScalarConversion(mlir::Value Src, auto Kind = ComplexElemTy->isFloatingType() ? cir::CastKind::float_complex_to_bool : cir::CastKind::int_complex_to_bool; - return builder.createCast(getLoc(Loc), Kind, Src, ConvertType(DstTy)); + return builder.createCast(getLoc(Loc), Kind, Src, convertType(DstTy)); } auto Kind = ComplexElemTy->isFloatingType() ? cir::CastKind::float_complex_to_real : cir::CastKind::int_complex_to_real; auto Real = - builder.createCast(getLoc(Loc), Kind, Src, ConvertType(ComplexElemTy)); + builder.createCast(getLoc(Loc), Kind, Src, convertType(ComplexElemTy)); return emitScalarConversion(Real, ComplexElemTy, DstTy, Loc); } @@ -1984,7 +1984,7 @@ mlir::Value ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) { "NYI: scalable vector init"); assert(!cir::MissingFeatures::vectorConstants() && "NYI: vector constants"); auto VectorType = - mlir::dyn_cast(CGF.getCIRType(E->getType())); + mlir::dyn_cast(CGF.convertType(E->getType())); SmallVector Elements; for (Expr *init : E->inits()) { Elements.push_back(Visit(init)); @@ -2025,7 +2025,7 @@ mlir::Value ScalarExprEmitter::VisitUnaryLNot(const UnaryOperator *E) { boolVal = Builder.createNot(boolVal); // ZExt result to the expr type. - auto dstTy = ConvertType(E->getType()); + auto dstTy = convertType(E->getType()); if (mlir::isa(dstTy)) return Builder.createBoolToInt(boolVal, dstTy); if (mlir::isa(dstTy)) @@ -2287,7 +2287,7 @@ mlir::Value ScalarExprEmitter::emitComplexToScalarConversion(mlir::Location Loc, llvm_unreachable("invalid complex-to-scalar cast kind"); } - return Builder.createCast(Loc, CastOpKind, V, CGF.ConvertType(DestTy)); + return Builder.createCast(Loc, CastOpKind, V, CGF.convertType(DestTy)); } mlir::Value ScalarExprEmitter::emitNullValue(QualType Ty, mlir::Location loc) { @@ -2620,7 +2620,7 @@ mlir::Value ScalarExprEmitter::VisitBinLAnd(const clang::BinaryOperator *E) { } bool InstrumentRegions = CGF.CGM.getCodeGenOpts().hasProfileClangInstr(); - mlir::Type ResTy = ConvertType(E->getType()); + mlir::Type ResTy = convertType(E->getType()); mlir::Location Loc = CGF.getLoc(E->getExprLoc()); // If we have 0 && RHS, see if we can elide RHS, if so, just return 0. @@ -2692,7 +2692,7 @@ mlir::Value ScalarExprEmitter::VisitBinLOr(const clang::BinaryOperator *E) { } bool InstrumentRegions = CGF.CGM.getCodeGenOpts().hasProfileClangInstr(); - mlir::Type ResTy = ConvertType(E->getType()); + mlir::Type ResTy = convertType(E->getType()); mlir::Location Loc = CGF.getLoc(E->getExprLoc()); // If we have 1 || RHS, see if we can elide RHS, if so, just return 1. diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.cpp b/clang/lib/CIR/CodeGen/CIRGenFunction.cpp index cba4d0f1a75d..4d33c40e38e6 100644 --- a/clang/lib/CIR/CodeGen/CIRGenFunction.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenFunction.cpp @@ -68,10 +68,6 @@ clang::ASTContext &CIRGenFunction::getContext() const { return CGM.getASTContext(); } -mlir::Type CIRGenFunction::ConvertType(QualType T) { - return CGM.getTypes().ConvertType(T); -} - cir::TypeEvaluationKind CIRGenFunction::getEvaluationKind(QualType type) { type = type.getCanonicalType(); while (true) { @@ -137,7 +133,7 @@ mlir::Type CIRGenFunction::convertTypeForMem(QualType T) { } mlir::Type CIRGenFunction::convertType(QualType T) { - return CGM.getTypes().ConvertType(T); + return CGM.getTypes().convertType(T); } mlir::Location CIRGenFunction::getLoc(SourceLocation SLoc) { @@ -250,10 +246,6 @@ bool CIRGenFunction::ConstantFoldsToSimpleInteger(const Expr *Cond, return true; } -mlir::Type CIRGenFunction::getCIRType(const QualType &type) { - return CGM.getCIRType(type); -} - /// Determine whether the function F ends with a return stmt. static bool endsWithReturn(const Decl *F) { const Stmt *Body = nullptr; @@ -606,7 +598,7 @@ cir::FuncOp CIRGenFunction::generateCode(clang::GlobalDecl GD, cir::FuncOp Fn, FnRetQualTy = FD->getReturnType(); if (!FnRetQualTy->isVoidType()) - FnRetCIRTy = getCIRType(FnRetQualTy); + FnRetCIRTy = convertType(FnRetQualTy); FunctionArgList Args; QualType ResTy = buildFunctionArgList(GD, Args); @@ -831,7 +823,7 @@ LValue CIRGenFunction::MakeNaturalAlignAddrLValue(mlir::Value val, LValueBaseInfo baseInfo; TBAAAccessInfo tbaaInfo; CharUnits alignment = CGM.getNaturalTypeAlignment(ty, &baseInfo, &tbaaInfo); - Address addr(val, getTypes().convertTypeForMem(ty), alignment); + Address addr(val, convertTypeForMem(ty), alignment); return LValue::makeAddr(addr, ty, getContext(), baseInfo, tbaaInfo); } @@ -889,7 +881,7 @@ static bool matchesStlAllocatorFn(const Decl *D, const ASTContext &astContext) { /// declared type. static mlir::Value emitArgumentDemotion(CIRGenFunction &CGF, const VarDecl *var, mlir::Value value) { - mlir::Type ty = CGF.ConvertType(var->getType()); + mlir::Type ty = CGF.convertType(var->getType()); // This can happen with promotions that actually don't change the // underlying type, like the enum promotions. @@ -1494,8 +1486,7 @@ void CIRGenFunction::emitNullInitialization(mlir::Location loc, Address DestPtr, // Builder.CreateMemSet. In CIR just emit a store of #cir.zero to the // respective address. // Builder.CreateMemSet(DestPtr, Builder.getInt8(0), SizeVal, false); - builder.createStore(loc, builder.getZero(loc, getTypes().ConvertType(Ty)), - DestPtr); + builder.createStore(loc, builder.getZero(loc, convertType(Ty)), DestPtr); } CIRGenFunction::CIRGenFPOptionsRAII::CIRGenFPOptionsRAII(CIRGenFunction &CGF, diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.h b/clang/lib/CIR/CodeGen/CIRGenFunction.h index 764c20aaa152..38ea6a407884 100644 --- a/clang/lib/CIR/CodeGen/CIRGenFunction.h +++ b/clang/lib/CIR/CodeGen/CIRGenFunction.h @@ -569,9 +569,9 @@ class CIRGenFunction : public CIRGenTypeCache { mlir::Type convertTypeForMem(QualType T); - mlir::Type ConvertType(clang::QualType T); - mlir::Type ConvertType(const TypeDecl *T) { - return ConvertType(getContext().getTypeDeclType(T)); + mlir::Type convertType(clang::QualType T); + mlir::Type convertType(const TypeDecl *T) { + return convertType(getContext().getTypeDeclType(T)); } /// Return the cir::TypeEvaluationKind of QualType \c T. @@ -1113,8 +1113,6 @@ class CIRGenFunction : public CIRGenTypeCache { mlir::Value emitFromMemory(mlir::Value Value, clang::QualType Ty); - mlir::Type convertType(clang::QualType T); - mlir::LogicalResult emitAsmStmt(const clang::AsmStmt &S); std::pair @@ -1241,8 +1239,6 @@ class CIRGenFunction : public CIRGenTypeCache { mlir::Value emitPromotedValue(mlir::Value result, QualType PromotionType); mlir::Value emitUnPromotedValue(mlir::Value result, QualType PromotionType); - mlir::Type getCIRType(const clang::QualType &type); - const CaseStmt *foldCaseStmt(const clang::CaseStmt &S, mlir::Type condType, mlir::ArrayAttr &value, cir::CaseOpKind &kind); diff --git a/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp b/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp index ea5cd755ec26..43341ef0f1ca 100644 --- a/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp @@ -1678,8 +1678,8 @@ CIRGenItaniumRTTIBuilder::GetAddrOfTypeName(mlir::Location loc, QualType Ty, // We know that the mangled name of the type starts at index 4 of the // mangled name of the typename, so we can just index into it in order to // get the mangled name of the type. - auto Init = builder.getString( - Name.substr(4), CGM.getTypes().ConvertType(CGM.getASTContext().CharTy)); + auto Init = builder.getString(Name.substr(4), + CGM.convertType(CGM.getASTContext().CharTy)); auto Align = CGM.getASTContext().getTypeAlignInChars(CGM.getASTContext().CharTy); @@ -1770,8 +1770,7 @@ static unsigned ComputeVMIClassTypeInfoFlags(const CXXRecordDecl *RD) { /// constraints, according to the Itanium C++ ABI, 2.9.5p5c. void CIRGenItaniumRTTIBuilder::BuildVMIClassTypeInfo(mlir::Location loc, const CXXRecordDecl *RD) { - auto UnsignedIntLTy = - CGM.getTypes().ConvertType(CGM.getASTContext().UnsignedIntTy); + auto UnsignedIntLTy = CGM.convertType(CGM.getASTContext().UnsignedIntTy); // Itanium C++ ABI 2.9.5p6c: // __flags is a word with flags describing details about the class // structure, which may be referenced by using the __flags_masks @@ -1815,7 +1814,7 @@ void CIRGenItaniumRTTIBuilder::BuildVMIClassTypeInfo(mlir::Location loc, if (TI.getTriple().isOSCygMing() && TI.getPointerWidth(LangAS::Default) > TI.getLongWidth()) OffsetFlagsTy = CGM.getASTContext().LongLongTy; - auto OffsetFlagsLTy = CGM.getTypes().ConvertType(OffsetFlagsTy); + auto OffsetFlagsLTy = CGM.convertType(OffsetFlagsTy); for (const auto &Base : RD->bases()) { // The __base_type member points to the RTTI for the base type. @@ -2241,7 +2240,7 @@ void CIRGenItaniumCXXABI::emitThrow(CIRGenFunction &CGF, // Now allocate the exception object. auto &builder = CGF.getBuilder(); QualType clangThrowType = E->getSubExpr()->getType(); - auto throwTy = builder.getPointerTo(CGF.ConvertType(clangThrowType)); + auto throwTy = builder.getPointerTo(CGF.convertType(clangThrowType)); uint64_t typeSize = CGF.getContext().getTypeSizeInChars(clangThrowType).getQuantity(); auto subExprLoc = CGF.getLoc(E->getSubExpr()->getSourceRange()); @@ -2407,7 +2406,7 @@ static cir::FuncOp getItaniumDynamicCastFn(CIRGenFunction &CGF) { mlir::Type VoidPtrTy = CGF.VoidPtrTy; mlir::Type RTTIPtrTy = CGF.getBuilder().getUInt8PtrTy(); - mlir::Type PtrDiffTy = CGF.ConvertType(CGF.getContext().getPointerDiffType()); + mlir::Type PtrDiffTy = CGF.convertType(CGF.getContext().getPointerDiffType()); // TODO(cir): mark the function as nowind readonly. @@ -2579,7 +2578,7 @@ static cir::DynamicCastInfoAttr emitDynamicCastInfo(CIRGenFunction &CGF, const CXXRecordDecl *destDecl = DestRecordTy->getAsCXXRecordDecl(); auto offsetHint = computeOffsetHint(CGF.getContext(), srcDecl, destDecl); - mlir::Type ptrdiffTy = CGF.ConvertType(CGF.getContext().getPointerDiffType()); + mlir::Type ptrdiffTy = CGF.convertType(CGF.getContext().getPointerDiffType()); auto offsetHintAttr = cir::IntAttr::get(ptrdiffTy, offsetHint.getQuantity()); return cir::DynamicCastInfoAttr::get(srcRtti, destRtti, runtimeFuncRef, diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp index 085e2c237ee7..e4a7951361a0 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp @@ -1211,7 +1211,7 @@ void CIRGenModule::emitGlobalVarDefinition(const clang::VarDecl *D, // exists. A use may still exists, however, so we still may need // to do a RAUW. assert(!ASTTy->isIncompleteType() && "Unexpected incomplete type"); - Init = builder.getZeroInitAttr(getCIRType(D->getType())); + Init = builder.getZeroInitAttr(convertType(D->getType())); } else { initializedGlobalDecl = GlobalDecl(D); emitter.emplace(*this); @@ -1224,7 +1224,7 @@ void CIRGenModule::emitGlobalVarDefinition(const clang::VarDecl *D, if (getLangOpts().CPlusPlus) { if (InitDecl->hasFlexibleArrayInit(astContext)) ErrorUnsupported(D, "flexible array initializer"); - Init = builder.getZeroInitAttr(getCIRType(T)); + Init = builder.getZeroInitAttr(convertType(T)); if (!IsDefinitionAvailableExternally) NeedsGlobalCtor = true; } else { @@ -1442,12 +1442,11 @@ CIRGenModule::getConstantArrayFromStringLiteral(const StringLiteral *E) { auto finalSize = CAT->getSize().getZExtValue(); Str.resize(finalSize); - auto eltTy = getTypes().ConvertType(CAT->getElementType()); + auto eltTy = convertType(CAT->getElementType()); return builder.getString(Str, eltTy, finalSize); } - auto arrayTy = - mlir::dyn_cast(getTypes().ConvertType(E->getType())); + auto arrayTy = mlir::dyn_cast(convertType(E->getType())); assert(arrayTy && "string literals must be emitted as an array type"); auto arrayEltTy = mlir::dyn_cast(arrayTy.getEltType()); @@ -2182,8 +2181,8 @@ void CIRGenModule::emitAliasForGlobal(StringRef mangledName, setCommonAttributes(aliasGD, alias); } -mlir::Type CIRGenModule::getCIRType(const QualType &type) { - return genTypes.ConvertType(type); +mlir::Type CIRGenModule::convertType(QualType type) { + return genTypes.convertType(type); } bool CIRGenModule::verifyModule() { @@ -2228,7 +2227,7 @@ cir::FuncOp CIRGenModule::GetAddrOfFunction(clang::GlobalDecl GD, mlir::Type Ty, if (!Ty) { const auto *FD = cast(GD.getDecl()); - Ty = getTypes().ConvertType(FD->getType()); + Ty = convertType(FD->getType()); } // Devirtualized destructor calls may come through here instead of via diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.h b/clang/lib/CIR/CodeGen/CIRGenModule.h index 905754a4ad3a..69db17a08ffd 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.h +++ b/clang/lib/CIR/CodeGen/CIRGenModule.h @@ -584,7 +584,7 @@ class CIRGenModule : public CIRGenTypeCache { GlobalDecl aliasGD, cir::FuncOp aliasee, cir::GlobalLinkageKind linkage); - mlir::Type getCIRType(const clang::QualType &type); + mlir::Type convertType(clang::QualType type); /// Set the visibility for the given global. void setGlobalVisibility(mlir::Operation *Op, const NamedDecl *D) const; diff --git a/clang/lib/CIR/CodeGen/CIRGenOpenCL.cpp b/clang/lib/CIR/CodeGen/CIRGenOpenCL.cpp index 3db01cab6659..e59f96c1b403 100644 --- a/clang/lib/CIR/CodeGen/CIRGenOpenCL.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenOpenCL.cpp @@ -204,7 +204,7 @@ void CIRGenFunction::emitKernelMetadata(const FunctionDecl *FD, mlir::IntegerAttr intelReqdSubGroupSizeAttr; if (const VecTypeHintAttr *A = FD->getAttr()) { - mlir::Type typeHintValue = getTypes().ConvertType(A->getTypeHint()); + mlir::Type typeHintValue = convertType(A->getTypeHint()); vecTypeHintAttr = mlir::TypeAttr::get(typeHintValue); vecTypeHintSignedness = OpenCLKernelMetadataAttr::isSignedHint(typeHintValue); diff --git a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp index 35db7731f42e..916010a4f19c 100644 --- a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp @@ -251,7 +251,7 @@ mlir::Type CIRGenTypes::convertTypeForMem(clang::QualType qualType, bool forBitField) { assert(!qualType->isConstantMatrixType() && "Matrix types NYI"); - mlir::Type convertedType = ConvertType(qualType); + mlir::Type convertedType = convertType(qualType); assert(!forBitField && "Bit fields NYI"); @@ -267,7 +267,7 @@ mlir::MLIRContext &CIRGenTypes::getMLIRContext() const { return *Builder.getContext(); } -mlir::Type CIRGenTypes::ConvertFunctionTypeInternal(QualType QFT) { +mlir::Type CIRGenTypes::convertFunctionTypeInternal(QualType QFT) { assert(QFT.isCanonical()); const Type *Ty = QFT.getTypePtr(); const FunctionType *FT = cast(QFT.getTypePtr()); @@ -341,8 +341,8 @@ bool CIRGenTypes::isFuncTypeConvertible(const FunctionType *FT) { return true; } -/// ConvertType - Convert the specified type to its MLIR form. -mlir::Type CIRGenTypes::ConvertType(QualType T) { +/// convertType - Convert the specified type to its MLIR form. +mlir::Type CIRGenTypes::convertType(QualType T) { T = astContext.getCanonicalType(T); const Type *Ty = T.getTypePtr(); @@ -601,7 +601,7 @@ mlir::Type CIRGenTypes::ConvertType(QualType T) { llvm_unreachable("Unexpected undeduced type!"); case Type::Complex: { const ComplexType *CT = cast(Ty); - auto ElementTy = ConvertType(CT->getElementType()); + auto ElementTy = convertType(CT->getElementType()); ResultType = cir::ComplexType::get(Builder.getContext(), ElementTy); break; } @@ -619,7 +619,7 @@ mlir::Type CIRGenTypes::ConvertType(QualType T) { QualType ETy = PTy->getPointeeType(); assert(!ETy->isConstantMatrixType() && "not implemented"); - mlir::Type PointeeType = ConvertType(ETy); + mlir::Type PointeeType = convertType(ETy); // Treat effectively as a *i8. // if (PointeeType->isVoidTy()) @@ -678,7 +678,7 @@ mlir::Type CIRGenTypes::ConvertType(QualType T) { } case Type::FunctionNoProto: case Type::FunctionProto: - ResultType = ConvertFunctionTypeInternal(T); + ResultType = convertFunctionTypeInternal(T); break; case Type::ObjCObject: assert(0 && "not implemented"); @@ -697,7 +697,7 @@ mlir::Type CIRGenTypes::ConvertType(QualType T) { case Type::Enum: { const EnumDecl *ED = cast(Ty)->getDecl(); if (ED->isCompleteDefinition() || ED->isFixed()) - return ConvertType(ED->getIntegerType()); + return convertType(ED->getIntegerType()); // Return a placeholder 'i32' type. This can be changed later when the // type is defined (see UpdateCompletedType), but is likely to be the // "right" answer. @@ -713,9 +713,9 @@ mlir::Type CIRGenTypes::ConvertType(QualType T) { case Type::MemberPointer: { const auto *MPT = cast(Ty); - auto memberTy = ConvertType(MPT->getPointeeType()); + auto memberTy = convertType(MPT->getPointeeType()); auto clsTy = - mlir::cast(ConvertType(QualType(MPT->getClass(), 0))); + mlir::cast(convertType(QualType(MPT->getClass(), 0))); if (MPT->isMemberDataPointer()) ResultType = cir::DataMemberType::get(Builder.getContext(), memberTy, clsTy); @@ -804,11 +804,11 @@ const CIRGenFunctionInfo &CIRGenTypes::arrangeCIRFunctionInfo( // default now. cir::ABIArgInfo &retInfo = FI->getReturnInfo(); if (retInfo.canHaveCoerceToType() && retInfo.getCoerceToType() == nullptr) - retInfo.setCoerceToType(ConvertType(FI->getReturnType())); + retInfo.setCoerceToType(convertType(FI->getReturnType())); for (auto &I : FI->arguments()) if (I.info.canHaveCoerceToType() && I.info.getCoerceToType() == nullptr) - I.info.setCoerceToType(ConvertType(I.type)); + I.info.setCoerceToType(convertType(I.type)); bool erased = FunctionsBeingProcessed.erase(FI); (void)erased; @@ -841,7 +841,7 @@ void CIRGenTypes::UpdateCompletedType(const TagDecl *TD) { // Okay, we formed some types based on this. We speculated that the enum // would be lowered to i32, so we only need to flush the cache if this // didn't happen. - if (!ConvertType(ED->getIntegerType()).isInteger(32)) + if (!convertType(ED->getIntegerType()).isInteger(32)) TypeCache.clear(); } // If necessary, provide the full definition of a type only used with a diff --git a/clang/lib/CIR/CodeGen/CIRGenTypes.h b/clang/lib/CIR/CodeGen/CIRGenTypes.h index c862d3232086..1d01a56cfa41 100644 --- a/clang/lib/CIR/CodeGen/CIRGenTypes.h +++ b/clang/lib/CIR/CodeGen/CIRGenTypes.h @@ -112,8 +112,8 @@ class CIRGenTypes { llvm::SmallVector DeferredRecords; - /// Heper for ConvertType. - mlir::Type ConvertFunctionTypeInternal(clang::QualType FT); + /// Heper for convertType. + mlir::Type convertFunctionTypeInternal(clang::QualType FT); public: CIRGenTypes(CIRGenModule &cgm); @@ -165,7 +165,7 @@ class CIRGenTypes { CIRGenCXXABI &getCXXABI() const { return TheCXXABI; } /// Convert type T into a mlir::Type. - mlir::Type ConvertType(clang::QualType T); + mlir::Type convertType(clang::QualType T); mlir::Type convertRecordDeclType(const clang::RecordDecl *recordDecl); diff --git a/clang/lib/CIR/CodeGen/TargetInfo.cpp b/clang/lib/CIR/CodeGen/TargetInfo.cpp index 855a0208d8d4..cadfe76a717c 100644 --- a/clang/lib/CIR/CodeGen/TargetInfo.cpp +++ b/clang/lib/CIR/CodeGen/TargetInfo.cpp @@ -129,13 +129,13 @@ class AArch64ABIInfo : public ABIInfo { if (testIfIsVoidTy(it->type)) it->info = cir::ABIArgInfo::getIgnore(); else - it->info = cir::ABIArgInfo::getDirect(CGT.ConvertType(it->type)); + it->info = cir::ABIArgInfo::getDirect(CGT.convertType(it->type)); } auto RetTy = FI.getReturnType(); if (testIfIsVoidTy(RetTy)) FI.getReturnInfo() = cir::ABIArgInfo::getIgnore(); else - FI.getReturnInfo() = cir::ABIArgInfo::getDirect(CGT.ConvertType(RetTy)); + FI.getReturnInfo() = cir::ABIArgInfo::getDirect(CGT.convertType(RetTy)); return; } @@ -334,13 +334,13 @@ void X86_64ABIInfo::computeInfo(CIRGenFunctionInfo &FI) const { if (testIfIsVoidTy(it->type)) it->info = cir::ABIArgInfo::getIgnore(); else - it->info = cir::ABIArgInfo::getDirect(CGT.ConvertType(it->type)); + it->info = cir::ABIArgInfo::getDirect(CGT.convertType(it->type)); } auto RetTy = FI.getReturnType(); if (testIfIsVoidTy(RetTy)) FI.getReturnInfo() = cir::ABIArgInfo::getIgnore(); else - FI.getReturnInfo() = cir::ABIArgInfo::getDirect(CGT.ConvertType(RetTy)); + FI.getReturnInfo() = cir::ABIArgInfo::getDirect(CGT.convertType(RetTy)); } /// GetINTEGERTypeAtOffset - The ABI specifies that a value should be passed in @@ -397,7 +397,7 @@ cir::ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty, ++neededInt; // Pick an 8-byte type based on the preferred type. - ResType = GetINTEGERTypeAtOffset(CGT.ConvertType(Ty), 0, Ty, 0); + ResType = GetINTEGERTypeAtOffset(CGT.convertType(Ty), 0, Ty, 0); // If we have a sign or zero extended integer, make sure to return Extend so // that the parameter gets the right LLVM IR attributes. @@ -414,7 +414,7 @@ cir::ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty, // register is used, the registers are taken in the order from %xmm0 to // %xmm7. case Class::SSE: { - mlir::Type CIRType = CGT.ConvertType(Ty); + mlir::Type CIRType = CGT.convertType(Ty); ResType = GetSSETypeAtOffset(CIRType, 0, Ty, 0); ++neededSSE; break; @@ -527,7 +527,7 @@ cir::ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy) const { // AMD64-ABI 3.2.3p4: Rule 3. If the class is INTEGER, the next available // register of the sequence %rax, %rdx is used. case Class::Integer: - ResType = GetINTEGERTypeAtOffset(CGT.ConvertType(RetTy), 0, RetTy, 0); + ResType = GetINTEGERTypeAtOffset(CGT.convertType(RetTy), 0, RetTy, 0); // If we have a sign or zero extended integer, make sure to return Extend so // that the parameter gets the right LLVM IR attributes. @@ -547,7 +547,7 @@ cir::ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy) const { // AMD64-ABI 3.2.3p4: Rule 4. If the class is SSE, the next available SSE // register of the sequence %xmm0, %xmm1 is used. case Class::SSE: - ResType = GetSSETypeAtOffset(CGT.ConvertType(RetTy), 0, RetTy, 0); + ResType = GetSSETypeAtOffset(CGT.convertType(RetTy), 0, RetTy, 0); break; default: