information about scops and statements

20 views
Skip to first unread message

Elouan Jeannot

unread,
Oct 28, 2021, 3:50:16 PM10/28/21
to Polly Development
Hello,
I allow myself to send a new message in this group because I search some informations about scops and statements  of scops.
At first I would like to have the text (same line than in the source code) of a statement. I saw in scopInfo.cpp that I can have instructions of a statement but I didn't see something for the real text of a statement in the class ScopStmt. So is there a method, an attribute or something else allowing to have the text of a statement?

Secondly, I would like to have the variable name that is involved in a dependence. So for that, it's pretty much the same than the first request, I searched in  DependenceInfo.cpp but I don"t find anything about that.

To finish, I would like like, if I can, to have the source file path of the code to compile. I searched but I didn't find any variable, attribut or kind like that.

Someone can help me to have these three informations please ?
Thanks a lot,
Best regards,
Elouan Jeannot

Michael Kruse

unread,
Oct 29, 2021, 10:19:19 AM10/29/21
to Elouan Jeannot, Polly Development
Am Do., 28. Okt. 2021 um 14:50 Uhr schrieb Elouan Jeannot
<elouan....@gmail.com>:
>
> Hello,
> I allow myself to send a new message in this group because I search some informations about scops and statements of scops.
> At first I would like to have the text (same line than in the source code) of a statement. I saw in scopInfo.cpp that I can have instructions of a statement but I didn't see something for the real text of a statement in the class ScopStmt. So is there a method, an attribute or something else allowing to have the text of a statement?

What is the "(real) text" of a statement?


> Secondly, I would like to have the variable name that is involved in a dependence. So for that, it's pretty much the same than the first request, I searched in DependenceInfo.cpp but I don"t find anything about that.

Polly works on the IR-level, which is a single static assignment form.
That is, after conversion to SSA by mem2reg or SROA, the variable
names are generally gone. You might be able get some of them back from
DebugInfo [1]


> To finish, I would like like, if I can, to have the source file path of the code to compile. I searched but I didn't find any variable, attribut or kind like that.

Either Module::getName() [2] or !llvm.dbg.cu metadata [3]

Michael

[1] https://www.llvm.org/docs/SourceLevelDebugging.html
[2] https://llvm.org/doxygen/classllvm_1_1Module.html#a4b3648156c20e8cf63c5eb07c56ab2fe
[3] https://llvm.org/docs/LangRef.html#dicompileunit
--
Tardyzentrismus verboten!

Elouan Jeannot

unread,
Oct 29, 2021, 10:37:02 AM10/29/21
to Polly Development
Hello,
Thanks for these information.
The text of the statement is the statement like it is in the source code in C like that for exemple : "C[i][j] += A[i][k] + B[k][j];".
I would like to have it to compare it with the source code (It's also for that I want the source file path) and to after get the line number of the statement in the C source file.

Michael Kruse

unread,
Oct 29, 2021, 10:44:22 AM10/29/21
to Elouan Jeannot, Polly Development
Am Fr., 29. Okt. 2021 um 09:37 Uhr schrieb Elouan Jeannot
<elouan....@gmail.com>:
> The text of the statement is the statement like it is in the source code in C like that for exemple : "C[i][j] += A[i][k] + B[k][j];".
> I would like to have it to compare it with the source code (It's also for that I want the source file path) and to after get the line number of the statement in the C source file.

As already mentioned, Polly does not operate on the source code level,
but on LLVM-IR. You may want to try a source-to-source tool such as
ppcg [1] or Pluto [2].

Michael

[1] https://repo.or.cz/ppcg.git
[2] http://pluto-compiler.sourceforge.net/

--
Tardyzentrismus verboten!

Elouan Jeannot

unread,
Nov 1, 2021, 12:27:43 PM11/1/21
to Polly Development
Hello,
Thanks for your answer.
I will do what I want to do with the llvm-ir, it will work too.
Thanks for your help

Reply all
Reply to author
Forward
0 new messages