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
34 changes: 17 additions & 17 deletions clang/lib/CIR/CodeGen/CIRGenBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {

cir::LongDoubleType getLongDoubleTy(const llvm::fltSemantics &format) const {
if (&format == &llvm::APFloat::IEEEdouble())
return cir::LongDoubleType::get(getContext(), typeCache.DoubleTy);
return cir::LongDoubleType::get(getContext(), typeCache.doubleTy);
if (&format == &llvm::APFloat::x87DoubleExtended())
return cir::LongDoubleType::get(getContext(), typeCache.FP80Ty);
return cir::LongDoubleType::get(getContext(), typeCache.fP80Ty);
if (&format == &llvm::APFloat::IEEEquad())
return cir::LongDoubleType::get(getContext(), typeCache.FP128Ty);
return cir::LongDoubleType::get(getContext(), typeCache.fP128Ty);
if (&format == &llvm::APFloat::PPCDoubleDouble())
llvm_unreachable("NYI: PPC double-double format for long double");
llvm_unreachable("Unsupported format for long double");
Expand Down Expand Up @@ -258,17 +258,17 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
}
}

cir::VoidType getVoidTy() { return typeCache.VoidTy; }
cir::VoidType getVoidTy() { return typeCache.voidTy; }

cir::IntType getSInt8Ty() { return typeCache.SInt8Ty; }
cir::IntType getSInt16Ty() { return typeCache.SInt16Ty; }
cir::IntType getSInt32Ty() { return typeCache.SInt32Ty; }
cir::IntType getSInt64Ty() { return typeCache.SInt64Ty; }
cir::IntType getSInt8Ty() { return typeCache.sInt8Ty; }
cir::IntType getSInt16Ty() { return typeCache.sInt16Ty; }
cir::IntType getSInt32Ty() { return typeCache.sInt32Ty; }
cir::IntType getSInt64Ty() { return typeCache.sInt64Ty; }

cir::IntType getUInt8Ty() { return typeCache.UInt8Ty; }
cir::IntType getUInt16Ty() { return typeCache.UInt16Ty; }
cir::IntType getUInt32Ty() { return typeCache.UInt32Ty; }
cir::IntType getUInt64Ty() { return typeCache.UInt64Ty; }
cir::IntType getUInt8Ty() { return typeCache.uInt8Ty; }
cir::IntType getUInt16Ty() { return typeCache.uInt16Ty; }
cir::IntType getUInt32Ty() { return typeCache.uInt32Ty; }
cir::IntType getUInt64Ty() { return typeCache.uInt64Ty; }

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

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

bool isInt8Ty(mlir::Type i) {
return i == typeCache.UInt8Ty || i == typeCache.SInt8Ty;
return i == typeCache.uInt8Ty || i == typeCache.sInt8Ty;
}
bool isInt16Ty(mlir::Type i) {
return i == typeCache.UInt16Ty || i == typeCache.SInt16Ty;
return i == typeCache.uInt16Ty || i == typeCache.sInt16Ty;
}
bool isInt32Ty(mlir::Type i) {
return i == typeCache.UInt32Ty || i == typeCache.SInt32Ty;
return i == typeCache.uInt32Ty || i == typeCache.sInt32Ty;
}
bool isInt64Ty(mlir::Type i) {
return i == typeCache.UInt64Ty || i == typeCache.SInt64Ty;
return i == typeCache.uInt64Ty || i == typeCache.sInt64Ty;
}
bool isInt(mlir::Type i) { return mlir::isa<cir::IntType>(i); }

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

/// Get a CIR anonymous record type.
cir::RecordType getAnonRecordTy(llvm::ArrayRef<mlir::Type> members,
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/CIR/CodeGen/CIRGenClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ static Address applyNonVirtualAndVirtualOffset(
// not bytes. So the pointer must be cast to a byte pointer and back.

mlir::Value ptr = addr.getPointer();
mlir::Type charPtrType = cgf.cgm.UInt8PtrTy;
mlir::Type charPtrType = cgf.cgm.uInt8PtrTy;
mlir::Value charPtr = cgf.getBuilder().createBitcast(ptr, charPtrType);
mlir::Value adjusted = cir::PtrStrideOp::create(
cgf.getBuilder(), loc, charPtrType, charPtr, baseOffset);
Expand Down Expand Up @@ -1105,7 +1105,7 @@ mlir::Value CIRGenFunction::getVTTParameter(GlobalDecl gd, bool forVirtualBase,
// We're the complete constructor, so get the VTT by name.
cir::GlobalOp vtt = cgm.getVTables().getAddrOfVTT(rd);
return builder.createVTTAddrPoint(
loc, builder.getPointerTo(cgm.VoidPtrTy),
loc, builder.getPointerTo(cgm.voidPtrTy),
mlir::FlatSymbolRefAttr::get(vtt.getSymNameAttr()), subVTTIndex);
}
}
Expand Down
8 changes: 4 additions & 4 deletions clang/lib/CIR/CodeGen/CIRGenCoroutine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ cir::CallOp CIRGenFunction::emitCoroIDBuiltinCall(mlir::Location loc,
if (!builtin) {
fnOp = cgm.createCIRBuiltinFunction(
loc, cgm.builtinCoroId,
cir::FuncType::get({int32Ty, VoidPtrTy, VoidPtrTy, VoidPtrTy}, int32Ty),
cir::FuncType::get({int32Ty, voidPtrTy, voidPtrTy, voidPtrTy}, int32Ty),
/*FD=*/nullptr);
assert(fnOp && "should always succeed");
} else {
Expand All @@ -75,7 +75,7 @@ cir::CallOp CIRGenFunction::emitCoroAllocBuiltinCall(mlir::Location loc) {
cir::FuncOp fnOp;
if (!builtin) {
fnOp = cgm.createCIRBuiltinFunction(loc, cgm.builtinCoroAlloc,
cir::FuncType::get({UInt32Ty}, boolTy),
cir::FuncType::get({uInt32Ty}, boolTy),
/*fd=*/nullptr);
assert(fnOp && "should always succeed");
} else {
Expand All @@ -95,7 +95,7 @@ CIRGenFunction::emitCoroBeginBuiltinCall(mlir::Location loc,
if (!builtin) {
fnOp = cgm.createCIRBuiltinFunction(
loc, cgm.builtinCoroBegin,
cir::FuncType::get({UInt32Ty, VoidPtrTy}, VoidPtrTy),
cir::FuncType::get({uInt32Ty, voidPtrTy}, voidPtrTy),
/*fd=*/nullptr);
assert(fnOp && "should always succeed");
} else {
Expand All @@ -110,7 +110,7 @@ CIRGenFunction::emitCoroBeginBuiltinCall(mlir::Location loc,
mlir::LogicalResult
CIRGenFunction::emitCoroutineBody(const CoroutineBodyStmt &s) {
mlir::Location openCurlyLoc = getLoc(s.getBeginLoc());
cir::ConstantOp nullPtrCst = builder.getNullPtr(VoidPtrTy, openCurlyLoc);
cir::ConstantOp nullPtrCst = builder.getNullPtr(voidPtrTy, openCurlyLoc);

auto fn = mlir::cast<cir::FuncOp>(curFn);
fn.setCoroutine(true);
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/CIR/CodeGen/CIRGenDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ CIRGenFunction::emitAutoVarAlloca(const VarDecl &d,
assert(!cir::MissingFeatures::openMP());
if (!didCallStackSave) {
// Save the stack.
cir::PointerType defaultTy = AllocaInt8PtrTy;
cir::PointerType defaultTy = allocaInt8PtrTy;
CharUnits align = CharUnits::fromQuantity(
cgm.getDataLayout().getAlignment(defaultTy, false));
Address stack = createTempAlloca(defaultTy, align, loc, "saved_stack");

mlir::Value v = builder.createStackSave(loc, defaultTy);
assert(v.getType() == AllocaInt8PtrTy);
assert(v.getType() == allocaInt8PtrTy);
builder.createStore(loc, v, stack);

didCallStackSave = true;
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CIR/CodeGen/CIRGenExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2529,7 +2529,7 @@ CIRGenFunction::emitConditionalBlocks(const AbstractConditionalOperator *e,

// If both arms are void, so be it.
if (!yieldTy)
yieldTy = VoidTy;
yieldTy = voidTy;

// Insert required yields.
for (mlir::OpBuilder::InsertPoint &toInsert : insertPoints) {
Expand Down
8 changes: 4 additions & 4 deletions clang/lib/CIR/CodeGen/CIRGenExprAggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ void AggExprEmitter::emitArrayInit(Address destPtr, cir::ArrayType arrayTy,
for (uint64_t i = 0; i != numInitElements; ++i) {
// Advance to the next element.
if (i > 0) {
one = builder.getConstantInt(loc, cgf.PtrDiffTy, i);
one = builder.getConstantInt(loc, cgf.ptrDiffTy, i);
element = builder.createPtrStride(loc, begin, one);
}

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

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

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

// Advance pointer and store them to temporary variable
cir::ConstantOp one = builder.getConstInt(
loc, mlir::cast<cir::IntType>(cgf.PtrDiffTy), 1);
loc, mlir::cast<cir::IntType>(cgf.ptrDiffTy), 1);
auto nextElement = cir::PtrStrideOp::create(
builder, loc, cirElementPtrType, currentElement, one);
cgf.emitStoreThroughLValue(RValue::get(nextElement), tmpLV);
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,12 @@ static mlir::Value emitCXXNewAllocSize(CIRGenFunction &cgf, const CXXNewExpr *e,
if (!e->isArray()) {
CharUnits typeSize = cgf.getContext().getTypeSizeInChars(type);
sizeWithoutCookie = cgf.getBuilder().getConstant(
loc, cir::IntAttr::get(cgf.SizeTy, typeSize.getQuantity()));
loc, cir::IntAttr::get(cgf.sizeTy, typeSize.getQuantity()));
return sizeWithoutCookie;
}

// The width of size_t.
unsigned sizeWidth = cgf.cgm.getDataLayout().getTypeSizeInBits(cgf.SizeTy);
unsigned sizeWidth = cgf.cgm.getDataLayout().getTypeSizeInBits(cgf.sizeTy);

// The number of elements can be have an arbitrary integer type;
// essentially, we need to multiply it by a constant factor, add a
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace {
class ConstExprEmitter;

static mlir::TypedAttr computePadding(CIRGenModule &cgm, CharUnits size) {
mlir::Type eltTy = cgm.UCharTy;
mlir::Type eltTy = cgm.uCharTy;
clang::CharUnits::QuantityType arSize = size.getQuantity();
CIRGenBuilderTy &bld = cgm.getBuilder();
if (size > CharUnits::One()) {
Expand Down
18 changes: 9 additions & 9 deletions clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,9 +762,9 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
// FIXME(cir): For now lets pretend we shouldn't use the conversion
// intrinsics and insert a cast here unconditionally.
src = builder.createCast(cgf.getLoc(loc), cir::CastKind::floating, src,
cgf.FloatTy);
cgf.floatTy);
srcType = cgf.getContext().FloatTy;
mlirSrcType = cgf.FloatTy;
mlirSrcType = cgf.floatTy;
}
}

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

Expand Down Expand Up @@ -2220,20 +2220,20 @@ mlir::Value ScalarExprEmitter::VisitUnaryExprOrTypeTraitExpr(
"sizeof operator for VariableArrayType",
e->getStmtClassName());
return builder.getConstant(
loc, cir::IntAttr::get(cgf.cgm.UInt64Ty,
loc, cir::IntAttr::get(cgf.cgm.uInt64Ty,
llvm::APSInt(llvm::APInt(64, 1), true)));
}
} else if (e->getKind() == UETT_OpenMPRequiredSimdAlign) {
cgf.getCIRGenModule().errorNYI(
e->getSourceRange(), "sizeof operator for OpenMpRequiredSimdAlign",
e->getStmtClassName());
return builder.getConstant(
loc, cir::IntAttr::get(cgf.cgm.UInt64Ty,
loc, cir::IntAttr::get(cgf.cgm.uInt64Ty,
llvm::APSInt(llvm::APInt(64, 1), true)));
}

return builder.getConstant(
loc, cir::IntAttr::get(cgf.cgm.UInt64Ty,
loc, cir::IntAttr::get(cgf.cgm.uInt64Ty,
e->EvaluateKnownConstInt(cgf.getContext())));
}

Expand Down Expand Up @@ -2329,14 +2329,14 @@ mlir::Value ScalarExprEmitter::VisitAbstractConditionalOperator(

mlir::Value lhs = Visit(lhsExpr);
if (!lhs) {
lhs = builder.getNullValue(cgf.VoidTy, loc);
lhs = builder.getNullValue(cgf.voidTy, loc);
lhsIsVoid = true;
}

mlir::Value rhs = Visit(rhsExpr);
if (lhsIsVoid) {
assert(!rhs && "lhs and rhs types must match");
rhs = builder.getNullValue(cgf.VoidTy, loc);
rhs = builder.getNullValue(cgf.voidTy, loc);
}

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

// Insert required yields.
for (mlir::OpBuilder::InsertPoint &toInsert : insertPoints) {
Expand Down
8 changes: 4 additions & 4 deletions clang/lib/CIR/CodeGen/CIRGenFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ CIRGenFunction::emitArrayLength(const clang::ArrayType *origArrayType,
if (isa<VariableArrayType>(arrayType)) {
assert(cir::MissingFeatures::vlas());
cgm.errorNYI(*currSrcLoc, "VLAs");
return builder.getConstInt(*currSrcLoc, SizeTy, 0);
return builder.getConstInt(*currSrcLoc, sizeTy, 0);
}

uint64_t countFromCLAs = 1;
Expand Down Expand Up @@ -1037,7 +1037,7 @@ CIRGenFunction::emitArrayLength(const clang::ArrayType *origArrayType,
}

baseType = eltType;
return builder.getConstInt(*currSrcLoc, SizeTy, countFromCLAs);
return builder.getConstInt(*currSrcLoc, sizeTy, countFromCLAs);
}

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

if (!numElements) {
numElements = vlaSize;
Expand Down Expand Up @@ -1188,7 +1188,7 @@ void CIRGenFunction::emitVariablyModifiedType(QualType type) {
// Always zexting here would be wrong if it weren't
// undefined behavior to have a negative bound.
// FIXME: What about when size's type is larger than size_t?
entry = builder.createIntCast(size, SizeTy);
entry = builder.createIntCast(size, sizeTy);
}
}
type = vat->getElementType();
Expand Down
10 changes: 5 additions & 5 deletions clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1846,13 +1846,13 @@ mlir::Value CIRGenItaniumCXXABI::getVirtualBaseClassOffset(
const CXXRecordDecl *classDecl, const CXXRecordDecl *baseClassDecl) {
CIRGenBuilderTy &builder = cgf.getBuilder();
mlir::Value vtablePtr = cgf.getVTablePtr(loc, thisAddr, classDecl);
mlir::Value vtableBytePtr = builder.createBitcast(vtablePtr, cgm.UInt8PtrTy);
mlir::Value vtableBytePtr = builder.createBitcast(vtablePtr, cgm.uInt8PtrTy);
CharUnits vbaseOffsetOffset =
cgm.getItaniumVTableContext().getVirtualBaseOffsetOffset(classDecl,
baseClassDecl);
mlir::Value offsetVal =
builder.getSInt64(vbaseOffsetOffset.getQuantity(), loc);
auto vbaseOffsetPtr = cir::PtrStrideOp::create(builder, loc, cgm.UInt8PtrTy,
auto vbaseOffsetPtr = cir::PtrStrideOp::create(builder, loc, cgm.uInt8PtrTy,
vtableBytePtr, offsetVal);

mlir::Value vbaseOffset;
Expand All @@ -1861,9 +1861,9 @@ mlir::Value CIRGenItaniumCXXABI::getVirtualBaseClassOffset(
cgm.errorNYI(loc, "getVirtualBaseClassOffset: relative layout");
} else {
mlir::Value offsetPtr = builder.createBitcast(
vbaseOffsetPtr, builder.getPointerTo(cgm.PtrDiffTy));
vbaseOffsetPtr, builder.getPointerTo(cgm.ptrDiffTy));
vbaseOffset = builder.createLoad(
loc, Address(offsetPtr, cgm.PtrDiffTy, cgf.getPointerAlign()));
loc, Address(offsetPtr, cgm.ptrDiffTy, cgf.getPointerAlign()));
}
return vbaseOffset;
}
Expand Down Expand Up @@ -2244,7 +2244,7 @@ Address CIRGenItaniumCXXABI::initializeArrayCookie(CIRGenFunction &cgf,

// Write the number of elements into the appropriate slot.
Address numElementsPtr =
cookiePtr.withElementType(cgf.getBuilder(), cgf.SizeTy);
cookiePtr.withElementType(cgf.getBuilder(), cgf.sizeTy);
cgf.getBuilder().createStore(loc, numElements, numElementsPtr);

// Finally, compute a pointer to the actual data buffer by skipping
Expand Down
Loading