File indexing completed on 2026-05-10 08:36:51
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_CLANG_CIR_DIALECT_BUILDER_CIRBASEBUILDER_H
0010 #define LLVM_CLANG_CIR_DIALECT_BUILDER_CIRBASEBUILDER_H
0011
0012 #include "clang/CIR/Dialect/IR/CIRAttrs.h"
0013
0014 #include "mlir/IR/Builders.h"
0015 #include "mlir/IR/BuiltinTypes.h"
0016 #include "mlir/IR/Types.h"
0017
0018 namespace cir {
0019
0020 class CIRBaseBuilderTy : public mlir::OpBuilder {
0021
0022 public:
0023 CIRBaseBuilderTy(mlir::MLIRContext &mlirContext)
0024 : mlir::OpBuilder(&mlirContext) {}
0025
0026 cir::PointerType getPointerTo(mlir::Type ty) {
0027 return cir::PointerType::get(getContext(), ty);
0028 }
0029
0030 cir::PointerType getVoidPtrTy() {
0031 return getPointerTo(cir::VoidType::get(getContext()));
0032 }
0033
0034 mlir::TypedAttr getConstPtrAttr(mlir::Type type, int64_t value) {
0035 auto valueAttr = mlir::IntegerAttr::get(
0036 mlir::IntegerType::get(type.getContext(), 64), value);
0037 return cir::ConstPtrAttr::get(
0038 getContext(), mlir::cast<cir::PointerType>(type), valueAttr);
0039 }
0040 };
0041
0042 }
0043
0044 #endif