10#include "TargetInfo.h"
32void TCETargetCodeGenInfo::setTargetAttributes(
34 if (GV->isDeclaration())
39 llvm::Function *F = cast<llvm::Function>(GV);
42 if (FD->
hasAttr<DeviceKernelAttr>()) {
44 F->addFnAttr(llvm::Attribute::NoInline);
45 const ReqdWorkGroupSizeAttr *
Attr = FD->
getAttr<ReqdWorkGroupSizeAttr>();
48 llvm::LLVMContext &Context = F->getContext();
49 llvm::NamedMDNode *OpenCLMetadata =
51 "opencl.kernel_wg_size_info");
53 auto Eval = [&](
Expr *
E) {
57 llvm::ConstantAsMetadata::get(F),
58 llvm::ConstantAsMetadata::get(llvm::Constant::getIntegerValue(
60 llvm::ConstantAsMetadata::get(llvm::Constant::getIntegerValue(
62 llvm::ConstantAsMetadata::get(llvm::Constant::getIntegerValue(
67 llvm::ConstantAsMetadata::get(llvm::ConstantInt::getTrue(Context))};
68 OpenCLMetadata->addOperand(llvm::MDNode::get(Context, Operands));
76std::unique_ptr<TargetCodeGenInfo>
78 return std::make_unique<TCETargetCodeGenInfo>(CGM.
getTypes());
Attr - This represents one attribute.
This class organizes the cross-function state that is used while generating LLVM code.
llvm::Module & getModule() const
const LangOptions & getLangOpts() const
CodeGenTypes & getTypes()
This class organizes the cross-module state that is used while lowering AST types to LLVM types.
DefaultABIInfo - The default implementation for ABI specific details.
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues,...
virtual void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &M) const
setTargetAttributes - Provides a convenient hook to handle extra target-specific attributes for the g...
Decl - This represents one declaration (or definition), e.g.
ASTContext & getASTContext() const LLVM_READONLY
This represents one expression.
llvm::APSInt EvaluateKnownConstInt(const ASTContext &Ctx, SmallVectorImpl< PartialDiagnosticAt > *Diag=nullptr) const
EvaluateKnownConstInt - Call EvaluateAsRValue and return the folded integer.
Represents a function declaration or definition.
std::unique_ptr< TargetCodeGenInfo > createTCETargetCodeGenInfo(CodeGenModule &CGM)
The JSON file list parser is used to communicate input to InstallAPI.
llvm::IntegerType * Int32Ty