I am looking into using polly, in conjunction with a set of passes that I am writing, to modify loop schedules/transform loops. I was wondering if there is a way to interface with polly directly through an LLVM pass? It seems by looking at the documentation, that the way to modify loop schedules is to generate the jscop files, modify them, and then reload them with polly, which is not a very “friendly” mechanism to do automatically in a pass. Is my understanding of the usage of polly correct here, or am I missing something?
You don't have to go through json per-se but Polly's design also wasn't for the use case you describe.
I cc'ed Michael who has some extensions (I think) that allow the frontend to decide how to modify the schedule.
You should be able to piggy back on that either through IR annotations or direct calls of the appropriate functions
in Polly that modify the schedule tree.
Best of luck
for passes that apply to SCoPs I would suggest to write a ScopPass
within polly. Importing/exporting a jscop file would be more something
for external tools. The reason is that from a LLVM loop- or
function-pass it is non-obvious what a SCoP (which is a loop nest that
fulfils the requirements for Polly's analysis to work) will be. A
ScopPass will just be invoked on previously detected SCoPs, can modify
them, and Polly will re-generate LLVM-IR again when all ScopPasses
have been applied.
I see. Thank you Michael, I will look into that. I'll reach out again if I have any other questions.
Is there any good resources you can point me to for a better understanding of the polly internals, something like LLVM’s “Programmer’s Guide” for instance?