Skip to content

Commit

Permalink
[CIR][ABI][NFCI] Enable SPIR-V return value and argument ABI to use D…
Browse files Browse the repository at this point in the history
…irect and Extend (llvm#763)

This NFCI PR enhances the SPIR-V *CIRGen* ABI with Direct and Extend in
both argument and return value, because some future test cases requires
it.

* kernel argument metadata needs arguments of promotable integer types
* builtin functions like `get_global_id` returns `si64`, rather than
void for all OpenCL kernels

Given that CallConvLowering will replace these bits and other targets is
already doing the same, I think it's safe to enable it now.
  • Loading branch information
seven-mile authored Aug 1, 2024
1 parent 79acb05 commit 13ed46a
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions clang/lib/CIR/CodeGen/TargetInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,18 @@ class DefaultABIInfo : public ABIInfo {
if (RetTy->isVoidType())
return ABIArgInfo::getIgnore();

llvm_unreachable("Non-void return type NYI");
if (isAggregateTypeForABI(RetTy))
llvm_unreachable("NYI");

// Treat an enum type as its underlying type.
if (const EnumType *EnumTy = RetTy->getAs<EnumType>())
llvm_unreachable("NYI");

if (const auto *EIT = RetTy->getAs<BitIntType>())
llvm_unreachable("NYI");

return (isPromotableIntegerTypeForABI(RetTy) ? ABIArgInfo::getExtend(RetTy)
: ABIArgInfo::getDirect());
}

ABIArgInfo classifyArgumentType(QualType Ty) const {
Expand All @@ -65,11 +76,8 @@ class DefaultABIInfo : public ABIInfo {
if (const auto *EIT = Ty->getAs<BitIntType>())
llvm_unreachable("NYI");

if (isPromotableIntegerTypeForABI(Ty)) {
llvm_unreachable("ArgInfo integer extend NYI");
} else {
return ABIArgInfo::getDirect();
}
return (isPromotableIntegerTypeForABI(Ty) ? ABIArgInfo::getExtend(Ty)
: ABIArgInfo::getDirect());
}

void computeInfo(CIRGenFunctionInfo &FI) const override {
Expand Down

0 comments on commit 13ed46a

Please sign in to comment.