Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clang/lib/CIR/CodeGen/CIRAsm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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<MatrixType>(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());
Expand Down
44 changes: 21 additions & 23 deletions clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static RValue emitUnaryFPBuiltin(CIRGenFunction &CGF, const CallExpr &E) {
template <typename Op>
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())
Expand All @@ -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<Op>(Loc, Ty, Arg0, Arg1);

return RValue::get(Call->getResult(0));
Expand All @@ -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);
Expand All @@ -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<Op>(CGF.getLoc(E->getExprLoc()), resultTy, arg);
return RValue::get(op);
Expand Down Expand Up @@ -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()));
}
Expand Down Expand Up @@ -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();
Expand All @@ -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<cir::IsConstantOp>(
getLoc(E->getSourceRange()), ArgValue);
Expand All @@ -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<cir::IntType>(ConvertType(E->getType()));
auto ResType = mlir::dyn_cast<cir::IntType>(convertType(E->getType()));
assert(ResType && "not sure what to do?");

// We pass this builtin onto the optimizer so that it can figure out the
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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<cir::IntType>(CGM.getTypes().ConvertType(ResultQTy));
auto ResultCIRTy = mlir::cast<cir::IntType>(CGM.convertType(ResultQTy));

mlir::Value Left = emitScalarExpr(LeftArg);
mlir::Value Right = emitScalarExpr(RightArg);
Expand Down Expand Up @@ -2008,8 +2007,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,

clang::QualType ResultQTy =
ResultArg->getType()->castAs<clang::PointerType>()->getPointeeType();
auto ResultCIRTy =
mlir::cast<cir::IntType>(CGM.getTypes().ConvertType(ResultQTy));
auto ResultCIRTy = mlir::cast<cir::IntType>(CGM.convertType(ResultQTy));

auto Loc = getLoc(E->getSourceRange());
auto ArithResult =
Expand Down Expand Up @@ -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: {
Expand All @@ -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: {
Expand All @@ -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:
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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())));
}
}

Expand Down Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<arch_type>.td,
// which can be found under LLVM IR directory.
mlir::Type funcResTy = builder.getSInt64Ty();
Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CIR/CodeGen/CIRGenCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<cir::VAArgOp>(loc, type, vaList);
}
Expand Down
6 changes: 3 additions & 3 deletions clang/lib/CIR/CodeGen/CIRGenClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CIR/CodeGen/CIRGenCoroutine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions clang/lib/CIR/CodeGen/CIRGenDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -482,7 +482,7 @@ CIRGenModule::getOrCreateStaticVarDecl(const VarDecl &D,
if (D.hasAttr<CUDASharedAttr>() || D.hasAttr<LoaderUninitializedAttr>())
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);
Expand Down Expand Up @@ -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,
Expand Down
Loading
Loading