1#ifndef PROTEUS_PASS_HELPERS_H
2#define PROTEUS_PASS_HELPERS_H
4#include <llvm/ADT/SetVector.h>
5#include <llvm/Demangle/Demangle.h>
6#include <llvm/IR/Module.h>
7#include <llvm/TargetParser/Triple.h>
13#define DEBUG_TYPE "proteus-pass"
16 if (isDebugOutputEnabled()) { \
26#elif PROTEUS_ENABLE_CUDA
54 const char *
EnvValue = std::getenv(
"PROTEUS_DEBUG_OUTPUT");
63 Triple TargetTriple(M.getTargetTriple());
65 <<
"TargetTriple " << M.getTargetTriple() <<
"\n");
66 if (TargetTriple.isNVPTX() || TargetTriple.isAMDGCN())
73 llvm::sys::fs::UniqueID ID;
74 if (
auto EC = llvm::sys::fs::getUniqueID(M.getSourceFileName(), ID))
82 return std::string(
Out);
89#if PROTEUS_ENABLE_CUDA
90 const Module &M = *F->getParent();
98 for (
auto *
Op :
MD->operands()) {
99 if (
Op->getNumOperands() < 2)
106 mdconst::dyn_extract_or_null<Function>(
Op->getOperand(0));
129#if PROTEUS_ENABLE_HIP
130 return (F->getCallingConv() == CallingConv::AMDGPU_KERNEL);
159 return ((
LHS.ArgInfo.Type ==
RHS.ArgInfo.Type) &&
160 (
LHS.ArgInfo.Pos ==
RHS.ArgInfo.Pos));
#define PROTEUS_FATAL_ERROR(x)
Definition Error.h:7
constexpr char const * LaunchFunctionName
Definition Helpers.h:33
#define DEBUG(x)
Definition Helpers.h:14
constexpr char const * RegisterFunctionName
Definition Helpers.h:32
constexpr char const * RegisterVarName
Definition Helpers.h:34
constexpr char const * RegisterFatBinaryName
Definition Helpers.h:35
static llvm::raw_ostream & logs(const std::string &Name)
Definition Logger.hpp:19
Definition BuiltinsCUDA.cpp:4
@ END
Definition CompilerInterfaceTypes.h:35
@ BEGIN
Definition CompilerInterfaceTypes.h:21
bool isDeviceKernel(const Function *F)
Definition Helpers.h:85
T getRuntimeConstantValue(void *Arg)
Definition CompilerInterfaceRuntimeConstantInfo.h:114
std::string getUniqueFileID(Module &M)
Definition Helpers.h:72
bool isDebugOutputEnabled()
Definition Helpers.h:52
bool isDeviceCompilation(Module &M)
Definition Helpers.h:62
static bool isEqual(const RuntimeConstantInfo &LHS, const RuntimeConstantInfo &RHS)
Definition Helpers.h:157
static unsigned getHashValue(const RuntimeConstantInfo &Val)
Definition Helpers.h:153
static RuntimeConstantInfo getEmptyKey()
Definition Helpers.h:143
static RuntimeConstantInfo getTombstoneKey()
Definition Helpers.h:148
std::string ModuleIR
Definition Helpers.h:44
SmallSetVector< RuntimeConstantInfo, 16 > ConstantArgs
Definition Helpers.h:43
ModuleInfo(const Module &M)
Definition Helpers.h:49
const Module & M
Definition Helpers.h:48
Definition CompilerInterfaceRuntimeConstantInfo.h:61