================ @@ -0,0 +1,50 @@ +#include "TargetInfo.h" +#include "ABIInfo.h" +#include "CIRGenFunctionInfo.h" +#include "clang/CIR/MissingFeatures.h" + +using namespace clang; +using namespace clang::CIRGen; + +static bool testIfIsVoidTy(QualType ty) { + const auto *builtinTy = ty->getAs<BuiltinType>(); + return builtinTy && builtinTy->getKind() == BuiltinType::Void; +} + +namespace { + +class X8664ABIInfo : public ABIInfo { +public: + X8664ABIInfo(CIRGenTypes &cgt) : ABIInfo(cgt) {} + + void computeInfo(CIRGenFunctionInfo &funcInfo) const override; +}; + +class X8664TargetCIRGenInfo : public TargetCIRGenInfo { +public: + X8664TargetCIRGenInfo(CIRGenTypes &cgt) + : TargetCIRGenInfo(std::make_unique<X8664ABIInfo>(cgt)) {} +}; + +} // namespace + +void X8664ABIInfo::computeInfo(CIRGenFunctionInfo &funcInfo) const { + // Top level CIR has unlimited arguments and return types. Lowering for ABI + // specific concerns should happen during a lowering phase. Assume everything + // is direct for now. + assert(!cir::MissingFeatures::opCallArgs()); + + CanQualType retTy = funcInfo.getReturnType(); + if (testIfIsVoidTy(retTy)) + funcInfo.getReturnInfo() = cir::ABIArgInfo::getIgnore(); + else + funcInfo.getReturnInfo() = ---------------- Lancern wrote:
Yes, `clang/test/CIR/CodeGen/call.c` covers both call to function returning `void` and call to function returning non-`void`. 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