summaryrefslogtreecommitdiff
path: root/clang/lib/CIR/CodeGen/CIRGenBuilder.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenBuilder.h')
-rw-r--r--clang/lib/CIR/CodeGen/CIRGenBuilder.h31
1 files changed, 15 insertions, 16 deletions
diff --git a/clang/lib/CIR/CodeGen/CIRGenBuilder.h b/clang/lib/CIR/CodeGen/CIRGenBuilder.h
index d0b6b6918f0e..f855bdad2d7c 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuilder.h
+++ b/clang/lib/CIR/CodeGen/CIRGenBuilder.h
@@ -348,22 +348,6 @@ public:
return CIRBaseBuilderTy::createStore(loc, val, dst.getPointer(), align);
}
- mlir::Value createComplexCreate(mlir::Location loc, mlir::Value real,
- mlir::Value imag) {
- auto resultComplexTy = cir::ComplexType::get(real.getType());
- return create<cir::ComplexCreateOp>(loc, resultComplexTy, real, imag);
- }
-
- mlir::Value createComplexReal(mlir::Location loc, mlir::Value operand) {
- auto operandTy = mlir::cast<cir::ComplexType>(operand.getType());
- return create<cir::ComplexRealOp>(loc, operandTy.getElementType(), operand);
- }
-
- mlir::Value createComplexImag(mlir::Location loc, mlir::Value operand) {
- auto operandTy = mlir::cast<cir::ComplexType>(operand.getType());
- return create<cir::ComplexImagOp>(loc, operandTy.getElementType(), operand);
- }
-
/// Create a cir.complex.real_ptr operation that derives a pointer to the real
/// part of the complex value pointed to by the specified pointer value.
mlir::Value createComplexRealPtr(mlir::Location loc, mlir::Value value) {
@@ -378,6 +362,21 @@ public:
addr.getAlignment()};
}
+ /// Create a cir.complex.imag_ptr operation that derives a pointer to the
+ /// imaginary part of the complex value pointed to by the specified pointer
+ /// value.
+ mlir::Value createComplexImagPtr(mlir::Location loc, mlir::Value value) {
+ auto srcPtrTy = mlir::cast<cir::PointerType>(value.getType());
+ auto srcComplexTy = mlir::cast<cir::ComplexType>(srcPtrTy.getPointee());
+ return create<cir::ComplexImagPtrOp>(
+ loc, getPointerTo(srcComplexTy.getElementType()), value);
+ }
+
+ Address createComplexImagPtr(mlir::Location loc, Address addr) {
+ return Address{createComplexImagPtr(loc, addr.getPointer()),
+ addr.getAlignment()};
+ }
+
/// Create a cir.ptr_stride operation to get access to an array element.
/// \p idx is the index of the element to access, \p shouldDecay is true if
/// the result should decay to a pointer to the element type.