public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Help about plugins - GIMPLE_COND
@ 2023-01-30 13:42 Pierrick Philippe
  0 siblings, 0 replies; only message in thread
From: Pierrick Philippe @ 2023-01-30 13:42 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1446 bytes --]

Hi everyone,

I'm playing around on GCC version 11.3 (build Ubuntu), with plugins and 
passes running on GCC IL, |GIMPLE| in its SSA form to be precise.
But I face an issue with |GIMPLE_COND| statement.

Here is my example statement (output from |debug_gimple_stmt()|):

|if (a_3 == x.0_1) |

Here is the basic bloc containing the statement (dump from 
|gimple_debug_bb()|):

|;; basic block 2, loop depth 0 ;; pred: ENTRY a_3 = 5; # VUSE 
<.MEM_4(D)> x.0_1 = x; if (a_3 == x.0_1) goto <bb 3>; [INV] else goto 
<bb 4>; [INV] ;; succ: 3 ;; 4 |

So, things I'm having trouble with is that when I'm calling 
|gimple_cond_{true,false}_label()| on the |GIMPLE_COND| statement 
(casted through |as_a<gcond*>()|), I get a null pointer for both of 
them, and I do not understand why.

My first intuition is that here |goto|s is not branching on any label 
but on basic bloc directly somehow explain it.
I have been told to use extract_true_false_edges_from_block(), and it do 
works.
Though this is not really what I was expecting as I get an edge and not 
a tree nor a gimple *.
By the way, extract_true_false_edges_from_block() is not mention inside 
the internal documentation, whereas gimple_cond_{true,false}_label() is.

Anyway, my question is regarding the gimple_cond_{true,false}_label() 
function.
I can't find any use case where this function is not returning nullptr, 
so what could be its typical use(s) case(s)?

Cheers,

Pierrick Philippe

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-30 13:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-30 13:42 Help about plugins - GIMPLE_COND Pierrick Philippe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).