Hello,
I am doing some inter-procedural analysis and suppose I have encountered
the following function calls:
int a = foo(b, c);
And I have accessed a tree representing foo as follows:
tree func_decl = gimple_call_fndecl(stmt); // stmt is the
function call statement
where func_de
On 2/16/21 9:51 AM, Shuai Wang via Gcc wrote:
However, can I proceed further to get the function* of "foo"? I checked
Hello.
Yes, you can call DECL_STRUCT_FUNCTION(func_decl).
Martin
Thank you for your reply!
I tried to use this in the following code:
tree func_decl = gimple_call_fndecl(stmt); // stmt is the function call
statement
function* f = DECL_STRUCT_FUNCTION(func_decl);
std::cerr << get_name(f->decl) << std::endl;
However, it seems the last line throws an exception
On Tue, 16 Feb, 2021, 5:55 PM Shuai Wang via Gcc, wrote:
> Thank you for your reply!
>
> I tried to use this in the following code:
>
> tree func_decl = gimple_call_fndecl(stmt); // stmt is the function call
> statement
> function* f = DECL_STRUCT_FUNCTION(func_decl);
> std::cerr << get_name(f->
Hello Shubham,
Thank you for the reply! I see. That's strange, the `f` pointer turns out
to be invalid. May I ask when would the corresponding struct be
initialized?
And I am attaching the corresponding GIMPLE IR code. As you can see, I am
traversing to the following statement:
r_9 = foo (a_6, d
On 2/16/21 1:13 PM, Shuai Wang wrote:
std::cerr << get_name(f->decl) << std::endl;
You likely want to use cgraph_node::get (f->decl)->name ()
Martin
Hello Martin,
Thanks for the information. I tried but it's the same error. Is it possibly
due to some bugs or something? I use gcc 10.1.0.
Best,
Shuai
On Wed, Feb 17, 2021 at 2:36 AM Martin Liška wrote:
> On 2/16/21 1:13 PM, Shuai Wang wrote:
> > std::cerr << get_name(f->decl) << std::endl;
>
I think the gist is that the recovered pointer itself is somehow NULL:
tree current_fn_decl = gimple_call_fndecl(stmt);
if (!current_fn_decl) return false; // *this won't execute*
struct function* fs0 = DECL_STRUCT_FUNCTION(current_fn_decl);
if (!f
Hello,
I am writing to inquire if there was any working example of GIMPLE
SIMPLE_IPA_PASS that I can follow and extend. I am familiar with doing
GIMPLE_PASS for intra-procedural analysis.
I tried to follow these threads:
https://www.cse.iitb.ac.in/grc/gcc-workshop-10/sources/slides/gccw10-gimple
Thank you again for the help. I think the root cause is that instead of
using GIMPLE_PASS, my analysis requires to do IPA. I am struggling in
switching to SIMPLE_IPA_PASS now
Best,
Shuai
On Wed, Feb 17, 2021 at 8:41 AM Shuai Wang wrote:
> I think the gist is that the recovered pointer itsel
10 matches
Mail list logo