21 #include "llvm/IR/BasicBlock.h" 22 #include "llvm/IR/Constants.h" 23 #include "llvm/IR/DerivedTypes.h" 24 #include "llvm/Support/Format.h" 26 using namespace clang;
27 using namespace CodeGen;
30 constexpr
unsigned CudaFatMagic = 0x466243b1;
31 constexpr
unsigned HIPFatMagic = 0x48495046;
36 llvm::IntegerType *IntTy, *SizeTy;
38 llvm::PointerType *CharPtrTy, *VoidPtrTy, *VoidPtrPtrTy;
41 llvm::LLVMContext &Context;
43 llvm::Module &TheModule;
46 llvm::Function *Kernel;
51 llvm::GlobalVariable *Var;
59 llvm::GlobalVariable *GpuBinaryHandle =
nullptr;
61 bool RelocatableDeviceCode;
63 std::unique_ptr<MangleContext> DeviceMC;
65 llvm::FunctionCallee getSetupArgumentFn()
const;
66 llvm::FunctionCallee getLaunchFn()
const;
68 llvm::FunctionType *getRegisterGlobalsFnTy()
const;
69 llvm::FunctionType *getCallbackFnTy()
const;
70 llvm::FunctionType *getRegisterLinkedBinaryFnTy()
const;
71 std::string addPrefixToName(StringRef FuncName)
const;
72 std::string addUnderscoredPrefixToName(StringRef FuncName)
const;
75 llvm::Function *makeRegisterGlobalsFn();
80 llvm::Constant *makeConstantString(
const std::string &Str,
81 const std::string &Name =
"",
82 const std::string &SectionName =
"",
83 unsigned Alignment = 0) {
84 llvm::Constant *Zeros[] = {llvm::ConstantInt::get(SizeTy, 0),
85 llvm::ConstantInt::get(SizeTy, 0)};
86 auto ConstStr = CGM.GetAddrOfConstantCString(Str, Name.c_str());
87 llvm::GlobalVariable *GV =
88 cast<llvm::GlobalVariable>(ConstStr.getPointer());
89 if (!SectionName.empty()) {
90 GV->setSection(SectionName);
96 GV->setAlignment(llvm::Align(Alignment));
98 return llvm::ConstantExpr::getGetElementPtr(ConstStr.getElementType(),
99 ConstStr.getPointer(), Zeros);
103 llvm::Function *makeDummyFunction(llvm::FunctionType *FnTy) {
104 assert(FnTy->getReturnType()->isVoidTy() &&
105 "Can only generate dummy functions returning void!");
109 llvm::BasicBlock *DummyBlock =
112 FuncBuilder.SetInsertPoint(DummyBlock);
113 FuncBuilder.CreateRetVoid();
120 std::string getDeviceSideName(
const Decl *ND);
126 void registerDeviceVar(
const VarDecl *VD, llvm::GlobalVariable &Var,
127 unsigned Flags)
override {
128 DeviceVars.push_back({&Var, VD, Flags});
132 llvm::Function *makeModuleCtorFunction()
override;
134 llvm::Function *makeModuleDtorFunction()
override;
136 std::string getDeviceStubName(llvm::StringRef Name)
const override;
141 std::string CGNVCUDARuntime::addPrefixToName(StringRef FuncName)
const {
142 if (CGM.getLangOpts().HIP)
143 return ((Twine(
"hip") + Twine(FuncName)).str());
144 return ((Twine(
"cuda") + Twine(FuncName)).str());
147 CGNVCUDARuntime::addUnderscoredPrefixToName(StringRef FuncName)
const {
148 if (CGM.getLangOpts().HIP)
149 return ((Twine(
"__hip") + Twine(FuncName)).str());
150 return ((Twine(
"__cuda") + Twine(FuncName)).str());
155 TheModule(CGM.getModule()),
156 RelocatableDeviceCode(CGM.getLangOpts().GPURelocatableDeviceCode),
157 DeviceMC(CGM.getContext().createMangleContext(
158 CGM.getContext().getAuxTargetInfo())) {
168 VoidPtrPtrTy = VoidPtrTy->getPointerTo();
171 llvm::FunctionCallee CGNVCUDARuntime::getSetupArgumentFn()
const {
175 llvm::FunctionType::get(IntTy, Params,
false),
176 addPrefixToName(
"SetupArgument"));
179 llvm::FunctionCallee CGNVCUDARuntime::getLaunchFn()
const {
183 llvm::FunctionType::get(IntTy, CharPtrTy,
false),
"hipLaunchByPtr");
187 llvm::FunctionType::get(IntTy, CharPtrTy,
false),
"cudaLaunch");
191 llvm::FunctionType *CGNVCUDARuntime::getRegisterGlobalsFnTy()
const {
192 return llvm::FunctionType::get(VoidTy, VoidPtrPtrTy,
false);
195 llvm::FunctionType *CGNVCUDARuntime::getCallbackFnTy()
const {
196 return llvm::FunctionType::get(VoidTy, VoidPtrTy,
false);
199 llvm::FunctionType *CGNVCUDARuntime::getRegisterLinkedBinaryFnTy()
const {
200 auto CallbackFnTy = getCallbackFnTy();
201 auto RegisterGlobalsFnTy = getRegisterGlobalsFnTy();
203 VoidPtrTy, CallbackFnTy->getPointerTo()};
204 return llvm::FunctionType::get(VoidTy, Params,
false);
207 std::string CGNVCUDARuntime::getDeviceSideName(
const Decl *D) {
208 auto *ND = cast<const NamedDecl>(D);
209 std::string DeviceSideName;
210 if (DeviceMC->shouldMangleDeclName(ND)) {
212 llvm::raw_svector_ostream Out(Buffer);
213 DeviceMC->mangleName(ND, Out);
214 DeviceSideName = Out.str();
216 DeviceSideName = ND->getIdentifier()->getName();
217 return DeviceSideName;
234 getDeviceStubName(getDeviceSideName(CGF.
CurFuncDecl)) ==
235 CGF.
CurFn->getName());
241 emitDeviceStubBodyNew(CGF, Args);
243 emitDeviceStubBodyLegacy(CGF, Args);
257 llvm::ConstantInt::get(SizeTy, std::max<size_t>(1, Args.size())));
259 for (
unsigned i = 0; i < Args.size(); ++i) {
277 auto LaunchKernelName = addPrefixToName(
"LaunchKernel");
281 for (
const auto &Result : DC->
lookup(&cudaLaunchKernelII)) {
283 cudaLaunchKernelFD = FD;
286 if (cudaLaunchKernelFD ==
nullptr) {
288 "Can't find declaration for " + LaunchKernelName);
303 llvm::FunctionType::get(IntTy,
309 addUnderscoredPrefixToName(
"PopCallConfiguration"));
332 llvm::FunctionType *FTy = dyn_cast<llvm::FunctionType>(Ty);
336 llvm::FunctionCallee cudaLaunchKernelFn =
348 llvm::FunctionCallee cudaSetupArgFn = getSetupArgumentFn();
351 for (
const VarDecl *A : Args) {
353 std::tie(TyWidth, TyAlign) =
355 Offset = Offset.
alignTo(TyAlign);
359 llvm::ConstantInt::get(SizeTy, TyWidth.
getQuantity()),
360 llvm::ConstantInt::get(SizeTy, Offset.
getQuantity()),
363 llvm::Constant *
Zero = llvm::ConstantInt::get(IntTy, 0);
366 CGF.
Builder.CreateCondBr(CBZero, NextBlock, EndBlock);
372 llvm::FunctionCallee cudaLaunchFn = getLaunchFn();
394 llvm::Function *CGNVCUDARuntime::makeRegisterGlobalsFn() {
396 if (EmittedKernels.empty() && DeviceVars.empty())
401 addUnderscoredPrefixToName(
"_register_globals"), &TheModule);
402 llvm::BasicBlock *EntryBB =
405 Builder.SetInsertPoint(EntryBB);
413 llvm::FunctionType::get(IntTy, RegisterFuncParams,
false),
414 addUnderscoredPrefixToName(
"RegisterFunction"));
419 llvm::Argument &GpuBinaryHandlePtr = *RegisterKernelsFunc->arg_begin();
420 for (
auto &&I : EmittedKernels) {
421 llvm::Constant *KernelName = makeConstantString(getDeviceSideName(I.D));
422 llvm::Constant *NullPtr = llvm::ConstantPointerNull::get(VoidPtrTy);
428 llvm::ConstantInt::get(IntTy, -1),
433 llvm::ConstantPointerNull::get(IntTy->getPointerTo())};
434 Builder.CreateCall(RegisterFunc, Args);
443 llvm::FunctionType::get(IntTy, RegisterVarParams,
false),
444 addUnderscoredPrefixToName(
"RegisterVar"));
445 for (
auto &&Info : DeviceVars) {
446 llvm::GlobalVariable *Var = Info.Var;
447 unsigned Flags = Info.Flag;
448 llvm::Constant *VarName = makeConstantString(getDeviceSideName(Info.D));
456 llvm::ConstantInt::get(IntTy, (Flags & ExternDeviceVar) ? 1 : 0),
457 llvm::ConstantInt::get(IntTy, VarSize),
458 llvm::ConstantInt::get(IntTy, (Flags & ConstantDeviceVar) ? 1 : 0),
459 llvm::ConstantInt::get(IntTy, 0)};
460 Builder.CreateCall(RegisterVar, Args);
464 return RegisterKernelsFunc;
486 llvm::Function *CGNVCUDARuntime::makeModuleCtorFunction() {
491 if (CudaGpuBinaryFileName.empty() && !IsHIP)
493 if ((IsHIP || (IsCUDA && !RelocatableDeviceCode)) && EmittedKernels.empty() &&
498 llvm::Function *RegisterGlobalsFunc = makeRegisterGlobalsFn();
501 if (RelocatableDeviceCode && !RegisterGlobalsFunc)
502 RegisterGlobalsFunc = makeDummyFunction(getRegisterGlobalsFnTy());
506 llvm::FunctionType::get(VoidPtrPtrTy, VoidPtrTy,
false),
507 addUnderscoredPrefixToName(
"RegisterFatBinary"));
509 llvm::StructType *FatbinWrapperTy =
510 llvm::StructType::get(IntTy, IntTy, VoidPtrTy, VoidPtrTy);
516 std::unique_ptr<llvm::MemoryBuffer> CudaGpuBinary =
nullptr;
517 if (!CudaGpuBinaryFileName.empty()) {
518 llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> CudaGpuBinaryOrErr =
519 llvm::MemoryBuffer::getFileOrSTDIN(CudaGpuBinaryFileName);
520 if (std::error_code EC = CudaGpuBinaryOrErr.getError()) {
522 << CudaGpuBinaryFileName << EC.message();
525 CudaGpuBinary = std::move(CudaGpuBinaryOrErr.get());
529 llvm::FunctionType::get(VoidTy, VoidPtrTy,
false),
531 addUnderscoredPrefixToName(
"_module_ctor"), &TheModule);
532 llvm::BasicBlock *CtorEntryBB =
536 CtorBuilder.SetInsertPoint(CtorEntryBB);
538 const char *FatbinConstantName;
539 const char *FatbinSectionName;
540 const char *ModuleIDSectionName;
541 StringRef ModuleIDPrefix;
542 llvm::Constant *FatBinStr;
545 FatbinConstantName =
".hip_fatbin";
546 FatbinSectionName =
".hipFatBinSegment";
548 ModuleIDSectionName =
"__hip_module_id";
549 ModuleIDPrefix =
"__hip_";
554 FatBinStr = makeConstantString(CudaGpuBinary->getBuffer(),
"",
555 FatbinConstantName, 8);
561 FatBinStr =
new llvm::GlobalVariable(
564 "__hip_fatbin",
nullptr,
565 llvm::GlobalVariable::NotThreadLocal);
566 cast<llvm::GlobalVariable>(FatBinStr)->setSection(FatbinConstantName);
569 FatMagic = HIPFatMagic;
571 if (RelocatableDeviceCode)
572 FatbinConstantName = CGM.
getTriple().isMacOSX()
573 ?
"__NV_CUDA,__nv_relfatbin" 577 CGM.
getTriple().isMacOSX() ?
"__NV_CUDA,__nv_fatbin" :
".nv_fatbin";
580 CGM.
getTriple().isMacOSX() ?
"__NV_CUDA,__fatbin" :
".nvFatBinSegment";
582 ModuleIDSectionName = CGM.
getTriple().isMacOSX()
583 ?
"__NV_CUDA,__nv_module_id" 585 ModuleIDPrefix =
"__nv_";
589 FatBinStr = makeConstantString(CudaGpuBinary->getBuffer(),
"",
590 FatbinConstantName, 8);
591 FatMagic = CudaFatMagic;
596 auto Values =
Builder.beginStruct(FatbinWrapperTy);
598 Values.addInt(IntTy, FatMagic);
600 Values.addInt(IntTy, 1);
602 Values.add(FatBinStr);
604 Values.add(llvm::ConstantPointerNull::get(VoidPtrTy));
605 llvm::GlobalVariable *FatbinWrapper = Values.finishAndCreateGlobal(
608 FatbinWrapper->setSection(FatbinSectionName);
619 llvm::GlobalValue::LinkOnceAnyLinkage;
620 llvm::BasicBlock *IfBlock =
622 llvm::BasicBlock *ExitBlock =
626 GpuBinaryHandle =
new llvm::GlobalVariable(
627 TheModule, VoidPtrPtrTy,
false,
629 llvm::ConstantPointerNull::get(VoidPtrPtrTy),
630 "__hip_gpubin_handle");
639 auto HandleValue = CtorBuilder.CreateLoad(GpuBinaryAddr);
640 llvm::Constant *Zero =
641 llvm::Constant::getNullValue(HandleValue->getType());
642 llvm::Value *EQZero = CtorBuilder.CreateICmpEQ(HandleValue, Zero);
643 CtorBuilder.CreateCondBr(EQZero, IfBlock, ExitBlock);
646 CtorBuilder.SetInsertPoint(IfBlock);
648 llvm::CallInst *RegisterFatbinCall = CtorBuilder.CreateCall(
650 CtorBuilder.CreateBitCast(FatbinWrapper, VoidPtrTy));
651 CtorBuilder.CreateStore(RegisterFatbinCall, GpuBinaryAddr);
652 CtorBuilder.CreateBr(ExitBlock);
655 CtorBuilder.SetInsertPoint(ExitBlock);
657 if (RegisterGlobalsFunc) {
658 auto HandleValue = CtorBuilder.CreateLoad(GpuBinaryAddr);
659 CtorBuilder.CreateCall(RegisterGlobalsFunc, HandleValue);
662 }
else if (!RelocatableDeviceCode) {
666 llvm::CallInst *RegisterFatbinCall = CtorBuilder.CreateCall(
668 CtorBuilder.CreateBitCast(FatbinWrapper, VoidPtrTy));
669 GpuBinaryHandle =
new llvm::GlobalVariable(
671 llvm::ConstantPointerNull::get(VoidPtrPtrTy),
"__cuda_gpubin_handle");
673 CtorBuilder.CreateAlignedStore(RegisterFatbinCall, GpuBinaryHandle,
677 if (RegisterGlobalsFunc)
678 CtorBuilder.CreateCall(RegisterGlobalsFunc, RegisterFatbinCall);
685 llvm::FunctionType::get(VoidTy, VoidPtrPtrTy,
false),
686 "__cudaRegisterFatBinaryEnd");
687 CtorBuilder.CreateCall(RegisterFatbinEndFunc, RegisterFatbinCall);
692 llvm::raw_svector_ostream
OS(ModuleID);
693 OS << ModuleIDPrefix << llvm::format(
"%" PRIx64, FatbinWrapper->getGUID());
694 llvm::Constant *ModuleIDConstant =
695 makeConstantString(ModuleID.str(),
"", ModuleIDSectionName, 32);
699 Twine(
"__fatbinwrap") + ModuleID, FatbinWrapper);
704 RegisterLinkedBinaryName += ModuleID;
706 getRegisterLinkedBinaryFnTy(), RegisterLinkedBinaryName);
708 assert(RegisterGlobalsFunc &&
"Expecting at least dummy function!");
710 CtorBuilder.CreateBitCast(FatbinWrapper, VoidPtrTy),
712 makeDummyFunction(getCallbackFnTy())};
713 CtorBuilder.CreateCall(RegisterLinkedBinaryFunc, Args);
719 if (llvm::Function *CleanupFn = makeModuleDtorFunction()) {
721 llvm::FunctionType *AtExitTy =
722 llvm::FunctionType::get(IntTy, CleanupFn->getType(),
false);
723 llvm::FunctionCallee AtExitFunc =
726 CtorBuilder.CreateCall(AtExitFunc, CleanupFn);
729 CtorBuilder.CreateRetVoid();
730 return ModuleCtorFunc;
752 llvm::Function *CGNVCUDARuntime::makeModuleDtorFunction() {
754 if (!GpuBinaryHandle)
759 llvm::FunctionType::get(VoidTy, VoidPtrPtrTy,
false),
760 addUnderscoredPrefixToName(
"UnregisterFatBinary"));
763 llvm::FunctionType::get(VoidTy, VoidPtrTy,
false),
765 addUnderscoredPrefixToName(
"_module_dtor"), &TheModule);
767 llvm::BasicBlock *DtorEntryBB =
770 DtorBuilder.SetInsertPoint(DtorEntryBB);
773 GpuBinaryHandle->getAlignment()));
774 auto HandleValue = DtorBuilder.CreateLoad(GpuBinaryAddr);
779 llvm::BasicBlock *IfBlock =
781 llvm::BasicBlock *ExitBlock =
783 llvm::Constant *Zero = llvm::Constant::getNullValue(HandleValue->getType());
784 llvm::Value *NEZero = DtorBuilder.CreateICmpNE(HandleValue, Zero);
785 DtorBuilder.CreateCondBr(NEZero, IfBlock, ExitBlock);
787 DtorBuilder.SetInsertPoint(IfBlock);
788 DtorBuilder.CreateCall(UnregisterFatbinFunc, HandleValue);
789 DtorBuilder.CreateStore(Zero, GpuBinaryAddr);
790 DtorBuilder.CreateBr(ExitBlock);
792 DtorBuilder.SetInsertPoint(ExitBlock);
794 DtorBuilder.CreateCall(UnregisterFatbinFunc, HandleValue);
796 DtorBuilder.CreateRetVoid();
797 return ModuleDtorFunc;
800 std::string CGNVCUDARuntime::getDeviceStubName(llvm::StringRef Name)
const {
803 return (Name +
".stub").str();
807 return new CGNVCUDARuntime(CGM);
const llvm::DataLayout & getDataLayout() const
ReturnValueSlot - Contains the address where the return value of a function can be stored...
CharUnits alignTo(const CharUnits &Align) const
alignTo - Returns the next integer (mod 2**64) that is greater than or equal to this quantity and is ...
llvm::StoreInst * CreateDefaultAlignedStore(llvm::Value *Val, llvm::Value *Addr, bool IsVolatile=false)
Represents a function declaration or definition.
llvm::IntegerType * IntTy
int
External linkage, which indicates that the entity can be referred to from other translation units...
A (possibly-)qualified type.
CodeGenTypes & getTypes()
const CodeGenOptions & getCodeGenOpts() const
Address CreateMemTemp(QualType T, const Twine &Name="tmp", Address *Alloca=nullptr)
CreateMemTemp - Create a temporary memory object of the given type, with appropriate alignmen and cas...
The standard implementation of ConstantInitBuilder used in Clang.
Decl - This represents one declaration (or definition), e.g.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
const TargetInfo & getTargetInfo() const
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
Address GetAddrOfLocalVar(const VarDecl *VD)
GetAddrOfLocalVar - Return the address of a local variable.
Represents a variable declaration or definition.
Objects with "hidden" visibility are not seen by the dynamic linker.
DiagnosticsEngine & getDiags() const
llvm::Value * getPointer() const
Represents a parameter to a function.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
void add(RValue rvalue, QualType type)
One of these records is kept for each identifier that is lexed.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
llvm::Type * ConvertType(QualType T)
ConvertType - Convert type T into a llvm::Type.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
llvm::IntegerType * SizeTy
CharUnits getSizeAlign() const
bool Zero(InterpState &S, CodePtr OpPC)
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
CharUnits - This is an opaque type for sizes expressed in character units.
llvm::Align getAsAlign() const
getAsAlign - Returns Quantity as a valid llvm::Align, Beware llvm::Align assumes power of two 8-bit b...
llvm::PointerType * VoidPtrTy
llvm::PointerType * VoidPtrPtrTy
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
CharUnits getPointerAlign() const
llvm::AllocaInst * CreateTempAlloca(llvm::Type *Ty, const Twine &Name="tmp", llvm::Value *ArraySize=nullptr)
CreateTempAlloca - This creates an alloca and inserts it into the entry block if ArraySize is nullptr...
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
static CGCallee forDirect(llvm::Constant *functionPtr, const CGCalleeInfo &abstractInfo=CGCalleeInfo())
llvm::PointerType * getType() const
Return the type of the pointer value.
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
const TargetInfo & getTarget() const
const LangOptions & getLangOpts() const
ASTContext & getContext() const
The l-value was considered opaque, so the alignment was determined from a type.
const llvm::VersionTuple & getSDKVersion() const
Address CreateBitCast(Address Addr, llvm::Type *Ty, const llvm::Twine &Name="")
QualType getCanonicalType() const
static DeclContext * castToDeclContext(const TranslationUnitDecl *D)
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
RValue EmitCall(const CGFunctionInfo &CallInfo, const CGCallee &Callee, ReturnValueSlot ReturnValue, const CallArgList &Args, llvm::CallBase **callOrInvoke, SourceLocation Loc)
EmitCall - Generate a call of the given function, expecting the given result type, and using the given argument list which specifies both the LLVM arguments and the types they were derived from.
const ParmVarDecl * getParamDecl(unsigned i) const
bool CudaFeatureEnabled(llvm::VersionTuple, CudaFeature)
constexpr XRayInstrMask None
void Error(SourceLocation loc, StringRef error)
Emit a general error that something can't be done.
std::pair< CharUnits, CharUnits > getTypeInfoInChars(const Type *T) const
FunctionArgList - Type for representing both the decl and type of parameters to a function...
CGFunctionInfo - Class to encapsulate the information about a function definition.
This class organizes the cross-function state that is used while generating LLVM code.
std::string CudaGpuBinaryFileName
Name of file passed with -fcuda-include-gpubinary option to forward to CUDA runtime back-end for inco...
Dataflow Directional Tag Classes.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
const CGFunctionInfo & arrangeFunctionDeclaration(const FunctionDecl *FD)
Free functions are functions that are compatible with an ordinary C function pointer type...
std::unique_ptr< DiagnosticConsumer > create(StringRef OutputFile, DiagnosticOptions *Diags, bool MergeChildRecords=false)
Returns a DiagnosticConsumer that serializes diagnostics to a bitcode file.
llvm::LoadInst * CreateLoad(Address Addr, const llvm::Twine &Name="")
llvm::Module & getModule() const
Indicates that the tracking object is a descendant of a referenced-counted OSObject, used in the Darwin kernel.
This class organizes the cross-module state that is used while lowering AST types to LLVM types...
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
llvm::FunctionCallee CreateRuntimeFunction(llvm::FunctionType *Ty, StringRef Name, llvm::AttributeList ExtraAttrs=llvm::AttributeList(), bool Local=false)
Create or return a runtime function declaration with the specified type and name. ...
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
EmitBlock - Emit the given block.
CGCUDARuntime * CreateNVCUDARuntime(CodeGenModule &CGM)
Creates an instance of a CUDA runtime class.
const Decl * CurFuncDecl
CurFuncDecl - Holds the Decl for the current outermost non-closure context.
TranslationUnitDecl * getTranslationUnitDecl() const
void EmitBranch(llvm::BasicBlock *Block)
EmitBranch - Emit a branch to the specified basic block from the current insert block, taking care to avoid creation of branches from dummy blocks.
The top declaration context.
static RValue get(llvm::Value *V)
static RValue getAggregate(Address addr, bool isVolatile=false)
const TargetInfo * getAuxTargetInfo() const
const LangOptions & getLangOpts() const
llvm::CallBase * EmitRuntimeCallOrInvoke(llvm::FunctionCallee callee, ArrayRef< llvm::Value *> args, const Twine &name="")
Emits a call or invoke instruction to the given runtime function.
CallArgList - Type for representing both the value and type of arguments in a call.
SourceLocation getLocation() const
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PL, ArrayRef< Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
const llvm::Triple & getTriple() const