@@ -607,8 +607,8 @@ def CIR_ConditionOp : CIR_Op<"condition", [
607607//===----------------------------------------------------------------------===//
608608
609609defvar CIR_YieldableScopes = [
610- "ArrayCtor", "CaseOp", "DoWhileOp", "ForOp", "IfOp", "ScopeOp", "SwitchOp ",
611- "TernaryOp", "WhileOp"
610+ "ArrayCtor", "ArrayDtor", " CaseOp", "DoWhileOp", "ForOp", "IfOp", "ScopeOp",
611+ "SwitchOp", " TernaryOp", "WhileOp"
612612];
613613
614614def CIR_YieldOp : CIR_Op<"yield", [
@@ -1946,6 +1946,10 @@ def CIR_FuncOp : CIR_Op<"func", [
19461946 The function linkage information is specified by `linkage`, as defined by
19471947 `GlobalLinkageKind` attribute.
19481948
1949+ The `no_proto` keyword is used to identify functions that were declared
1950+ without a prototype and, consequently, may contain calls with invalid
1951+ arguments and undefined behavior.
1952+
19491953 Example:
19501954
19511955 ```mlir
@@ -1964,6 +1968,7 @@ def CIR_FuncOp : CIR_Op<"func", [
19641968 let arguments = (ins SymbolNameAttr:$sym_name,
19651969 CIR_VisibilityAttr:$global_visibility,
19661970 TypeAttrOf<CIR_FuncType>:$function_type,
1971+ UnitAttr:$no_proto,
19671972 UnitAttr:$dso_local,
19681973 DefaultValuedAttr<CIR_GlobalLinkageKind,
19691974 "cir::GlobalLinkageKind::ExternalLinkage">:$linkage,
@@ -2005,13 +2010,6 @@ def CIR_FuncOp : CIR_Op<"func", [
20052010 return getFunctionType().getReturnTypes();
20062011 }
20072012
2008- // TODO(cir): this should be an operand attribute, but for now we just hard-
2009- // wire this as a function. Will later add a $no_proto argument to this op.
2010- bool getNoProto() {
2011- assert(!cir::MissingFeatures::opFuncNoProto());
2012- return false;
2013- }
2014-
20152013 //===------------------------------------------------------------------===//
20162014 // SymbolOpInterface Methods
20172015 //===------------------------------------------------------------------===//
@@ -2229,7 +2227,7 @@ def CIR_TrapOp : CIR_Op<"trap", [Terminator]> {
22292227}
22302228
22312229//===----------------------------------------------------------------------===//
2232- // ArrayCtor
2230+ // ArrayCtor & ArrayDtor
22332231//===----------------------------------------------------------------------===//
22342232
22352233class CIR_ArrayInitDestroy<string mnemonic> : CIR_Op<mnemonic> {
@@ -2260,7 +2258,9 @@ def CIR_ArrayCtor : CIR_ArrayInitDestroy<"array.ctor"> {
22602258 let description = [{
22612259 Initialize each array element using the same C++ constructor. This
22622260 operation has one region, with one single block. The block has an
2263- incoming argument for the current array index to initialize.
2261+ incoming argument for the current array element to initialize.
2262+
2263+ Example:
22642264
22652265 ```mlir
22662266 cir.array.ctor(%0 : !cir.ptr<!cir.array<!rec_S x 42>>) {
@@ -2272,6 +2272,25 @@ def CIR_ArrayCtor : CIR_ArrayInitDestroy<"array.ctor"> {
22722272 }];
22732273}
22742274
2275+ def CIR_ArrayDtor : CIR_ArrayInitDestroy<"array.dtor"> {
2276+ let summary = "Destroy array elements with C++ dtors";
2277+ let description = [{
2278+ Destroy each array element using the same C++ destructor. This
2279+ operation has one region, with one single block. The block has an
2280+ incoming argument for the current array element to destruct.
2281+
2282+ Example:
2283+
2284+ ```mlir
2285+ cir.array.dtor(%0 : !cir.ptr<!cir.array<!rec_S x 42>>) {
2286+ ^bb0(%arg0: !cir.ptr<!rec_S>):
2287+ cir.call @some_dtor(%arg0) : (!cir.ptr<!rec_S>) -> ()
2288+ cir.yield
2289+ }
2290+ ```
2291+ }];
2292+ }
2293+
22752294//===----------------------------------------------------------------------===//
22762295// VecCreate
22772296//===----------------------------------------------------------------------===//
0 commit comments