diff options
Diffstat (limited to 'polly/lib/CodeGen/IslCodeGeneration.cpp')
-rw-r--r-- | polly/lib/CodeGen/IslCodeGeneration.cpp | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/polly/lib/CodeGen/IslCodeGeneration.cpp b/polly/lib/CodeGen/IslCodeGeneration.cpp index fd038b9fc9c..59e84763b0e 100644 --- a/polly/lib/CodeGen/IslCodeGeneration.cpp +++ b/polly/lib/CodeGen/IslCodeGeneration.cpp @@ -54,89 +54,6 @@ using namespace llvm; #define DEBUG_TYPE "polly-codegen-isl" -/// @brief 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. -class RuntimeDebugBuilder { -public: - RuntimeDebugBuilder(PollyIRBuilder &Builder) : Builder(Builder) {} - - /// @brief Print a string to stdout. - /// - /// @param String The string to print. - void createStrPrinter(std::string String); - - /// @brief Print an integer value to stdout. - /// - /// @param V The value to print. - void createIntPrinter(Value *V); - -private: - PollyIRBuilder &Builder; - - /// @brief Add a call to the fflush function with no file pointer given. - /// - /// This call will flush all opened file pointers including stdout and stderr. - void createFlush(); - - /// @brief 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. - Function *getPrintF(); -}; - -Function *RuntimeDebugBuilder::getPrintF() { - Module *M = Builder.GetInsertBlock()->getParent()->getParent(); - const char *Name = "printf"; - Function *F = M->getFunction(Name); - - if (!F) { - GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage; - FunctionType *Ty = - FunctionType::get(Builder.getInt32Ty(), Builder.getInt8PtrTy(), true); - F = Function::Create(Ty, Linkage, Name, M); - } - - return F; -} - -void RuntimeDebugBuilder::createFlush() { - Module *M = Builder.GetInsertBlock()->getParent()->getParent(); - const char *Name = "fflush"; - Function *F = M->getFunction(Name); - - if (!F) { - GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage; - FunctionType *Ty = - FunctionType::get(Builder.getInt32Ty(), Builder.getInt8PtrTy(), false); - F = Function::Create(Ty, Linkage, Name, M); - } - - Builder.CreateCall(F, Constant::getNullValue(Builder.getInt8PtrTy())); -} - -void RuntimeDebugBuilder::createStrPrinter(std::string String) { - Function *F = getPrintF(); - Value *StringValue = Builder.CreateGlobalStringPtr(String); - Builder.CreateCall(F, StringValue); - - createFlush(); -} - -void RuntimeDebugBuilder::createIntPrinter(Value *V) { - IntegerType *Ty = dyn_cast<IntegerType>(V->getType()); - (void)Ty; - assert(Ty && Ty->getBitWidth() == 64 && - "Cannot insert printer for this type."); - - Function *F = getPrintF(); - Value *String = Builder.CreateGlobalStringPtr("%ld"); - Builder.CreateCall2(F, String, V); - createFlush(); -} - /// @brief LLVM-IR generator for isl_ast_expr[essions] /// /// This generator generates LLVM-IR that performs the computation described by |