kpyzhov created this revision. kpyzhov added a reviewer: yaxunl. kpyzhov added a project: AMDGPU. Herald added subscribers: t-tye, tpr, dstuttard, kzhuravl. kpyzhov requested review of this revision. Herald added subscribers: cfe-commits, wdng. Herald added a project: clang.
Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D115283 Files: clang/lib/CodeGen/TargetInfo.cpp Index: clang/lib/CodeGen/TargetInfo.cpp =================================================================== --- clang/lib/CodeGen/TargetInfo.cpp +++ clang/lib/CodeGen/TargetInfo.cpp @@ -9194,6 +9194,11 @@ llvm::Value *BlockLiteral) const override; bool shouldEmitStaticExternCAliases() const override; void setCUDAKernelCallingConvention(const FunctionType *&FT) const override; + + virtual void checkFunctionCallABI(CodeGenModule &CGM, SourceLocation CallLoc, + const FunctionDecl *Caller, + const FunctionDecl *Callee, + const CallArgList &Args) const override; }; } @@ -9417,6 +9422,24 @@ FT, FT->getExtInfo().withCallingConv(CC_OpenCLKernel)); } +void AMDGPUTargetCodeGenInfo::checkFunctionCallABI(CodeGenModule &CGM, + SourceLocation CallLoc, + const FunctionDecl *Caller, + const FunctionDecl *Callee, + const CallArgList &Args) const +{ + // Set the "amdgpu_hostcall" module flag if "Callee" is a library function + // that uses AMDGPU hostcall mechanism. + if (Callee && + (Callee->getName() == "__ockl_call_host_function" || + Callee->getName() == "__ockl_fprintf_stderr_begin")) { + llvm::Module &M = CGM.getModule(); + if (!M.getModuleFlag("amdgpu_hostcall")) { + M.addModuleFlag(llvm::Module::Override, "amdgpu_hostcall", 1); + } + } +} + //===----------------------------------------------------------------------===// // SPARC v8 ABI Implementation. // Based on the SPARC Compliance Definition version 2.4.1.
Index: clang/lib/CodeGen/TargetInfo.cpp =================================================================== --- clang/lib/CodeGen/TargetInfo.cpp +++ clang/lib/CodeGen/TargetInfo.cpp @@ -9194,6 +9194,11 @@ llvm::Value *BlockLiteral) const override; bool shouldEmitStaticExternCAliases() const override; void setCUDAKernelCallingConvention(const FunctionType *&FT) const override; + + virtual void checkFunctionCallABI(CodeGenModule &CGM, SourceLocation CallLoc, + const FunctionDecl *Caller, + const FunctionDecl *Callee, + const CallArgList &Args) const override; }; } @@ -9417,6 +9422,24 @@ FT, FT->getExtInfo().withCallingConv(CC_OpenCLKernel)); } +void AMDGPUTargetCodeGenInfo::checkFunctionCallABI(CodeGenModule &CGM, + SourceLocation CallLoc, + const FunctionDecl *Caller, + const FunctionDecl *Callee, + const CallArgList &Args) const +{ + // Set the "amdgpu_hostcall" module flag if "Callee" is a library function + // that uses AMDGPU hostcall mechanism. + if (Callee && + (Callee->getName() == "__ockl_call_host_function" || + Callee->getName() == "__ockl_fprintf_stderr_begin")) { + llvm::Module &M = CGM.getModule(); + if (!M.getModuleFlag("amdgpu_hostcall")) { + M.addModuleFlag(llvm::Module::Override, "amdgpu_hostcall", 1); + } + } +} + //===----------------------------------------------------------------------===// // SPARC v8 ABI Implementation. // Based on the SPARC Compliance Definition version 2.4.1.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits