================ @@ -0,0 +1,89 @@ +//==-- ABIArgInfo.h - Abstract info regarding ABI-specific arguments -------==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Defines ABIArgInfo and associated types used by CIR to track information +// regarding ABI-coerced types for function arguments and return values. This +// was moved to the common library as it might be used by both CIRGen and +// passes. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_CIR_ABIARGINFO_H +#define LLVM_CLANG_CIR_ABIARGINFO_H + +#include "MissingFeatures.h" +#include "mlir/IR/Types.h" + +namespace cir { + +class ABIArgInfo { +public: + enum Kind : uint8_t { + /// Pass the argument directly using the normal converted CIR type, + /// or by coercing to another specified type stored in 'CoerceToType'). If + /// an offset is specified (in UIntData), then the argument passed is offset + /// by some number of bytes in the memory representation. A dummy argument + /// is emitted before the real argument if the specified type stored in + /// "PaddingType" is not zero. + Direct, + + /// Ignore the argument (treat as void). Useful for void and empty + /// structs. + Ignore, + }; + +private: + mlir::Type typeData; + struct DirectAttrInfo { + unsigned offset; + unsigned align; + }; + union { + DirectAttrInfo directAttr; + }; + Kind theKind; + +public: + ABIArgInfo(Kind k = Direct) : directAttr{0, 0}, theKind(k) {} + + static ABIArgInfo getDirect(mlir::Type ty = nullptr) { + ABIArgInfo info(Direct); + info.setCoerceToType(ty); ---------------- Lancern wrote:
I missed this `assert`, thanks for pointing out! Added the `assert` back. https://github.com/llvm/llvm-project/pull/135552 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits