[clang] [CIR] cir.call with scalar return type (PR #135552)
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 14 11:13:04 PDT 2025
================
@@ -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() =
----------------
bcardosolopes wrote:
are these both paths tested?
https://github.com/llvm/llvm-project/pull/135552
More information about the cfe-commits
mailing list