@@ -48,15 +48,15 @@ mlir::LLVM::ConstantOp ConvertFIRToLLVMPattern::genI32Constant(
48
48
int value) const {
49
49
mlir::Type i32Ty = rewriter.getI32Type ();
50
50
mlir::IntegerAttr attr = rewriter.getI32IntegerAttr (value);
51
- return rewriter. create < mlir::LLVM::ConstantOp>( loc, i32Ty, attr);
51
+ return mlir::LLVM::ConstantOp::create (rewriter, loc, i32Ty, attr);
52
52
}
53
53
54
54
mlir::LLVM::ConstantOp ConvertFIRToLLVMPattern::genConstantOffset (
55
55
mlir::Location loc, mlir::ConversionPatternRewriter &rewriter,
56
56
int offset) const {
57
57
mlir::Type ity = lowerTy ().offsetType ();
58
58
mlir::IntegerAttr cattr = rewriter.getI32IntegerAttr (offset);
59
- return rewriter. create < mlir::LLVM::ConstantOp>( loc, ity, cattr);
59
+ return mlir::LLVM::ConstantOp::create (rewriter, loc, ity, cattr);
60
60
}
61
61
62
62
// / Perform an extension or truncation as needed on an integer value. Lowering
@@ -80,9 +80,9 @@ mlir::Value ConvertFIRToLLVMPattern::integerCast(
80
80
return rewriter.createOrFold <mlir::LLVM::SExtOp>(loc, ty, val);
81
81
} else {
82
82
if (toSize < fromSize)
83
- return rewriter. create < mlir::LLVM::TruncOp>( loc, ty, val);
83
+ return mlir::LLVM::TruncOp::create (rewriter, loc, ty, val);
84
84
if (toSize > fromSize)
85
- return rewriter. create < mlir::LLVM::SExtOp>( loc, ty, val);
85
+ return mlir::LLVM::SExtOp::create (rewriter, loc, ty, val);
86
86
}
87
87
return val;
88
88
}
@@ -100,16 +100,16 @@ mlir::Value ConvertFIRToLLVMPattern::getValueFromBox(
100
100
mlir::ConversionPatternRewriter &rewriter, int boxValue) const {
101
101
if (mlir::isa<mlir::LLVM::LLVMPointerType>(box.getType ())) {
102
102
auto pty = getLlvmPtrType (resultTy.getContext ());
103
- auto p = rewriter. create < mlir::LLVM::GEPOp> (
104
- loc, pty, boxTy.llvm , box,
103
+ auto p = mlir::LLVM::GEPOp::create (
104
+ rewriter, loc, pty, boxTy.llvm , box,
105
105
llvm::ArrayRef<mlir::LLVM::GEPArg>{0 , boxValue});
106
106
auto fldTy = getBoxEleTy (boxTy.llvm , {boxValue});
107
- auto loadOp = rewriter. create < mlir::LLVM::LoadOp>( loc, fldTy, p);
107
+ auto loadOp = mlir::LLVM::LoadOp::create (rewriter, loc, fldTy, p);
108
108
auto castOp = integerCast (loc, rewriter, resultTy, loadOp);
109
109
attachTBAATag (loadOp, boxTy.fir , nullptr , p);
110
110
return castOp;
111
111
}
112
- return rewriter. create < mlir::LLVM::ExtractValueOp>( loc, box, boxValue);
112
+ return mlir::LLVM::ExtractValueOp::create (rewriter, loc, box, boxValue);
113
113
}
114
114
115
115
// / Method to construct code sequence to get the triple for dimension `dim`
@@ -147,7 +147,7 @@ mlir::Value ConvertFIRToLLVMPattern::loadDimFieldFromBox(
147
147
" in memory" );
148
148
mlir::LLVM::GEPOp p = genGEP (loc, boxTy.llvm , rewriter, box, 0 ,
149
149
static_cast <int >(kDimsPosInBox ), dim, off);
150
- auto loadOp = rewriter. create < mlir::LLVM::LoadOp>( loc, ty, p);
150
+ auto loadOp = mlir::LLVM::LoadOp::create (rewriter, loc, ty, p);
151
151
attachTBAATag (loadOp, boxTy.fir , nullptr , p);
152
152
return loadOp;
153
153
}
@@ -158,12 +158,13 @@ mlir::Value ConvertFIRToLLVMPattern::getDimFieldFromBox(
158
158
if (mlir::isa<mlir::LLVM::LLVMPointerType>(box.getType ())) {
159
159
mlir::LLVM::GEPOp p = genGEP (loc, boxTy.llvm , rewriter, box, 0 ,
160
160
static_cast <int >(kDimsPosInBox ), dim, off);
161
- auto loadOp = rewriter. create < mlir::LLVM::LoadOp>( loc, ty, p);
161
+ auto loadOp = mlir::LLVM::LoadOp::create (rewriter, loc, ty, p);
162
162
attachTBAATag (loadOp, boxTy.fir , nullptr , p);
163
163
return loadOp;
164
164
}
165
- return rewriter.create <mlir::LLVM::ExtractValueOp>(
166
- loc, box, llvm::ArrayRef<std::int64_t >{kDimsPosInBox , dim, off});
165
+ return mlir::LLVM::ExtractValueOp::create (
166
+ rewriter, loc, box,
167
+ llvm::ArrayRef<std::int64_t >{kDimsPosInBox , dim, off});
167
168
}
168
169
169
170
mlir::Value ConvertFIRToLLVMPattern::getStrideFromBox (
@@ -251,10 +252,10 @@ mlir::Value ConvertFIRToLLVMPattern::genBoxAttributeCheck(
251
252
getValueFromBox (loc, boxTy, box, attrTy, rewriter, kAttributePosInBox );
252
253
mlir::LLVM::ConstantOp attrMask = genConstantOffset (loc, rewriter, maskValue);
253
254
auto maskRes =
254
- rewriter. create < mlir::LLVM::AndOp>( loc, attrTy, attribute, attrMask);
255
+ mlir::LLVM::AndOp::create (rewriter, loc, attrTy, attribute, attrMask);
255
256
mlir::LLVM::ConstantOp c0 = genConstantOffset (loc, rewriter, 0 );
256
- return rewriter. create < mlir::LLVM::ICmpOp>(loc, mlir::LLVM::ICmpPredicate::ne ,
257
- maskRes, c0);
257
+ return mlir::LLVM::ICmpOp::create (rewriter, loc ,
258
+ mlir::LLVM::ICmpPredicate::ne, maskRes, c0);
258
259
}
259
260
260
261
mlir::Value ConvertFIRToLLVMPattern::computeBoxSize (
@@ -281,10 +282,10 @@ mlir::Value ConvertFIRToLLVMPattern::computeBoxSize(
281
282
firBoxType.getBoxTypeWithNewShape (1 )))) &&
282
283
" descriptor layout requires adding padding for dim field" );
283
284
mlir::Value sizePerDim = genConstantOffset (loc, rewriter, sizePerDimCst);
284
- mlir::Value dimsSize = rewriter. create < mlir::LLVM::MulOp> (
285
- loc, sizePerDim.getType (), sizePerDim, rank);
286
- mlir::Value size = rewriter. create < mlir::LLVM::AddOp> (
287
- loc, scalarBoxSize.getType (), scalarBoxSize, dimsSize);
285
+ mlir::Value dimsSize = mlir::LLVM::MulOp::create (
286
+ rewriter, loc, sizePerDim.getType (), sizePerDim, rank);
287
+ mlir::Value size = mlir::LLVM::AddOp::create (
288
+ rewriter, loc, scalarBoxSize.getType (), scalarBoxSize, dimsSize);
288
289
return size;
289
290
}
290
291
@@ -324,18 +325,19 @@ mlir::Value ConvertFIRToLLVMPattern::genAllocaAndAddrCastWithType(
324
325
unsigned allocaAs = getAllocaAddressSpace (rewriter);
325
326
unsigned programAs = getProgramAddressSpace (rewriter);
326
327
327
- mlir::Value al = rewriter. create < mlir::LLVM::AllocaOp> (
328
- loc, ::getLlvmPtrType (llvmObjectTy.getContext (), allocaAs), llvmObjectTy ,
329
- size, alignment);
328
+ mlir::Value al = mlir::LLVM::AllocaOp::create (
329
+ rewriter, loc, ::getLlvmPtrType (llvmObjectTy.getContext (), allocaAs),
330
+ llvmObjectTy, size, alignment);
330
331
331
332
// if our allocation address space, is not the same as the program address
332
333
// space, then we must emit a cast to the program address space before use.
333
334
// An example case would be on AMDGPU, where the allocation address space is
334
335
// the numeric value 5 (private), and the program address space is 0
335
336
// (generic).
336
337
if (allocaAs != programAs) {
337
- al = rewriter.create <mlir::LLVM::AddrSpaceCastOp>(
338
- loc, ::getLlvmPtrType (llvmObjectTy.getContext (), programAs), al);
338
+ al = mlir::LLVM::AddrSpaceCastOp::create (
339
+ rewriter, loc, ::getLlvmPtrType (llvmObjectTy.getContext (), programAs),
340
+ al);
339
341
}
340
342
341
343
rewriter.restoreInsertionPoint (thisPt);
0 commit comments