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(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());
240 emitDeviceStubBodyNew(CGF, Args);
242 emitDeviceStubBodyLegacy(CGF, Args);
256 llvm::ConstantInt::get(SizeTy, std::max<size_t>(1, Args.size())));
258 for (
unsigned i = 0;
i < Args.size(); ++
i) {
276 for (
const auto &Result : DC->
lookup(&cudaLaunchKernelII)) {
278 cudaLaunchKernelFD = FD;
281 if (cudaLaunchKernelFD ==
nullptr) {
283 "Can't find declaration for cudaLaunchKernel()");
298 llvm::FunctionType::get(IntTy,
304 "__cudaPopCallConfiguration");
327 llvm::FunctionType *FTy = dyn_cast<llvm::FunctionType>(Ty);
331 llvm::FunctionCallee cudaLaunchKernelFn =
343 llvm::FunctionCallee cudaSetupArgFn = getSetupArgumentFn();
346 for (
const VarDecl *A : Args) {
348 std::tie(TyWidth, TyAlign) =
350 Offset = Offset.
alignTo(TyAlign);
354 llvm::ConstantInt::get(SizeTy, TyWidth.
getQuantity()),
355 llvm::ConstantInt::get(SizeTy, Offset.
getQuantity()),
358 llvm::Constant *Zero = llvm::ConstantInt::get(IntTy, 0);
361 CGF.
Builder.CreateCondBr(CBZero, NextBlock, EndBlock);
367 llvm::FunctionCallee cudaLaunchFn = getLaunchFn();
389 llvm::Function *CGNVCUDARuntime::makeRegisterGlobalsFn() {
391 if (EmittedKernels.empty() && DeviceVars.empty())
396 addUnderscoredPrefixToName(
"_register_globals"), &TheModule);
397 llvm::BasicBlock *EntryBB =
400 Builder.SetInsertPoint(EntryBB);
408 llvm::FunctionType::get(IntTy, RegisterFuncParams,
false),
409 addUnderscoredPrefixToName(
"RegisterFunction"));
414 llvm::Argument &GpuBinaryHandlePtr = *RegisterKernelsFunc->arg_begin();
415 for (
auto &&I : EmittedKernels) {
416 llvm::Constant *KernelName = makeConstantString(getDeviceSideName(I.D));
417 llvm::Constant *NullPtr = llvm::ConstantPointerNull::get(VoidPtrTy);
423 llvm::ConstantInt::get(IntTy, -1),
428 llvm::ConstantPointerNull::get(IntTy->getPointerTo())};
429 Builder.CreateCall(RegisterFunc, Args);
438 llvm::FunctionType::get(IntTy, RegisterVarParams,
false),
439 addUnderscoredPrefixToName(
"RegisterVar"));
440 for (
auto &&Info : DeviceVars) {
441 llvm::GlobalVariable *Var = Info.Var;
442 unsigned Flags = Info.Flag;
443 llvm::Constant *VarName = makeConstantString(getDeviceSideName(Info.D));
451 llvm::ConstantInt::get(IntTy, (Flags & ExternDeviceVar) ? 1 : 0),
452 llvm::ConstantInt::get(IntTy, VarSize),
453 llvm::ConstantInt::get(IntTy, (Flags & ConstantDeviceVar) ? 1 : 0),
454 llvm::ConstantInt::get(IntTy, 0)};
455 Builder.CreateCall(RegisterVar, Args);
459 return RegisterKernelsFunc;
481 llvm::Function *CGNVCUDARuntime::makeModuleCtorFunction() {
486 if (CudaGpuBinaryFileName.empty() && !IsHIP)
488 if ((IsHIP || (IsCUDA && !RelocatableDeviceCode)) && EmittedKernels.empty() &&
493 llvm::Function *RegisterGlobalsFunc = makeRegisterGlobalsFn();
496 if (RelocatableDeviceCode && !RegisterGlobalsFunc)
497 RegisterGlobalsFunc = makeDummyFunction(getRegisterGlobalsFnTy());
501 llvm::FunctionType::get(VoidPtrPtrTy, VoidPtrTy,
false),
502 addUnderscoredPrefixToName(
"RegisterFatBinary"));
504 llvm::StructType *FatbinWrapperTy =
505 llvm::StructType::get(IntTy, IntTy, VoidPtrTy, VoidPtrTy);
511 std::unique_ptr<llvm::MemoryBuffer> CudaGpuBinary =
nullptr;
512 if (!CudaGpuBinaryFileName.empty()) {
513 llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> CudaGpuBinaryOrErr =
514 llvm::MemoryBuffer::getFileOrSTDIN(CudaGpuBinaryFileName);
515 if (std::error_code EC = CudaGpuBinaryOrErr.getError()) {
517 << CudaGpuBinaryFileName << EC.message();
520 CudaGpuBinary = std::move(CudaGpuBinaryOrErr.get());
524 llvm::FunctionType::get(VoidTy, VoidPtrTy,
false),
526 addUnderscoredPrefixToName(
"_module_ctor"), &TheModule);
527 llvm::BasicBlock *CtorEntryBB =
531 CtorBuilder.SetInsertPoint(CtorEntryBB);
533 const char *FatbinConstantName;
534 const char *FatbinSectionName;
535 const char *ModuleIDSectionName;
536 StringRef ModuleIDPrefix;
537 llvm::Constant *FatBinStr;
540 FatbinConstantName =
".hip_fatbin";
541 FatbinSectionName =
".hipFatBinSegment";
543 ModuleIDSectionName =
"__hip_module_id";
544 ModuleIDPrefix =
"__hip_";
549 FatBinStr = makeConstantString(CudaGpuBinary->getBuffer(),
"",
550 FatbinConstantName, 8);
556 FatBinStr =
new llvm::GlobalVariable(
559 "__hip_fatbin",
nullptr,
560 llvm::GlobalVariable::NotThreadLocal);
561 cast<llvm::GlobalVariable>(FatBinStr)->setSection(FatbinConstantName);
564 FatMagic = HIPFatMagic;
566 if (RelocatableDeviceCode)
567 FatbinConstantName = CGM.
getTriple().isMacOSX()
568 ?
"__NV_CUDA,__nv_relfatbin" 572 CGM.
getTriple().isMacOSX() ?
"__NV_CUDA,__nv_fatbin" :
".nv_fatbin";
575 CGM.
getTriple().isMacOSX() ?
"__NV_CUDA,__fatbin" :
".nvFatBinSegment";
577 ModuleIDSectionName = CGM.
getTriple().isMacOSX()
578 ?
"__NV_CUDA,__nv_module_id" 580 ModuleIDPrefix =
"__nv_";
584 FatBinStr = makeConstantString(CudaGpuBinary->getBuffer(),
"",
585 FatbinConstantName, 8);
586 FatMagic = CudaFatMagic;
591 auto Values =
Builder.beginStruct(FatbinWrapperTy);
593 Values.addInt(IntTy, FatMagic);
595 Values.addInt(IntTy, 1);
597 Values.add(FatBinStr);
599 Values.add(llvm::ConstantPointerNull::get(VoidPtrTy));
600 llvm::GlobalVariable *FatbinWrapper = Values.finishAndCreateGlobal(
603 FatbinWrapper->setSection(FatbinSectionName);
614 llvm::GlobalValue::LinkOnceAnyLinkage;
615 llvm::BasicBlock *IfBlock =
617 llvm::BasicBlock *ExitBlock =
621 GpuBinaryHandle =
new llvm::GlobalVariable(
622 TheModule, VoidPtrPtrTy,
false,
624 llvm::ConstantPointerNull::get(VoidPtrPtrTy),
625 "__hip_gpubin_handle");
634 auto HandleValue = CtorBuilder.CreateLoad(GpuBinaryAddr);
635 llvm::Constant *Zero =
636 llvm::Constant::getNullValue(HandleValue->getType());
637 llvm::Value *EQZero = CtorBuilder.CreateICmpEQ(HandleValue, Zero);
638 CtorBuilder.CreateCondBr(EQZero, IfBlock, ExitBlock);
641 CtorBuilder.SetInsertPoint(IfBlock);
643 llvm::CallInst *RegisterFatbinCall = CtorBuilder.CreateCall(
645 CtorBuilder.CreateBitCast(FatbinWrapper, VoidPtrTy));
646 CtorBuilder.CreateStore(RegisterFatbinCall, GpuBinaryAddr);
647 CtorBuilder.CreateBr(ExitBlock);
650 CtorBuilder.SetInsertPoint(ExitBlock);
652 if (RegisterGlobalsFunc) {
653 auto HandleValue = CtorBuilder.CreateLoad(GpuBinaryAddr);
654 CtorBuilder.CreateCall(RegisterGlobalsFunc, HandleValue);
657 }
else if (!RelocatableDeviceCode) {
661 llvm::CallInst *RegisterFatbinCall = CtorBuilder.CreateCall(
663 CtorBuilder.CreateBitCast(FatbinWrapper, VoidPtrTy));
664 GpuBinaryHandle =
new llvm::GlobalVariable(
666 llvm::ConstantPointerNull::get(VoidPtrPtrTy),
"__cuda_gpubin_handle");
668 CtorBuilder.CreateAlignedStore(RegisterFatbinCall, GpuBinaryHandle,
672 if (RegisterGlobalsFunc)
673 CtorBuilder.CreateCall(RegisterGlobalsFunc, RegisterFatbinCall);
680 llvm::FunctionType::get(VoidTy, VoidPtrPtrTy,
false),
681 "__cudaRegisterFatBinaryEnd");
682 CtorBuilder.CreateCall(RegisterFatbinEndFunc, RegisterFatbinCall);
687 llvm::raw_svector_ostream
OS(ModuleID);
688 OS << ModuleIDPrefix << llvm::format(
"%" PRIx64, FatbinWrapper->getGUID());
689 llvm::Constant *ModuleIDConstant =
690 makeConstantString(ModuleID.str(),
"", ModuleIDSectionName, 32);
694 Twine(
"__fatbinwrap") + ModuleID, FatbinWrapper);
699 RegisterLinkedBinaryName += ModuleID;
701 getRegisterLinkedBinaryFnTy(), RegisterLinkedBinaryName);
703 assert(RegisterGlobalsFunc &&
"Expecting at least dummy function!");
705 CtorBuilder.CreateBitCast(FatbinWrapper, VoidPtrTy),
707 makeDummyFunction(getCallbackFnTy())};
708 CtorBuilder.CreateCall(RegisterLinkedBinaryFunc, Args);
714 if (llvm::Function *CleanupFn = makeModuleDtorFunction()) {
716 llvm::FunctionType *AtExitTy =
717 llvm::FunctionType::get(IntTy, CleanupFn->getType(),
false);
718 llvm::FunctionCallee AtExitFunc =
721 CtorBuilder.CreateCall(AtExitFunc, CleanupFn);
724 CtorBuilder.CreateRetVoid();
725 return ModuleCtorFunc;
747 llvm::Function *CGNVCUDARuntime::makeModuleDtorFunction() {
749 if (!GpuBinaryHandle)
754 llvm::FunctionType::get(VoidTy, VoidPtrPtrTy,
false),
755 addUnderscoredPrefixToName(
"UnregisterFatBinary"));
758 llvm::FunctionType::get(VoidTy, VoidPtrTy,
false),
760 addUnderscoredPrefixToName(
"_module_dtor"), &TheModule);
762 llvm::BasicBlock *DtorEntryBB =
765 DtorBuilder.SetInsertPoint(DtorEntryBB);
768 GpuBinaryHandle->getAlignment()));
769 auto HandleValue = DtorBuilder.CreateLoad(GpuBinaryAddr);
774 llvm::BasicBlock *IfBlock =
776 llvm::BasicBlock *ExitBlock =
778 llvm::Constant *Zero = llvm::Constant::getNullValue(HandleValue->getType());
779 llvm::Value *NEZero = DtorBuilder.CreateICmpNE(HandleValue, Zero);
780 DtorBuilder.CreateCondBr(NEZero, IfBlock, ExitBlock);
782 DtorBuilder.SetInsertPoint(IfBlock);
783 DtorBuilder.CreateCall(UnregisterFatbinFunc, HandleValue);
784 DtorBuilder.CreateStore(Zero, GpuBinaryAddr);
785 DtorBuilder.CreateBr(ExitBlock);
787 DtorBuilder.SetInsertPoint(ExitBlock);
789 DtorBuilder.CreateCall(UnregisterFatbinFunc, HandleValue);
791 DtorBuilder.CreateRetVoid();
792 return ModuleDtorFunc;
795 std::string CGNVCUDARuntime::getDeviceStubName(llvm::StringRef Name)
const {
798 return (Name +
".stub").str();
802 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
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
CharUnits - This is an opaque type for sizes expressed in character units.
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
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