[hip] Allow the declaration of functions with variadic arguments in HIP.
Summary: - As variadic parameters have the lowest rank in overload resolution, without real usage of `va_arg`, they are commonly used as the catch-all fallbacks in SFINAE. As the front-end still reports errors on calls to `va_arg`, the declaration of functions with variadic arguments should be allowed in general. Reviewers: jlebar, tra, yaxunl Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69389
This commit is contained in:
parent
0eb8a52aee
commit
5a48678a6a
|
@ -7694,6 +7694,8 @@ public:
|
||||||
ABIArgInfo classifyArgumentType(QualType Ty, unsigned &NumRegsLeft) const;
|
ABIArgInfo classifyArgumentType(QualType Ty, unsigned &NumRegsLeft) const;
|
||||||
|
|
||||||
void computeInfo(CGFunctionInfo &FI) const override;
|
void computeInfo(CGFunctionInfo &FI) const override;
|
||||||
|
Address EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
|
||||||
|
QualType Ty) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool AMDGPUABIInfo::isHomogeneousAggregateBaseType(QualType Ty) const {
|
bool AMDGPUABIInfo::isHomogeneousAggregateBaseType(QualType Ty) const {
|
||||||
|
@ -7757,6 +7759,11 @@ void AMDGPUABIInfo::computeInfo(CGFunctionInfo &FI) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Address AMDGPUABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
|
||||||
|
QualType Ty) const {
|
||||||
|
llvm_unreachable("AMDGPU does not support varargs");
|
||||||
|
}
|
||||||
|
|
||||||
ABIArgInfo AMDGPUABIInfo::classifyReturnType(QualType RetTy) const {
|
ABIArgInfo AMDGPUABIInfo::classifyReturnType(QualType RetTy) const {
|
||||||
if (isAggregateTypeForABI(RetTy)) {
|
if (isAggregateTypeForABI(RetTy)) {
|
||||||
// Records with non-trivial destructors/copy-constructors should not be
|
// Records with non-trivial destructors/copy-constructors should not be
|
||||||
|
|
|
@ -5334,6 +5334,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
CmdArgs.push_back("-fcuda-short-ptr");
|
CmdArgs.push_back("-fcuda-short-ptr");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsHIP)
|
||||||
|
CmdArgs.push_back("-fcuda-allow-variadic-functions");
|
||||||
|
|
||||||
// OpenMP offloading device jobs take the argument -fopenmp-host-ir-file-path
|
// OpenMP offloading device jobs take the argument -fopenmp-host-ir-file-path
|
||||||
// to specify the result of the compile phase on the host, so the meaningful
|
// to specify the result of the compile phase on the host, so the meaningful
|
||||||
// device declarations can be identified. Also, -fopenmp-is-device is passed
|
// device declarations can be identified. Also, -fopenmp-is-device is passed
|
||||||
|
|
|
@ -296,6 +296,8 @@ void HIPToolChain::addClangTargetOptions(
|
||||||
options::OPT_fno_gpu_allow_device_init, false))
|
options::OPT_fno_gpu_allow_device_init, false))
|
||||||
CC1Args.push_back("-fgpu-allow-device-init");
|
CC1Args.push_back("-fgpu-allow-device-init");
|
||||||
|
|
||||||
|
CC1Args.push_back("-fcuda-allow-variadic-functions");
|
||||||
|
|
||||||
// Default to "hidden" visibility, as object level linking will not be
|
// Default to "hidden" visibility, as object level linking will not be
|
||||||
// supported for the foreseeable future.
|
// supported for the foreseeable future.
|
||||||
if (!DriverArgs.hasArg(options::OPT_fvisibility_EQ,
|
if (!DriverArgs.hasArg(options::OPT_fvisibility_EQ,
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
||||||
// CHECK-SAME: "-emit-llvm-bc"
|
// CHECK-SAME: "-emit-llvm-bc"
|
||||||
// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803"
|
// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803"
|
||||||
// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden"
|
// CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
|
||||||
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
||||||
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
||||||
// CHECK-SAME: {{.*}} "-o" [[A_BC_803:".*bc"]] "-x" "hip"
|
// CHECK-SAME: {{.*}} "-o" [[A_BC_803:".*bc"]] "-x" "hip"
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
||||||
// CHECK-SAME: "-emit-llvm-bc"
|
// CHECK-SAME: "-emit-llvm-bc"
|
||||||
// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx900"
|
// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx900"
|
||||||
// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden"
|
// CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
|
||||||
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
||||||
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
||||||
// CHECK-SAME: {{.*}} "-o" [[A_BC_900:".*bc"]] "-x" "hip"
|
// CHECK-SAME: {{.*}} "-o" [[A_BC_900:".*bc"]] "-x" "hip"
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
||||||
// CHECK-SAME: "-emit-llvm-bc"
|
// CHECK-SAME: "-emit-llvm-bc"
|
||||||
// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803"
|
// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803"
|
||||||
// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden"
|
// CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
|
||||||
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
||||||
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
||||||
// CHECK-SAME: {{.*}} "-o" [[B_BC_803:".*bc"]] "-x" "hip"
|
// CHECK-SAME: {{.*}} "-o" [[B_BC_803:".*bc"]] "-x" "hip"
|
||||||
|
@ -120,7 +120,7 @@
|
||||||
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
||||||
// CHECK-SAME: "-emit-llvm-bc"
|
// CHECK-SAME: "-emit-llvm-bc"
|
||||||
// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx900"
|
// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx900"
|
||||||
// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden"
|
// CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
|
||||||
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
||||||
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
||||||
// CHECK-SAME: {{.*}} "-o" [[B_BC_900:".*bc"]] "-x" "hip"
|
// CHECK-SAME: {{.*}} "-o" [[B_BC_900:".*bc"]] "-x" "hip"
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
||||||
// CHECK-SAME: "-emit-llvm-bc"
|
// CHECK-SAME: "-emit-llvm-bc"
|
||||||
// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803"
|
// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803"
|
||||||
// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fvisibility" "hidden"
|
// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
|
||||||
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
||||||
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
||||||
// CHECK-SAME: {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip"
|
// CHECK-SAME: {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip"
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
||||||
// CHECK-SAME: "-emit-llvm-bc"
|
// CHECK-SAME: "-emit-llvm-bc"
|
||||||
// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803"
|
// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803"
|
||||||
// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fvisibility" "hidden"
|
// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
|
||||||
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
||||||
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
||||||
// CHECK-SAME: {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip"
|
// CHECK-SAME: {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip"
|
||||||
|
|
Loading…
Reference in New Issue