1#ifndef PROTEUS_FRONTEND_CODE_BUILDER_H
2#define PROTEUS_FRONTEND_CODE_BUILDER_H
60 std::to_string(
static_cast<int>(Kind)));
85 const std::vector<IRType> &ArgTys,
86 bool IsKernel =
false) = 0;
118 const char *File,
int Line,
LoopHints Hints = {}) = 0;
162 const std::string &Name =
"") = 0;
190 const std::vector<IRType> &ArgTys,
191 const std::vector<IRValue *> &
Args) = 0;
200 const std::vector<IRValue *> &
Args) = 0;
205 const std::vector<IRValue *> &
Args) = 0;
230 unsigned AddrSpace = 0) = 0;
232 IRType ElemTy,
size_t NElem) = 0;
237#if defined(PROTEUS_ENABLE_CUDA) || defined(PROTEUS_ENABLE_HIP)
239 int MinBlocksPerSM) = 0;
char int void ** Args
Definition CompilerInterfaceHost.cpp:23
Definition CodeBuilder.h:70
virtual IRValue * createOr(IRValue *LHS, IRValue *RHS)=0
virtual VarAlloc allocPointer(const std::string &Name, IRType ElemTy, unsigned AddrSpace=0)=0
virtual IRValue * loadFromPointee(IRValue *Slot, IRType AllocTy, IRType ValueTy)=0
Dereference the pointer stored in Slot, then load the pointee.
virtual void endWhile()=0
virtual TargetModelType getTargetModel() const =0
virtual IRValue * createArith(ArithOp Op, IRValue *LHS, IRValue *RHS, IRType Ty)=0
virtual IRValue * emitBuiltin(const std::string &Name, IRType RetTy, const std::vector< IRValue * > &Args)=0
virtual IRValue * createZExt(IRValue *V, IRType DestTy)=0
virtual void createStore(IRValue *Val, IRValue *Ptr)=0
virtual void storeAddress(IRValue *Slot, IRValue *Addr)=0
Store Addr into Slot (pointer alloca).
virtual void setFunctionName(IRFunction *F, const std::string &Name)=0
Rename the function identified by F.
virtual void clearInsertPoint()=0
virtual IRValue * createCall(const std::string &FName, IRType RetTy, const std::vector< IRType > &ArgTys, const std::vector< IRValue * > &Args)=0
virtual IRValue * getConstantFP(IRType Ty, double Val)=0
virtual void setInsertPointAtEntry()=0
virtual IRValue * createAtomicAdd(IRValue *Addr, IRValue *Val)=0
virtual void beginFor(IRValue *IterSlot, IRType IterTy, IRValue *InitVal, IRValue *UpperBoundVal, IRValue *IncVal, bool IsSigned, const char *File, int Line, LoopHints Hints={})=0
virtual CodeBuilderKind getBackendKind() const =0
virtual VarAlloc allocScalar(const std::string &Name, IRType ValueTy)=0
virtual IRValue * createLoad(IRType Ty, IRValue *Ptr, const std::string &Name="")=0
virtual void beginIf(IRValue *Cond, const char *File, int Line)=0
virtual IRValue * createCall(const std::string &FName, IRType RetTy)=0
virtual IRValue * emitIntrinsic(const std::string &Name, IRType RetTy, const std::vector< IRValue * > &Args)=0
Lower a frontend intrinsic name to backend IR.
virtual VarAlloc getElementPtr(IRValue *Base, IRType BaseTy, IRValue *Index, IRType ElemTy)=0
virtual void storeScalar(IRValue *Slot, IRValue *Val)=0
Store Val directly into Slot (scalar alloca).
virtual ~CodeBuilder()=default
virtual VarAlloc getElementPtr(IRValue *Base, IRType BaseTy, size_t Index, IRType ElemTy)=0
virtual IRValue * createCmp(CmpOp Op, IRValue *LHS, IRValue *RHS, IRType Ty)=0
virtual IRFunction * addFunction(const std::string &Name, IRType RetTy, const std::vector< IRType > &ArgTys, bool IsKernel=false)=0
virtual IRValue * createAtomicMax(IRValue *Addr, IRValue *Val)=0
virtual IRValue * getArg(IRFunction *F, size_t Idx)=0
Return the Nth argument of F as an IRValue.
virtual IRValue * loadAddress(IRValue *Slot, IRType AllocTy)=0
Load the pointer stored in Slot (pointer alloca).
virtual void beginWhile(std::function< IRValue *()> CondFn, const char *File, int Line)=0
virtual IRValue * loadScalar(IRValue *Slot, IRType ValueTy)=0
Load the value stored directly in Slot (scalar alloca).
virtual IRValue * createAtomicSub(IRValue *Addr, IRValue *Val)=0
virtual IRValue * createCast(IRValue *V, IRType FromTy, IRType ToTy)=0
virtual void endFunction()=0
virtual void beginFunction(IRFunction *F, const char *File, int Line)=0
Set F as the active function and begin IR emission.
virtual IRValue * createNot(IRValue *Val)=0
virtual IRValue * createAtomicMin(IRValue *Addr, IRValue *Val)=0
virtual VarAlloc allocArray(const std::string &Name, AddressSpace AS, IRType ElemTy, size_t NElem)=0
virtual IRValue * createBitCast(IRValue *V, IRType DestTy)=0
virtual void createRetVoid()=0
virtual IRValue * createXor(IRValue *LHS, IRValue *RHS)=0
virtual IRValue * createAnd(IRValue *LHS, IRValue *RHS)=0
virtual void storeToPointee(IRValue *Slot, IRType AllocTy, IRValue *Val)=0
Dereference the pointer stored in Slot, then store Val to it.
virtual void createRet(IRValue *V)=0
virtual IRValue * getConstantInt(IRType Ty, uint64_t Val)=0
Definition IRFunction.h:9
Definition MemoryCache.h:27
AddressSpace
Definition AddressSpace.h:6
TargetModelType
Definition TargetModel.h:8
CodeBuilderKind
Definition CodeBuilder.h:66
ArithOp
Semantic arithmetic operation selector.
Definition CodeBuilder.h:43
CmpOp
Semantic comparison operation selector.
Definition CodeBuilder.h:46
void setLaunchBoundsForKernel(Function &F, int MaxThreadsPerSM, int MinBlocksPerSM=0)
Definition CoreLLVMCUDA.h:87
void reportFatalError(const llvm::Twine &Reason, const char *FILE, unsigned Line)
Definition Error.cpp:14
std::string toString(CodegenOption Option)
Definition Config.h:28
ScopeKind
Definition CodeBuilder.h:40
Definition CodeBuilder.h:21
bool Unroll
Definition CodeBuilder.h:22
std::optional< int > UnrollCount
Definition CodeBuilder.h:23
Definition CodeBuilder.h:29
unsigned AddrSpace
Address space (relevant for pointers/arrays).
Definition CodeBuilder.h:37
IRType ValueTy
Logical element type (pointee/element for pointer/array).
Definition CodeBuilder.h:33
IRValue * Slot
The alloca (or global base pointer for arrays).
Definition CodeBuilder.h:31
IRType AllocTy
Type of the alloca itself.
Definition CodeBuilder.h:35