2022-01-12 00:01:42 +08:00
|
|
|
#ifndef __NVVM2x86_TOOL__
|
|
|
|
#define __NVVM2x86_TOOL__
|
|
|
|
|
2022-06-18 10:20:13 +08:00
|
|
|
#include "llvm/IR/IRBuilder.h"
|
|
|
|
#include "llvm/IR/Instructions.h"
|
2022-01-12 00:01:42 +08:00
|
|
|
#include "llvm/IR/Module.h"
|
|
|
|
llvm::Module *LoadModuleFromFilr(char *file_name);
|
|
|
|
void DumpModule(llvm::Module *M, char *file_name);
|
|
|
|
bool isKernelFunction(llvm::Module *M, llvm::Function *F);
|
|
|
|
void replace_block(llvm::Function *F, llvm::BasicBlock *before,
|
|
|
|
llvm::BasicBlock *after);
|
|
|
|
llvm::CallInst *CreateInterWarpBarrier(llvm::Instruction *InsertBefore);
|
|
|
|
llvm::CallInst *CreateIntraWarpBarrier(llvm::Instruction *InsertBefore);
|
|
|
|
void VerifyModule(llvm::Module *);
|
|
|
|
void phi2alloc(llvm::Module *M);
|
|
|
|
void remove_cuda_built_in(llvm::Module *M);
|
2022-05-04 20:59:38 +08:00
|
|
|
void replace_built_in_function(llvm::Module *M);
|
2022-01-12 00:01:42 +08:00
|
|
|
void replace_asm_call(llvm::Module *M);
|
|
|
|
bool find_block_barrier_in_region(llvm::BasicBlock *start,
|
|
|
|
llvm::BasicBlock *end);
|
|
|
|
bool find_barrier_in_region(llvm::BasicBlock *start, llvm::BasicBlock *end);
|
|
|
|
bool has_warp_barrier(llvm::BasicBlock *B);
|
|
|
|
bool has_barrier(llvm::BasicBlock *B);
|
|
|
|
bool has_block_barrier(llvm::BasicBlock *B);
|
|
|
|
bool has_barrier(llvm::Function *F);
|
2022-05-04 20:59:38 +08:00
|
|
|
void replace_dynamic_shared_memory(llvm::Module *M);
|
2022-06-18 10:20:13 +08:00
|
|
|
llvm::LoadInst *createLoad(llvm::IRBuilder<> &B, llvm::Value *addr,
|
|
|
|
bool isVolatile = false);
|
|
|
|
llvm::Value *createInBoundsGEP(llvm::IRBuilder<> &B, llvm::Value *ptr,
|
|
|
|
llvm::ArrayRef<llvm::Value *> idxlist);
|
|
|
|
llvm::Value *createGEP(llvm::IRBuilder<> &B, llvm::Value *ptr,
|
|
|
|
llvm::ArrayRef<llvm::Value *> idxlist);
|
2022-01-12 00:01:42 +08:00
|
|
|
#endif
|