Skip to content

Commit 45ba533

Browse files
Andres-Salamancaaokblast
authored andcommitted
[CIR][NFC] Update TypeCache file to use MLIR-style camel case (llvm#165060)
This PR updates the file `CIRGenTypeCache` to use MLIR-style camel case naming.The change was inspired by the discussion here: llvm#164180 (comment)
1 parent c10077d commit 45ba533

15 files changed

+118
-118
lines changed

clang/lib/CIR/CodeGen/CIRGenBuilder.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
108108

109109
cir::LongDoubleType getLongDoubleTy(const llvm::fltSemantics &format) const {
110110
if (&format == &llvm::APFloat::IEEEdouble())
111-
return cir::LongDoubleType::get(getContext(), typeCache.DoubleTy);
111+
return cir::LongDoubleType::get(getContext(), typeCache.doubleTy);
112112
if (&format == &llvm::APFloat::x87DoubleExtended())
113-
return cir::LongDoubleType::get(getContext(), typeCache.FP80Ty);
113+
return cir::LongDoubleType::get(getContext(), typeCache.fP80Ty);
114114
if (&format == &llvm::APFloat::IEEEquad())
115-
return cir::LongDoubleType::get(getContext(), typeCache.FP128Ty);
115+
return cir::LongDoubleType::get(getContext(), typeCache.fP128Ty);
116116
if (&format == &llvm::APFloat::PPCDoubleDouble())
117117
llvm_unreachable("NYI: PPC double-double format for long double");
118118
llvm_unreachable("Unsupported format for long double");
@@ -258,17 +258,17 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
258258
}
259259
}
260260

261-
cir::VoidType getVoidTy() { return typeCache.VoidTy; }
261+
cir::VoidType getVoidTy() { return typeCache.voidTy; }
262262

263-
cir::IntType getSInt8Ty() { return typeCache.SInt8Ty; }
264-
cir::IntType getSInt16Ty() { return typeCache.SInt16Ty; }
265-
cir::IntType getSInt32Ty() { return typeCache.SInt32Ty; }
266-
cir::IntType getSInt64Ty() { return typeCache.SInt64Ty; }
263+
cir::IntType getSInt8Ty() { return typeCache.sInt8Ty; }
264+
cir::IntType getSInt16Ty() { return typeCache.sInt16Ty; }
265+
cir::IntType getSInt32Ty() { return typeCache.sInt32Ty; }
266+
cir::IntType getSInt64Ty() { return typeCache.sInt64Ty; }
267267

268-
cir::IntType getUInt8Ty() { return typeCache.UInt8Ty; }
269-
cir::IntType getUInt16Ty() { return typeCache.UInt16Ty; }
270-
cir::IntType getUInt32Ty() { return typeCache.UInt32Ty; }
271-
cir::IntType getUInt64Ty() { return typeCache.UInt64Ty; }
268+
cir::IntType getUInt8Ty() { return typeCache.uInt8Ty; }
269+
cir::IntType getUInt16Ty() { return typeCache.uInt16Ty; }
270+
cir::IntType getUInt32Ty() { return typeCache.uInt32Ty; }
271+
cir::IntType getUInt64Ty() { return typeCache.uInt64Ty; }
272272

273273
cir::ConstantOp getConstInt(mlir::Location loc, llvm::APSInt intVal);
274274

@@ -280,21 +280,21 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
280280
llvm::APFloat fpVal);
281281

282282
bool isInt8Ty(mlir::Type i) {
283-
return i == typeCache.UInt8Ty || i == typeCache.SInt8Ty;
283+
return i == typeCache.uInt8Ty || i == typeCache.sInt8Ty;
284284
}
285285
bool isInt16Ty(mlir::Type i) {
286-
return i == typeCache.UInt16Ty || i == typeCache.SInt16Ty;
286+
return i == typeCache.uInt16Ty || i == typeCache.sInt16Ty;
287287
}
288288
bool isInt32Ty(mlir::Type i) {
289-
return i == typeCache.UInt32Ty || i == typeCache.SInt32Ty;
289+
return i == typeCache.uInt32Ty || i == typeCache.sInt32Ty;
290290
}
291291
bool isInt64Ty(mlir::Type i) {
292-
return i == typeCache.UInt64Ty || i == typeCache.SInt64Ty;
292+
return i == typeCache.uInt64Ty || i == typeCache.sInt64Ty;
293293
}
294294
bool isInt(mlir::Type i) { return mlir::isa<cir::IntType>(i); }
295295

296296
// Fetch the type representing a pointer to unsigned int8 values.
297-
cir::PointerType getUInt8PtrTy() { return typeCache.UInt8PtrTy; }
297+
cir::PointerType getUInt8PtrTy() { return typeCache.uInt8PtrTy; }
298298

299299
/// Get a CIR anonymous record type.
300300
cir::RecordType getAnonRecordTy(llvm::ArrayRef<mlir::Type> members,

clang/lib/CIR/CodeGen/CIRGenClass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ static Address applyNonVirtualAndVirtualOffset(
362362
// not bytes. So the pointer must be cast to a byte pointer and back.
363363

364364
mlir::Value ptr = addr.getPointer();
365-
mlir::Type charPtrType = cgf.cgm.UInt8PtrTy;
365+
mlir::Type charPtrType = cgf.cgm.uInt8PtrTy;
366366
mlir::Value charPtr = cgf.getBuilder().createBitcast(ptr, charPtrType);
367367
mlir::Value adjusted = cir::PtrStrideOp::create(
368368
cgf.getBuilder(), loc, charPtrType, charPtr, baseOffset);
@@ -1105,7 +1105,7 @@ mlir::Value CIRGenFunction::getVTTParameter(GlobalDecl gd, bool forVirtualBase,
11051105
// We're the complete constructor, so get the VTT by name.
11061106
cir::GlobalOp vtt = cgm.getVTables().getAddrOfVTT(rd);
11071107
return builder.createVTTAddrPoint(
1108-
loc, builder.getPointerTo(cgm.VoidPtrTy),
1108+
loc, builder.getPointerTo(cgm.voidPtrTy),
11091109
mlir::FlatSymbolRefAttr::get(vtt.getSymNameAttr()), subVTTIndex);
11101110
}
11111111
}

clang/lib/CIR/CodeGen/CIRGenCoroutine.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ cir::CallOp CIRGenFunction::emitCoroIDBuiltinCall(mlir::Location loc,
5555
if (!builtin) {
5656
fnOp = cgm.createCIRBuiltinFunction(
5757
loc, cgm.builtinCoroId,
58-
cir::FuncType::get({int32Ty, VoidPtrTy, VoidPtrTy, VoidPtrTy}, int32Ty),
58+
cir::FuncType::get({int32Ty, voidPtrTy, voidPtrTy, voidPtrTy}, int32Ty),
5959
/*FD=*/nullptr);
6060
assert(fnOp && "should always succeed");
6161
} else {
@@ -75,7 +75,7 @@ cir::CallOp CIRGenFunction::emitCoroAllocBuiltinCall(mlir::Location loc) {
7575
cir::FuncOp fnOp;
7676
if (!builtin) {
7777
fnOp = cgm.createCIRBuiltinFunction(loc, cgm.builtinCoroAlloc,
78-
cir::FuncType::get({UInt32Ty}, boolTy),
78+
cir::FuncType::get({uInt32Ty}, boolTy),
7979
/*fd=*/nullptr);
8080
assert(fnOp && "should always succeed");
8181
} else {
@@ -95,7 +95,7 @@ CIRGenFunction::emitCoroBeginBuiltinCall(mlir::Location loc,
9595
if (!builtin) {
9696
fnOp = cgm.createCIRBuiltinFunction(
9797
loc, cgm.builtinCoroBegin,
98-
cir::FuncType::get({UInt32Ty, VoidPtrTy}, VoidPtrTy),
98+
cir::FuncType::get({uInt32Ty, voidPtrTy}, voidPtrTy),
9999
/*fd=*/nullptr);
100100
assert(fnOp && "should always succeed");
101101
} else {
@@ -110,7 +110,7 @@ CIRGenFunction::emitCoroBeginBuiltinCall(mlir::Location loc,
110110
mlir::LogicalResult
111111
CIRGenFunction::emitCoroutineBody(const CoroutineBodyStmt &s) {
112112
mlir::Location openCurlyLoc = getLoc(s.getBeginLoc());
113-
cir::ConstantOp nullPtrCst = builder.getNullPtr(VoidPtrTy, openCurlyLoc);
113+
cir::ConstantOp nullPtrCst = builder.getNullPtr(voidPtrTy, openCurlyLoc);
114114

115115
auto fn = mlir::cast<cir::FuncOp>(curFn);
116116
fn.setCoroutine(true);

clang/lib/CIR/CodeGen/CIRGenDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ CIRGenFunction::emitAutoVarAlloca(const VarDecl &d,
8080
assert(!cir::MissingFeatures::openMP());
8181
if (!didCallStackSave) {
8282
// Save the stack.
83-
cir::PointerType defaultTy = AllocaInt8PtrTy;
83+
cir::PointerType defaultTy = allocaInt8PtrTy;
8484
CharUnits align = CharUnits::fromQuantity(
8585
cgm.getDataLayout().getAlignment(defaultTy, false));
8686
Address stack = createTempAlloca(defaultTy, align, loc, "saved_stack");
8787

8888
mlir::Value v = builder.createStackSave(loc, defaultTy);
89-
assert(v.getType() == AllocaInt8PtrTy);
89+
assert(v.getType() == allocaInt8PtrTy);
9090
builder.createStore(loc, v, stack);
9191

9292
didCallStackSave = true;

clang/lib/CIR/CodeGen/CIRGenExpr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2529,7 +2529,7 @@ CIRGenFunction::emitConditionalBlocks(const AbstractConditionalOperator *e,
25292529

25302530
// If both arms are void, so be it.
25312531
if (!yieldTy)
2532-
yieldTy = VoidTy;
2532+
yieldTy = voidTy;
25332533

25342534
// Insert required yields.
25352535
for (mlir::OpBuilder::InsertPoint &toInsert : insertPoints) {

clang/lib/CIR/CodeGen/CIRGenExprAggregate.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ void AggExprEmitter::emitArrayInit(Address destPtr, cir::ArrayType arrayTy,
490490
for (uint64_t i = 0; i != numInitElements; ++i) {
491491
// Advance to the next element.
492492
if (i > 0) {
493-
one = builder.getConstantInt(loc, cgf.PtrDiffTy, i);
493+
one = builder.getConstantInt(loc, cgf.ptrDiffTy, i);
494494
element = builder.createPtrStride(loc, begin, one);
495495
}
496496

@@ -512,7 +512,7 @@ void AggExprEmitter::emitArrayInit(Address destPtr, cir::ArrayType arrayTy,
512512
cgf.getTypes().isZeroInitializable(elementType))) {
513513
// Advance to the start of the rest of the array.
514514
if (numInitElements) {
515-
one = builder.getConstantInt(loc, cgf.PtrDiffTy, 1);
515+
one = builder.getConstantInt(loc, cgf.ptrDiffTy, 1);
516516
element = cir::PtrStrideOp::create(builder, loc, cirElementPtrType,
517517
element, one);
518518
}
@@ -526,7 +526,7 @@ void AggExprEmitter::emitArrayInit(Address destPtr, cir::ArrayType arrayTy,
526526

527527
// Compute the end of array
528528
cir::ConstantOp numArrayElementsConst = builder.getConstInt(
529-
loc, mlir::cast<cir::IntType>(cgf.PtrDiffTy), numArrayElements);
529+
loc, mlir::cast<cir::IntType>(cgf.ptrDiffTy), numArrayElements);
530530
mlir::Value end = cir::PtrStrideOp::create(builder, loc, cirElementPtrType,
531531
begin, numArrayElementsConst);
532532

@@ -563,7 +563,7 @@ void AggExprEmitter::emitArrayInit(Address destPtr, cir::ArrayType arrayTy,
563563

564564
// Advance pointer and store them to temporary variable
565565
cir::ConstantOp one = builder.getConstInt(
566-
loc, mlir::cast<cir::IntType>(cgf.PtrDiffTy), 1);
566+
loc, mlir::cast<cir::IntType>(cgf.ptrDiffTy), 1);
567567
auto nextElement = cir::PtrStrideOp::create(
568568
builder, loc, cirElementPtrType, currentElement, one);
569569
cgf.emitStoreThroughLValue(RValue::get(nextElement), tmpLV);

clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,12 @@ static mlir::Value emitCXXNewAllocSize(CIRGenFunction &cgf, const CXXNewExpr *e,
257257
if (!e->isArray()) {
258258
CharUnits typeSize = cgf.getContext().getTypeSizeInChars(type);
259259
sizeWithoutCookie = cgf.getBuilder().getConstant(
260-
loc, cir::IntAttr::get(cgf.SizeTy, typeSize.getQuantity()));
260+
loc, cir::IntAttr::get(cgf.sizeTy, typeSize.getQuantity()));
261261
return sizeWithoutCookie;
262262
}
263263

264264
// The width of size_t.
265-
unsigned sizeWidth = cgf.cgm.getDataLayout().getTypeSizeInBits(cgf.SizeTy);
265+
unsigned sizeWidth = cgf.cgm.getDataLayout().getTypeSizeInBits(cgf.sizeTy);
266266

267267
// The number of elements can be have an arbitrary integer type;
268268
// essentially, we need to multiply it by a constant factor, add a

clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace {
4646
class ConstExprEmitter;
4747

4848
static mlir::TypedAttr computePadding(CIRGenModule &cgm, CharUnits size) {
49-
mlir::Type eltTy = cgm.UCharTy;
49+
mlir::Type eltTy = cgm.uCharTy;
5050
clang::CharUnits::QuantityType arSize = size.getQuantity();
5151
CIRGenBuilderTy &bld = cgm.getBuilder();
5252
if (size > CharUnits::One()) {

clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -762,9 +762,9 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
762762
// FIXME(cir): For now lets pretend we shouldn't use the conversion
763763
// intrinsics and insert a cast here unconditionally.
764764
src = builder.createCast(cgf.getLoc(loc), cir::CastKind::floating, src,
765-
cgf.FloatTy);
765+
cgf.floatTy);
766766
srcType = cgf.getContext().FloatTy;
767-
mlirSrcType = cgf.FloatTy;
767+
mlirSrcType = cgf.floatTy;
768768
}
769769
}
770770

@@ -1738,7 +1738,7 @@ mlir::Value ScalarExprEmitter::emitSub(const BinOpInfo &ops) {
17381738
//
17391739
// See more in `EmitSub` in CGExprScalar.cpp.
17401740
assert(!cir::MissingFeatures::llvmLoweringPtrDiffConsidersPointee());
1741-
return cir::PtrDiffOp::create(builder, cgf.getLoc(ops.loc), cgf.PtrDiffTy,
1741+
return cir::PtrDiffOp::create(builder, cgf.getLoc(ops.loc), cgf.ptrDiffTy,
17421742
ops.lhs, ops.rhs);
17431743
}
17441744

@@ -2220,20 +2220,20 @@ mlir::Value ScalarExprEmitter::VisitUnaryExprOrTypeTraitExpr(
22202220
"sizeof operator for VariableArrayType",
22212221
e->getStmtClassName());
22222222
return builder.getConstant(
2223-
loc, cir::IntAttr::get(cgf.cgm.UInt64Ty,
2223+
loc, cir::IntAttr::get(cgf.cgm.uInt64Ty,
22242224
llvm::APSInt(llvm::APInt(64, 1), true)));
22252225
}
22262226
} else if (e->getKind() == UETT_OpenMPRequiredSimdAlign) {
22272227
cgf.getCIRGenModule().errorNYI(
22282228
e->getSourceRange(), "sizeof operator for OpenMpRequiredSimdAlign",
22292229
e->getStmtClassName());
22302230
return builder.getConstant(
2231-
loc, cir::IntAttr::get(cgf.cgm.UInt64Ty,
2231+
loc, cir::IntAttr::get(cgf.cgm.uInt64Ty,
22322232
llvm::APSInt(llvm::APInt(64, 1), true)));
22332233
}
22342234

22352235
return builder.getConstant(
2236-
loc, cir::IntAttr::get(cgf.cgm.UInt64Ty,
2236+
loc, cir::IntAttr::get(cgf.cgm.uInt64Ty,
22372237
e->EvaluateKnownConstInt(cgf.getContext())));
22382238
}
22392239

@@ -2329,14 +2329,14 @@ mlir::Value ScalarExprEmitter::VisitAbstractConditionalOperator(
23292329

23302330
mlir::Value lhs = Visit(lhsExpr);
23312331
if (!lhs) {
2332-
lhs = builder.getNullValue(cgf.VoidTy, loc);
2332+
lhs = builder.getNullValue(cgf.voidTy, loc);
23332333
lhsIsVoid = true;
23342334
}
23352335

23362336
mlir::Value rhs = Visit(rhsExpr);
23372337
if (lhsIsVoid) {
23382338
assert(!rhs && "lhs and rhs types must match");
2339-
rhs = builder.getNullValue(cgf.VoidTy, loc);
2339+
rhs = builder.getNullValue(cgf.voidTy, loc);
23402340
}
23412341

23422342
return builder.createSelect(loc, condV, lhs, rhs);
@@ -2381,7 +2381,7 @@ mlir::Value ScalarExprEmitter::VisitAbstractConditionalOperator(
23812381
if (!insertPoints.empty()) {
23822382
// If both arms are void, so be it.
23832383
if (!yieldTy)
2384-
yieldTy = cgf.VoidTy;
2384+
yieldTy = cgf.voidTy;
23852385

23862386
// Insert required yields.
23872387
for (mlir::OpBuilder::InsertPoint &toInsert : insertPoints) {

clang/lib/CIR/CodeGen/CIRGenFunction.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ CIRGenFunction::emitArrayLength(const clang::ArrayType *origArrayType,
10081008
if (isa<VariableArrayType>(arrayType)) {
10091009
assert(cir::MissingFeatures::vlas());
10101010
cgm.errorNYI(*currSrcLoc, "VLAs");
1011-
return builder.getConstInt(*currSrcLoc, SizeTy, 0);
1011+
return builder.getConstInt(*currSrcLoc, sizeTy, 0);
10121012
}
10131013

10141014
uint64_t countFromCLAs = 1;
@@ -1037,7 +1037,7 @@ CIRGenFunction::emitArrayLength(const clang::ArrayType *origArrayType,
10371037
}
10381038

10391039
baseType = eltType;
1040-
return builder.getConstInt(*currSrcLoc, SizeTy, countFromCLAs);
1040+
return builder.getConstInt(*currSrcLoc, sizeTy, countFromCLAs);
10411041
}
10421042

10431043
mlir::Value CIRGenFunction::emitAlignmentAssumption(
@@ -1074,7 +1074,7 @@ CIRGenFunction::getVLASize(const VariableArrayType *type) {
10741074
elementType = type->getElementType();
10751075
mlir::Value vlaSize = vlaSizeMap[type->getSizeExpr()];
10761076
assert(vlaSize && "no size for VLA!");
1077-
assert(vlaSize.getType() == SizeTy);
1077+
assert(vlaSize.getType() == sizeTy);
10781078

10791079
if (!numElements) {
10801080
numElements = vlaSize;
@@ -1188,7 +1188,7 @@ void CIRGenFunction::emitVariablyModifiedType(QualType type) {
11881188
// Always zexting here would be wrong if it weren't
11891189
// undefined behavior to have a negative bound.
11901190
// FIXME: What about when size's type is larger than size_t?
1191-
entry = builder.createIntCast(size, SizeTy);
1191+
entry = builder.createIntCast(size, sizeTy);
11921192
}
11931193
}
11941194
type = vat->getElementType();

0 commit comments

Comments
 (0)