================ @@ -3415,4 +3415,81 @@ def CIR_FAbsOp : CIR_UnaryFPToFPBuiltinOp<"fabs", "FAbsOp"> { }]; } +//===----------------------------------------------------------------------===// +// Variadic Operations +//===----------------------------------------------------------------------===// + +def CIR_VAStartOp : CIR_Op<"va.start"> { + let summary = "Starts a variable argument list"; + let description = [{ + The cir.va.start operation models the C/C++ va_start macro by + initializing a variable argument list at the given va_list storage + location. + + The operand must be a pointer to the target's `va_list` representation. + This operation has no results and produces its effect by mutating the + storage referenced by the pointer operand. + + Each `cir.va.start` must be paired with a corresponding `cir.va.end` + on the same logical `va_list` object along all control-flow paths. After + `cir.va.end`, the `va_list` must not be accessed unless reinitialized + with another `cir.va.start`. + + Lowering typically maps this to the LLVM intrinsic `llvm.va_start`, ---------------- bcardosolopes wrote:
I remember some issues with va_arg (where OG might not lower to the LLVM intrinsic - https://github.com/llvm/clangir/issues/862), I'm not sure about `va.start` though. https://github.com/llvm/llvm-project/pull/153819 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits