Allow arbitrary function calls for debugging purposes.
commit873c034f9fa1ac66b3c8eafd66fc47f3655ca656
authorMichael Kruse <llvm@meinersbur.de>
Fri, 20 Apr 2018 18:55:44 +0000 (20 18:55 +0000)
committerMichael Kruse <llvm@meinersbur.de>
Fri, 20 Apr 2018 18:55:44 +0000 (20 18:55 +0000)
tree78a70557e9afcf3726a38e984fc098238e255548
parentf3748256a42faf0878df0d06c4c9cf14c99801ff
Allow arbitrary function calls for debugging purposes.

Add the switch -polly-debug-func to define the name of a debug
function. This function is ignored for any validity check.

Its purpose is to allow to observe a value after transformation by a
SCoP, and to follow which statements are executed in which order. For
instance, consider the following code:

    static void dbg_printf(int sum, int i) {
      fprintf(stderr, "The value of sum is %d, i=%d\n", sum, i);
      fflush(stderr);
    }

    void func(int n) {
      int sum = 0;
      for (int i = 0; i < 16; i+=1) {
        sum += i;
        dbg_printf(sum, i);
      }
    }

Executing this after Polly's codegen with -polly-debug-func=dbg_printf
reveals the new execution order and the assumed values at that point of
execution.

Differential Revision: https://reviews.llvm.org/D45728

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@330466 91177308-0d34-0410-b5e6-96231b3b80d8
include/polly/Support/ScopHelper.h
lib/Analysis/ScopBuilder.cpp
lib/Analysis/ScopDetection.cpp
lib/Analysis/ScopInfo.cpp
lib/Support/ScopHelper.cpp
test/ScopInfo/debug_call.ll [new file with mode: 0644]