#include "AMDGPU.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/DataExtractor.h"
#include "llvm/TargetParser/Triple.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
usingnamespacellvm;
#define DEBUG_TYPE …
enum { … };
namespace {
class AMDGPUPrintfRuntimeBinding final : public ModulePass { … };
class AMDGPUPrintfRuntimeBindingImpl { … };
}
char AMDGPUPrintfRuntimeBinding::ID = …;
INITIALIZE_PASS_BEGIN(AMDGPUPrintfRuntimeBinding,
"amdgpu-printf-runtime-binding", "AMDGPU Printf lowering",
false, false)
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
INITIALIZE_PASS_END(AMDGPUPrintfRuntimeBinding, "amdgpu-printf-runtime-binding",
"AMDGPU Printf lowering", false, false)
char &llvm::AMDGPUPrintfRuntimeBindingID = …;
namespace llvm {
ModulePass *createAMDGPUPrintfRuntimeBinding() { … }
}
AMDGPUPrintfRuntimeBinding::AMDGPUPrintfRuntimeBinding() : … { … }
void AMDGPUPrintfRuntimeBindingImpl::getConversionSpecifiers(
SmallVectorImpl<char> &OpConvSpecifiers, StringRef Fmt,
size_t NumOps) const { … }
static bool shouldPrintAsStr(char Specifier, Type *OpType) { … }
constexpr StringLiteral NonLiteralStr("???");
static_assert …;
static StringRef getAsConstantStr(Value *V) { … }
static void diagnoseInvalidFormatString(const CallBase *CI) { … }
bool AMDGPUPrintfRuntimeBindingImpl::lowerPrintfForGpu(Module &M) { … }
bool AMDGPUPrintfRuntimeBindingImpl::run(Module &M) { … }
bool AMDGPUPrintfRuntimeBinding::runOnModule(Module &M) { … }
PreservedAnalyses
AMDGPUPrintfRuntimeBindingPass::run(Module &M, ModuleAnalysisManager &AM) { … }