[clang] [CIR] Emit calling convention on call sites (PR #230123)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 8 06:52:33 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clangir
Author: Konstantinos Parasyris (koparasy)
<details>
<summary>Changes</summary>
Adds calling convention on the call sites.
Note: I opted to execlude support for runtime calling convention (classic getRuntimeCC()) on calls to runtime functions created in CIR passes (EH, __cxa_atexit, __cxa_guard_*, dynamic_cast, global init). These keep the default C calling convention and are marked with TODO(cir) and `MissingFeatures::opFuncCallingConv()` for a follow-up.
---
Patch is 54.04 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/230123.diff
23 Files Affected:
- (modified) clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h (+10-5)
- (modified) clang/include/clang/CIR/Dialect/IR/CIRDialect.td (+1)
- (modified) clang/include/clang/CIR/Dialect/IR/CIROps.td (+9-1)
- (modified) clang/include/clang/CIR/Interfaces/CIROpInterfaces.td (+11)
- (modified) clang/lib/CIR/CodeGen/CIRGenCXX.cpp (+5-3)
- (modified) clang/lib/CIR/CodeGen/CIRGenCall.cpp (+13-16)
- (modified) clang/lib/CIR/CodeGen/CIRGenExpr.cpp (+4-1)
- (modified) clang/lib/CIR/CodeGen/CIRGenModule.cpp (+1)
- (modified) clang/lib/CIR/CodeGen/CIRGenVTables.cpp (+4-1)
- (modified) clang/lib/CIR/Dialect/IR/CIRDialect.cpp (+19)
- (modified) clang/lib/CIR/Dialect/Transforms/CXXABILowering.cpp (+11)
- (modified) clang/lib/CIR/Dialect/Transforms/EHABILowering.cpp (+10)
- (modified) clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp (+25-6)
- (modified) clang/lib/CIR/Dialect/Transforms/TargetLowering/LowerItaniumCXXABI.cpp (+5)
- (modified) clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp (+3-4)
- (added) clang/test/CIR/CodeGen/spir-call-calling-conv.cpp (+65)
- (added) clang/test/CIR/CodeGenOpenCL/call-calling-conv.cl (+31)
- (modified) clang/test/CIR/CodeGenSYCL/address-space-conversions.cpp (+16-18)
- (added) clang/test/CIR/CodeGenSYCL/call-calling-conv.cpp (+38)
- (modified) clang/test/CIR/CodeGenSYCL/local-temporaries.cpp (+11-11)
- (added) clang/test/CIR/IR/call-calling-conv.cir (+39)
- (added) clang/test/CIR/Lowering/call-calling-conv.cir (+40)
- (modified) clang/test/CIR/Transforms/flatten-preserve-attrs.cir (+20)
``````````diff
diff --git a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
index 36d583cfe9fbe..badab8e711cfe 100644
--- a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
+++ b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
@@ -577,9 +577,12 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
mlir::Type returnType, mlir::ValueRange operands,
llvm::ArrayRef<mlir::NamedAttribute> attrs = {},
llvm::ArrayRef<mlir::NamedAttrList> argAttrs = {},
- llvm::ArrayRef<mlir::NamedAttribute> resAttrs = {}) {
+ llvm::ArrayRef<mlir::NamedAttribute> resAttrs = {},
+ cir::CallingConv callingConv = cir::CallingConv::C) {
auto op = cir::CallOp::create(*this, loc, callee, returnType, operands);
op->setAttrs(attrs);
+ if (callingConv != cir::CallingConv::C)
+ op.setCallingConv(callingConv);
if (!argAttrs.empty()) {
llvm::SmallVector<mlir::Attribute> argDictAttrs;
@@ -605,10 +608,11 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
mlir::ValueRange operands,
llvm::ArrayRef<mlir::NamedAttribute> attrs = {},
llvm::ArrayRef<mlir::NamedAttrList> argAttrs = {},
- llvm::ArrayRef<mlir::NamedAttribute> resAttrs = {}) {
+ llvm::ArrayRef<mlir::NamedAttribute> resAttrs = {},
+ cir::CallingConv callingConv = cir::CallingConv::C) {
return createCallOp(loc, mlir::SymbolRefAttr::get(callee),
callee.getFunctionType().getReturnType(), operands,
- attrs, argAttrs, resAttrs);
+ attrs, argAttrs, resAttrs, callingConv);
}
cir::CallOp
@@ -616,12 +620,13 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
cir::FuncType funcType, mlir::ValueRange operands,
llvm::ArrayRef<mlir::NamedAttribute> attrs = {},
llvm::ArrayRef<mlir::NamedAttrList> argAttrs = {},
- llvm::ArrayRef<mlir::NamedAttribute> resAttrs = {}) {
+ llvm::ArrayRef<mlir::NamedAttribute> resAttrs = {},
+ cir::CallingConv callingConv = cir::CallingConv::C) {
llvm::SmallVector<mlir::Value> resOperands{indirectTarget};
resOperands.append(operands.begin(), operands.end());
return createCallOp(loc, mlir::SymbolRefAttr(), funcType.getReturnType(),
- resOperands, attrs, argAttrs, resAttrs);
+ resOperands, attrs, argAttrs, resAttrs, callingConv);
}
cir::CallOp createCallOp(mlir::Location loc, mlir::SymbolRefAttr callee,
diff --git a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
index 70647fa194329..2086646949a11 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
@@ -47,6 +47,7 @@ def CIR_Dialect : Dialect {
static llvm::StringRef getIntTypeWidthAttrName() { return "cir.int_type_width"; }
static llvm::StringRef getOptInfoAttrName() { return "cir.opt_info"; }
static llvm::StringRef getCalleeAttrName() { return "callee"; }
+ static llvm::StringRef getCallingConvAttrName() { return "calling_conv"; }
static llvm::StringRef getNoThrowAttrName() { return "nothrow"; }
static llvm::StringRef getNoReturnAttrName() { return "noreturn"; }
static llvm::StringRef getMemoryEffectsAttrName() { return "memory_effects"; }
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index bd8043dc42a05..1b51fdad79f40 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -4682,7 +4682,9 @@ class CIR_CallOpBase<string mnemonic, list<Trait> extra_traits = []>
UnitAttr:$musttail,
OptionalAttr<CIR_MemoryEffectsAttr>:$memory_effects,
OptionalAttr<DictArrayAttr>:$arg_attrs,
- OptionalAttr<DictArrayAttr>:$res_attrs
+ OptionalAttr<DictArrayAttr>:$res_attrs,
+ DefaultValuedAttr<CIR_CallingConvAttr, "cir::CallingConv::C">
+ :$calling_conv
);
}
@@ -4701,10 +4703,16 @@ def CIR_CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> {
empty. The first operand of this operation must be a pointer to the callee
function. The rest operands are arguments to the callee function.
+ The `calling_conv` attribute specifies the calling convention used at the
+ call site. It defaults to `CallingConv::C`, which is omitted when printed.
+ Other calling conventions are printed as `cc(<mnemonic>)`, e.g.
+ `cc(spir_function)`.
+
Example:
```
%0 = cir.call @foo()
+ cir.call @bar() cc(spir_function) : () -> ()
```
}];
diff --git a/clang/include/clang/CIR/Interfaces/CIROpInterfaces.td b/clang/include/clang/CIR/Interfaces/CIROpInterfaces.td
index 52aa1b9fe1b43..1563fc5aa00da 100644
--- a/clang/include/clang/CIR/Interfaces/CIROpInterfaces.td
+++ b/clang/include/clang/CIR/Interfaces/CIROpInterfaces.td
@@ -73,6 +73,17 @@ let cppNamespace = "::cir" in {
/*defaultImplementation=*/[{
return $_op.getInlineKindAttrName();
}]>,
+ InterfaceMethod<"Return the calling convention of the call site",
+ "cir::CallingConv", "getCallingConv", (ins), [{}],
+ /*defaultImplementation=*/[{
+ return $_op.getCallingConv();
+ }]>,
+ InterfaceMethod<"Set the calling convention of the call site",
+ "void", "setCallingConv",
+ (ins "cir::CallingConv":$callingConv), [{}],
+ /*defaultImplementation=*/[{
+ $_op.setCallingConv(callingConv);
+ }]>,
];
}
diff --git a/clang/lib/CIR/CodeGen/CIRGenCXX.cpp b/clang/lib/CIR/CodeGen/CIRGenCXX.cpp
index eae118ddf1104..e842500e5ba56 100644
--- a/clang/lib/CIR/CodeGen/CIRGenCXX.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenCXX.cpp
@@ -206,9 +206,11 @@ static void emitDeclDestroy(CIRGenFunction &cgf, const VarDecl *vd,
mlir::cast<cir::PointerType>(thisAddr.getType()).getAddrSpace());
if (realPtrTy != thisAddr.getType())
thisAddr = builder.createBitcast(thisAddr.getLoc(), thisAddr, realPtrTy);
- builder.createCallOp(cgf.getLoc(vd->getSourceRange()),
- mlir::FlatSymbolRefAttr::get(fnOp.getSymNameAttr()),
- mlir::ValueRange{thisAddr});
+ // Make sure the call and the callee agree on calling convention.
+ builder.createCallOp(cgf.getLoc(vd->getSourceRange()), fnOp,
+ mlir::ValueRange{thisAddr}, /*attrs=*/{},
+ /*argAttrs=*/{}, /*resAttrs=*/{},
+ fnOp.getCallingConv());
assert(fnOp && "expected cir.func");
// TODO(cir): This doesn't do anything but check for unhandled conditions.
// What it is meant to do should really be happening in LoweringPrepare.
diff --git a/clang/lib/CIR/CodeGen/CIRGenCall.cpp b/clang/lib/CIR/CodeGen/CIRGenCall.cpp
index 4f4e10aa218be..6e67dc1372297 100644
--- a/clang/lib/CIR/CodeGen/CIRGenCall.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenCall.cpp
@@ -1165,14 +1165,13 @@ void CIRGenFunction::emitNonNullArgCheck(RValue rv, QualType argType,
cgm.errorNYI("non-null arg check is NYI");
}
-static cir::CIRCallOpInterface
-emitCallLikeOp(CIRGenFunction &cgf, mlir::Location callLoc,
- cir::FuncType indirectFuncTy, mlir::Value indirectFuncVal,
- cir::FuncOp directFuncOp,
- const SmallVectorImpl<mlir::Value> &cirCallArgs, bool isInvoke,
- const mlir::NamedAttrList &attrs,
- llvm::ArrayRef<mlir::NamedAttrList> argAttrs,
- const mlir::NamedAttrList &retAttrs) {
+static cir::CIRCallOpInterface emitCallLikeOp(
+ CIRGenFunction &cgf, mlir::Location callLoc, cir::FuncType indirectFuncTy,
+ mlir::Value indirectFuncVal, cir::FuncOp directFuncOp,
+ const SmallVectorImpl<mlir::Value> &cirCallArgs, bool isInvoke,
+ const mlir::NamedAttrList &attrs,
+ llvm::ArrayRef<mlir::NamedAttrList> argAttrs,
+ const mlir::NamedAttrList &retAttrs, cir::CallingConv callingConv) {
CIRGenBuilderTy &builder = cgf.getBuilder();
assert(!cir::MissingFeatures::opCallSurroundingTry());
@@ -1181,13 +1180,12 @@ emitCallLikeOp(CIRGenFunction &cgf, mlir::Location callLoc,
cir::CallOp op;
if (indirectFuncTy) {
- // TODO(cir): Set calling convention for indirect calls.
- assert(!cir::MissingFeatures::opCallCallConv());
op = builder.createIndirectCallOp(callLoc, indirectFuncVal, indirectFuncTy,
- cirCallArgs, attrs, argAttrs, retAttrs);
+ cirCallArgs, attrs, argAttrs, retAttrs,
+ callingConv);
} else {
op = builder.createCallOp(callLoc, directFuncOp, cirCallArgs, attrs,
- argAttrs, retAttrs);
+ argAttrs, retAttrs, callingConv);
}
return op;
@@ -1341,7 +1339,6 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo &funcInfo,
if (auto calleeFuncOp = dyn_cast<cir::FuncOp>(calleePtr))
funcName = calleeFuncOp.getName();
- assert(!cir::MissingFeatures::opCallCallConv());
assert(!cir::MissingFeatures::opCallAttrs());
cir::CallingConv callingConv;
cgm.constructAttributeList(funcName, funcInfo, callee.getAbstractInfo(),
@@ -1405,9 +1402,9 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo &funcInfo,
bool isInvoke = !cannotThrow && isCatchOrCleanupRequired();
mlir::Location callLoc = loc;
- cir::CIRCallOpInterface theCall =
- emitCallLikeOp(*this, loc, indirectFuncTy, indirectFuncVal, directFuncOp,
- cirCallArgs, isInvoke, attrs, argAttrs, retAttrs);
+ cir::CIRCallOpInterface theCall = emitCallLikeOp(
+ *this, loc, indirectFuncTy, indirectFuncVal, directFuncOp, cirCallArgs,
+ isInvoke, attrs, argAttrs, retAttrs, callingConv);
if (callOp)
*callOp = theCall;
diff --git a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
index c03f7b355b695..8948c0723fbc2 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
@@ -2026,7 +2026,10 @@ static void pushTemporaryCleanup(CIRGenFunction &cgf,
} else {
GlobalDecl gd(referenceTemporaryDtor, Dtor_Complete);
cir::FuncOp dtorFn = cgm.getAddrAndTypeOfCXXStructor(gd).second;
- builder.createCallOp(loc, dtorFn, mlir::ValueRange{tempAddr});
+ // Make sure the call and the callee agree on calling convention.
+ builder.createCallOp(loc, dtorFn, mlir::ValueRange{tempAddr},
+ /*attrs=*/{}, /*argAttrs=*/{}, /*resAttrs=*/{},
+ dtorFn.getCallingConv());
}
break;
}
diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
index 1b17ad636829d..793f81c3b0952 100644
--- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
@@ -2156,6 +2156,7 @@ void CIRGenModule::replaceUsesOfNonProtoTypeWithRealFunction(
realCallOp = builder.createIndirectCallOp(
noProtoCallOp.getLoc(), casted, callFnType, callOperands);
}
+ realCallOp.setCallingConv(noProtoCallOp.getCallingConv());
// Replace old no proto call with fixed call.
noProtoCallOp.replaceAllUsesWith(realCallOp);
diff --git a/clang/lib/CIR/CodeGen/CIRGenVTables.cpp b/clang/lib/CIR/CodeGen/CIRGenVTables.cpp
index f4c386762a1d3..12a7e9a2a66e0 100644
--- a/clang/lib/CIR/CodeGen/CIRGenVTables.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenVTables.cpp
@@ -829,7 +829,10 @@ void CIRGenFunction::emitMustTailThunk(GlobalDecl gd,
cir::FuncType calleeTy = callee.getFunctionType();
mlir::Type retTy = calleeTy.getReturnType();
- cir::CallOp call = builder.createCallOp(loc, callee, args);
+ assert(!cir::MissingFeatures::opCallAttrs());
+ cir::CallOp call =
+ builder.createCallOp(loc, callee, args, /*attrs=*/{}, /*argAttrs=*/{},
+ /*resAttrs=*/{}, curFnInfo->getCallingConvention());
call->setAttr(cir::CIRDialect::getMustTailAttrName(),
mlir::UnitAttr::get(builder.getContext()));
diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
index 2c5b785d5fc34..a376a668f157b 100644
--- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
+++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
@@ -1388,6 +1388,20 @@ static mlir::ParseResult parseCallCommon(mlir::OpAsmParser &parser,
return ::mlir::failure();
}
+ if (parser.parseOptionalKeyword("cc").succeeded()) {
+ cir::CallingConv callingConv;
+ if (parser.parseLParen().failed())
+ return failure();
+ if (parseCIRKeyword<cir::CallingConv>(parser, callingConv).failed())
+ return parser.emitError(parser.getCurrentLocation(),
+ "unknown calling convention");
+ if (parser.parseRParen().failed())
+ return failure();
+ result.addAttribute(
+ CIRDialect::getCallingConvAttrName(),
+ cir::CallingConvAttr::get(parser.getContext(), callingConv));
+ }
+
if (parser.parseOptionalKeyword("musttail").succeeded())
result.addAttribute(CIRDialect::getMustTailAttrName(),
mlir::UnitAttr::get(parser.getContext()));
@@ -1495,6 +1509,10 @@ static void printCallCommon(mlir::Operation *op,
printer << tryCall.getUnwindDest();
}
+ cir::CallingConv callingConv = callLikeOp.getCallingConv();
+ if (callingConv != cir::CallingConv::C)
+ printer << " cc(" << stringifyCallingConv(callingConv) << ")";
+
if (op->hasAttr(CIRDialect::getMustTailAttrName()))
printer << " musttail";
@@ -1509,6 +1527,7 @@ static void printCallCommon(mlir::Operation *op,
llvm::StringRef elidedAttrs[] = {
CIRDialect::getCalleeAttrName(),
+ CIRDialect::getCallingConvAttrName(),
CIRDialect::getMustTailAttrName(),
CIRDialect::getNoThrowAttrName(),
CIRDialect::getNoUnwindAttrName(),
diff --git a/clang/lib/CIR/Dialect/Transforms/CXXABILowering.cpp b/clang/lib/CIR/Dialect/Transforms/CXXABILowering.cpp
index af25d662dbb5d..a6bf33fddafc7 100644
--- a/clang/lib/CIR/Dialect/Transforms/CXXABILowering.cpp
+++ b/clang/lib/CIR/Dialect/Transforms/CXXABILowering.cpp
@@ -702,6 +702,15 @@ mlir::LogicalResult CIRDeleteArrayOpABILowering::matchAndRewrite(
// exception handling flow will be connected to the cleanup region here to
// call the delete operator on the exception path.
mlir::FlatSymbolRefAttr dtorFn = op.getElementDtorAttr();
+
+ // Make sure the calls and the callees agree on calling convention.
+ auto getCalleeCallingConv = [&](mlir::FlatSymbolRefAttr callee) {
+ if (auto fn =
+ mlir::SymbolTable::lookupNearestSymbolFrom<cir::FuncOp>(op, callee))
+ return fn.getCallingConv();
+ return cir::CallingConv::C;
+ };
+
cir::CleanupKind cleanupKind =
op.getDtorMayThrow() ? cir::CleanupKind::All : cir::CleanupKind::Normal;
cir::CleanupScopeOp::create(
@@ -717,6 +726,7 @@ mlir::LogicalResult CIRDeleteArrayOpABILowering::matchAndRewrite(
bb.getInsertionBlock()->addArgument(eltPtrTy, ll);
auto dtorCall = cir::CallOp::create(
bb, ll, dtorFn, cir::VoidType(), mlir::ValueRange{arg});
+ dtorCall.setCallingConv(getCalleeCallingConv(dtorFn));
if (!op.getDtorMayThrow())
dtorCall.setNothrowAttr(bb.getUnitAttr());
cir::YieldOp::create(bb, ll);
@@ -750,6 +760,7 @@ mlir::LogicalResult CIRDeleteArrayOpABILowering::matchAndRewrite(
auto deleteCall =
cir::CallOp::create(b, l, deleteFn, cir::VoidType(), callArgs);
+ deleteCall.setCallingConv(getCalleeCallingConv(deleteFn));
// operator delete[] is implicitly nothrow per [basic.stc.dynamic],
// matching classic CodeGen's `nounwind` attribute on the call.
deleteCall.setNothrowAttr(b.getUnitAttr());
diff --git a/clang/lib/CIR/Dialect/Transforms/EHABILowering.cpp b/clang/lib/CIR/Dialect/Transforms/EHABILowering.cpp
index 72a8cffc3b060..4b765b1f75fca 100644
--- a/clang/lib/CIR/Dialect/Transforms/EHABILowering.cpp
+++ b/clang/lib/CIR/Dialect/Transforms/EHABILowering.cpp
@@ -221,6 +221,8 @@ void ItaniumEHLowering::ensureRuntimeDecls(mlir::Location loc) {
/// unreachable;
/// }
void ItaniumEHLowering::ensureClangCallTerminate(mlir::Location loc) {
+ // TODO(cir): set the runtime calling convention on the runtime calls below.
+ assert(!cir::MissingFeatures::opFuncCallingConv());
if (clangCallTerminateFunc)
return;
@@ -302,6 +304,8 @@ void ItaniumEHLowering::ensureCxaCallUnexpectedDecl(mlir::Location loc) {
/// Create a terminate landing pad block at the end of the specified function.
mlir::Block *ItaniumEHLowering::buildTerminateBlock(cir::FuncOp funcOp,
mlir::Location loc) {
+ // TODO(cir): set the runtime calling convention on the runtime calls below.
+ assert(!cir::MissingFeatures::opFuncCallingConv());
assert(clangCallTerminateFunc &&
"ensureClangCallTerminate must run before buildTerminateBlock");
mlir::Region &body = funcOp.getRegion();
@@ -495,6 +499,8 @@ mlir::LogicalResult ItaniumEHLowering::lowerEhInitiate(
cir::EhInitiateOp initiateOp,
llvm::ArrayRef<cir::EhDispatchOp> reachedDispatches, bool reachesCleanup,
EhTokenMap &ehTokenMap) {
+ // TODO(cir): set the runtime calling convention on the runtime calls below.
+ assert(!cir::MissingFeatures::opFuncCallingConv());
mlir::Value rootToken = initiateOp.getEhToken();
// The catch clauses for this landing pad come from the dispatches its
@@ -826,6 +832,8 @@ ItaniumEHLowering::resolveCatchCopyThunk(cir::ConstructCatchParamOp op) {
mlir::LogicalResult
ItaniumEHLowering::lowerConstructCatchParam(cir::ConstructCatchParamOp op,
mlir::Value exnPtr) {
+ // TODO(cir): set the runtime calling convention on the runtime calls below.
+ assert(!cir::MissingFeatures::opFuncCallingConv());
mlir::Location loc = op.getLoc();
mlir::Value paramAddr = op.getParamAddr();
cir::PointerType paramAddrType =
@@ -913,6 +921,8 @@ ItaniumEHLowering::lowerConstructCatchParam(cir::ConstructCatchParamOp op,
/// type_info and dtor pointers from their symbol attributes, bitcasting
/// each to !cir.ptr<!void> as required by the runtime function signature.
mlir::LogicalResult ItaniumEHLowering::lowerTryThrow(cir::TryThrowOp op) {
+ // TODO(cir): set the runtime calling convention on the runtime calls below.
+ assert(!cir::MissingFeatures::opFuncCallingConv());
mlir::Location loc = op.getLoc();
mlir::Block *normalDest = op.getNormalDest();
mlir::Block *unwindDest = op.getUnwindDest();
diff --git a/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp b/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp
index 3646821ad4b16..f0fdbcb99c1e4 100644
--- a/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp
+++ b/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp
@@ -400,6 +400,9 @@ struct LoweringPreparePass
cir::GlobalOp global,
mlir::Region &dtorRegion, bool tls,
mlir::Block &entryBB) {
+ // TODO(cir): set the runtime calling convention on the __cxa_atexit call.
+ assert(!cir::MissingFeatures::opFuncCallingConv());
+
// Create a variable that binds the atexit to this shared object.
builder.setInsertionPointToStart(&mlirModule.getBodyRegion().front());
cir::GlobalOp handle = getOrCreateRuntimeVariable(
@@ -466,6 +469,9 @@ struct LoweringPreparePass
cir::PointerType guardPtrTy, bool threadsafe) {
auto loc = globalOp->getLoc();
+ // TODO(cir): set the runtime calling convention on the __cxa_guard_* calls.
+ asse...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/230123
More information about the cfe-commits
mailing list