[clang] [CIR] Upstream minimal builtin function call support (PR #142981)
Sirui Mu via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 10 20:51:05 PDT 2025
================
@@ -229,6 +231,19 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
cir::IntType getUInt32Ty() { return typeCache.UInt32Ty; }
cir::IntType getUInt64Ty() { return typeCache.UInt64Ty; }
+ cir::ConstantOp getConstInt(mlir::Location loc, llvm::APSInt intVal);
+
+ cir::ConstantOp getConstInt(mlir::Location loc, llvm::APInt intVal);
+
+ cir::ConstantOp getConstInt(mlir::Location loc, mlir::Type t, uint64_t c);
+
+ cir::ConstantOp getConstFP(mlir::Location loc, mlir::Type t,
+ llvm::APFloat fpVal) {
+ assert(mlir::isa<cir::CIRFPTypeInterface>(t) &&
+ "expected floating point type");
+ return create<cir::ConstantOp>(loc, getAttr<cir::FPAttr>(t, fpVal));
+ }
----------------
Lancern wrote:
The implementation of `getConstInt` and `getConstFP` looks very similar, yet `getConstInt` is defined in `CIRGenBuilder.cpp` while `getConstFP` is defined in the header. Can we make it consistent?
https://github.com/llvm/llvm-project/pull/142981
More information about the cfe-commits
mailing list