Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIR][CodeGen][NFCI] Target-independent ABI handling for SpirKernel call conv #778

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions clang/lib/CIR/CodeGen/CIRGenTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,11 +774,16 @@ const CIRGenFunctionInfo &CIRGenTypes::arrangeCIRFunctionInfo(
(void)inserted;
assert(inserted && "Recursively being processed?");

// Compute ABI inforamtion.
assert(info.getCC() != clang::CallingConv::CC_SpirFunction && "NYI");
assert(info.getCC() != CC_Swift && info.getCC() != CC_SwiftAsync &&
"Swift NYI");
getABIInfo().computeInfo(*FI);
// Compute ABI information.
if (CC == mlir::cir::CallingConv::SpirKernel) {
// Force target independent argument handling for the host visible
// kernel functions.
computeSPIRKernelABIInfo(CGM, *FI);
} else if (info.getCC() == CC_Swift || info.getCC() == CC_SwiftAsync) {
llvm_unreachable("Swift NYI");
} else {
getABIInfo().computeInfo(*FI);
}

// Loop over all of the computed argument and return value info. If any of
// them are direct or extend without a specified coerce type, specify the
Expand Down
10 changes: 10 additions & 0 deletions clang/lib/CIR/CodeGen/TargetInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,16 @@ class SPIRVABIInfo : public CommonSPIRABIInfo {
}
};
} // namespace

namespace cir {
void computeSPIRKernelABIInfo(CIRGenModule &CGM, CIRGenFunctionInfo &FI) {
if (CGM.getTarget().getTriple().isSPIRV())
SPIRVABIInfo(CGM.getTypes()).computeInfo(FI);
else
CommonSPIRABIInfo(CGM.getTypes()).computeInfo(FI);
}
} // namespace cir

namespace {

class CommonSPIRTargetCIRGenInfo : public TargetCIRGenInfo {
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/CIR/CodeGen/TargetInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ class TargetCIRGenInfo {
virtual ~TargetCIRGenInfo() {}
};

void computeSPIRKernelABIInfo(CIRGenModule &CGM, CIRGenFunctionInfo &FI);

} // namespace cir

#endif
Loading