Polly 20.0.0git
Static Public Member Functions | Static Private Member Functions | List of all members
polly::RuntimeDebugBuilder Struct Reference

Insert function calls that print certain LLVM values at run time. More...

#include <RuntimeDebugBuilder.h>

Static Public Member Functions

static llvm::Value * getPrintableString (PollyIRBuilder &Builder, llvm::StringRef Str)
 Generate a constant string into the builder's llvm::Module which can be passed to createCPUPrinter().
 
static bool isPrintable (llvm::Type *Ty)
 Return whether an llvm::Value of the type Ty is printable for debugging.
 
template<typename... Args>
static void createCPUPrinter (PollyIRBuilder &Builder, Args... args)
 Print a set of LLVM-IR Values or StringRefs via printf.
 

Static Private Member Functions

template<typename... Args>
static void createPrinter (PollyIRBuilder &Builder, std::vector< llvm::Value * > &Values, llvm::Value *Value, Args... args)
 Handle Values.
 
template<typename... Args>
static void createPrinter (PollyIRBuilder &Builder, std::vector< llvm::Value * > &Values, llvm::StringRef String, Args... args)
 Handle StringRefs.
 
template<typename... Args>
static void createPrinter (PollyIRBuilder &Builder, std::vector< llvm::Value * > &Values, llvm::ArrayRef< llvm::Value * > Array, Args... args)
 Handle ArrayRefs.
 
static void createPrinter (PollyIRBuilder &Builder, llvm::ArrayRef< llvm::Value * > Values)
 Print a list of Values.
 
static void createCPUPrinterT (PollyIRBuilder &Builder, llvm::ArrayRef< llvm::Value * > Values)
 Print a list of Values on a CPU.
 
static llvm::Function * getPrintF (PollyIRBuilder &Builder)
 Get a reference to the 'printf' function.
 
static void createPrintF (PollyIRBuilder &Builder, std::string Format, llvm::ArrayRef< llvm::Value * > Values)
 Call printf.
 
static llvm::Function * getVPrintF (PollyIRBuilder &Builder)
 Get (and possibly insert) a vprintf declaration into the module.
 
static void createFlush (PollyIRBuilder &Builder)
 Call fflush.
 

Detailed Description

Insert function calls that print certain LLVM values at run time.

This class inserts libc function calls to print certain LLVM values at run time.

Definition at line 30 of file RuntimeDebugBuilder.h.

Member Function Documentation

◆ createCPUPrinter()

template<typename... Args>
static void polly::RuntimeDebugBuilder::createCPUPrinter ( PollyIRBuilder Builder,
Args...  args 
)
inlinestatic

Print a set of LLVM-IR Values or StringRefs via printf.

This function emits a call to printf that will print the given arguments. It is useful for debugging CPU programs. All arguments given in this list will be automatically concatenated and the resulting string will be printed atomically. We also support ArrayRef arguments, which can be used to provide of id values.

Parameters
BuilderThe builder used to emit the printer calls.
ArgsThe list of values to print.

Definition at line 61 of file RuntimeDebugBuilder.h.

References createPrinter().

Referenced by polly::PerfMonitor::AppendScopReporting(), polly::IslExprBuilder::createAccessAddress(), polly::IslNodeBuilder::createRTC(), polly::BlockGenerator::generateArrayLoad(), polly::BlockGenerator::generateBeginStmtTrace(), and polly::PerfMonitor::insertFinalReporting().

◆ createCPUPrinterT()

void RuntimeDebugBuilder::createCPUPrinterT ( PollyIRBuilder Builder,
llvm::ArrayRef< llvm::Value * >  Values 
)
staticprivate

Print a list of Values on a CPU.

Definition at line 104 of file RuntimeDebugBuilder.cpp.

References createFlush(), createPrintF(), and prepareValuesForPrinting().

◆ createFlush()

void RuntimeDebugBuilder::createFlush ( PollyIRBuilder Builder)
staticprivate

Call fflush.

@parma Builder The builder used to insert the code.

Definition at line 142 of file RuntimeDebugBuilder.cpp.

References Function, M(), and Module.

Referenced by createCPUPrinterT().

◆ createPrinter() [1/4]

static void polly::RuntimeDebugBuilder::createPrinter ( PollyIRBuilder Builder,
llvm::ArrayRef< llvm::Value * >  Values 
)
staticprivate

Print a list of Values.

◆ createPrinter() [2/4]

template<typename... Args>
static void polly::RuntimeDebugBuilder::createPrinter ( PollyIRBuilder Builder,
std::vector< llvm::Value * > &  Values,
llvm::ArrayRef< llvm::Value * >  Array,
Args...  args 
)
inlinestaticprivate

Handle ArrayRefs.

Definition at line 87 of file RuntimeDebugBuilder.h.

References polly::Array, and createPrinter().

◆ createPrinter() [3/4]

template<typename... Args>
static void polly::RuntimeDebugBuilder::createPrinter ( PollyIRBuilder Builder,
std::vector< llvm::Value * > &  Values,
llvm::StringRef  String,
Args...  args 
)
inlinestaticprivate

Handle StringRefs.

Definition at line 78 of file RuntimeDebugBuilder.h.

References createPrinter(), and getPrintableString().

◆ createPrinter() [4/4]

template<typename... Args>
static void polly::RuntimeDebugBuilder::createPrinter ( PollyIRBuilder Builder,
std::vector< llvm::Value * > &  Values,
llvm::Value *  Value,
Args...  args 
)
inlinestaticprivate

Handle Values.

Definition at line 69 of file RuntimeDebugBuilder.h.

References createPrinter(), and polly::Value.

Referenced by createCPUPrinter(), and createPrinter().

◆ createPrintF()

void RuntimeDebugBuilder::createPrintF ( PollyIRBuilder Builder,
std::string  Format,
llvm::ArrayRef< llvm::Value * >  Values 
)
staticprivate

Call printf.

Parameters
BuilderThe builder used to insert the code.
FormatThe format string.
ValuesThe set of values to print.

Definition at line 131 of file RuntimeDebugBuilder.cpp.

References getPrintF(), and polly::Value.

Referenced by createCPUPrinterT().

◆ getPrintableString()

llvm::Value * RuntimeDebugBuilder::getPrintableString ( PollyIRBuilder Builder,
llvm::StringRef  Str 
)
static

Generate a constant string into the builder's llvm::Module which can be passed to createCPUPrinter().

Parameters
BuilderThe builder used to emit the printer calls.
StrThe string to be printed.
Returns
A global containing Str.

Definition at line 19 of file RuntimeDebugBuilder.cpp.

References Str.

Referenced by createPrinter(), and polly::BlockGenerator::generateBeginStmtTrace().

◆ getPrintF()

Function * RuntimeDebugBuilder::getPrintF ( PollyIRBuilder Builder)
staticprivate

Get a reference to the 'printf' function.

If the current module does not yet contain a reference to printf, we insert a reference to it. Otherwise the existing reference is returned.

Definition at line 117 of file RuntimeDebugBuilder.cpp.

References Function, M(), and Module.

Referenced by createPrintF().

◆ getVPrintF()

Function * RuntimeDebugBuilder::getVPrintF ( PollyIRBuilder Builder)
staticprivate

Get (and possibly insert) a vprintf declaration into the module.

Definition at line 29 of file RuntimeDebugBuilder.cpp.

References Function, M(), and Module.

◆ isPrintable()

bool RuntimeDebugBuilder::isPrintable ( llvm::Type *  Ty)
static

Return whether an llvm::Value of the type Ty is printable for debugging.

That is, whether such a value can be passed to createGPUPrinter() to be dumped as runtime. If false is returned, those functions will fail.

Definition at line 49 of file RuntimeDebugBuilder.cpp.

Referenced by polly::BlockGenerator::generateBeginStmtTrace().


The documentation for this struct was generated from the following files: