Merge pull request #162 from wenhu1024/feat/target-cpu
[ventus][NFC] Pick VentusRISCVABI or RISCVABI conditionally according…
This commit is contained in:
commit
c8e4d01ce3
|
@ -11502,11 +11502,14 @@ ABIArgInfo VentusRISCVABIInfo::classifyArgumentType(QualType Ty,
|
|||
namespace {
|
||||
class RISCVTargetCodeGenInfo : public TargetCodeGenInfo {
|
||||
public:
|
||||
// TODO: Pick VentusRISCVABI or RISCVABI conditionally according to
|
||||
// Pick VentusRISCVABI or RISCVABI conditionally according to
|
||||
// target CPU.
|
||||
RISCVTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT, unsigned XLen,
|
||||
unsigned FLen)
|
||||
: TargetCodeGenInfo(std::make_unique<VentusRISCVABIInfo>(CGT, XLen)) {}
|
||||
CodeGen::CodeGenTypes &CGT;
|
||||
RISCVTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT, unsigned XLen, unsigned FLen)
|
||||
: TargetCodeGenInfo(CGT.getTarget().getTargetOpts().CPU == "ventus-gpgpu"
|
||||
? std::unique_ptr<ABIInfo>(std::make_unique<VentusRISCVABIInfo>(CGT, XLen))
|
||||
: std::unique_ptr<ABIInfo>(std::make_unique<RISCVABIInfo>(CGT, XLen, FLen))),
|
||||
CGT(CGT) {}
|
||||
|
||||
void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV,
|
||||
CodeGen::CodeGenModule &CGM) const override {
|
||||
|
@ -11530,8 +11533,10 @@ public:
|
|||
}
|
||||
unsigned getOpenCLKernelCallingConv() const override;
|
||||
};
|
||||
unsigned RISCVTargetCodeGenInfo::getOpenCLKernelCallingConv() const {
|
||||
return llvm::CallingConv::VENTUS_KERNEL;
|
||||
unsigned RISCVTargetCodeGenInfo::getOpenCLKernelCallingConv() const {
|
||||
if (CGT.getTarget().getTargetOpts().CPU == "ventus-gpgpu")
|
||||
return llvm::CallingConv::VENTUS_KERNEL;
|
||||
return TargetCodeGenInfo::getOpenCLKernelCallingConv();
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -no-opaque-pointers -triple riscv32-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s
|
||||
// RUN: %clang_cc1 -no-opaque-pointers -triple riscv32-unknown-unknown -target-cpu ventus-gpgpu -S -emit-llvm -o - %s | FileCheck %s
|
||||
|
||||
kernel void test_kernel(global int *out)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue