This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Need info on GIMPLE
- From: Abdul Wahid Memon <engrwahidmemon at gmail dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 7 Jun 2011 19:59:21 +0200
- Subject: Re: Need info on GIMPLE
- References: <BANLkTi=pAivEtD=V+=tX1m16_E+BfRRSSg@mail.gmail.com> <mcr39jvtob0.fsf@coign.corp.google.com>
Thanks Ian
I am sorry if I posed the question in a different way, but I just want
to count the number of labels (not case labels) but for jump
instructions but I am unable to encounter GIMPLE_LABEL. By the way, if
there is a jump instruction (whether conditional or unconditional)
there must be a label reference. I want to count those label
references.
Regards
Abdul
On Tue, May 31, 2011 at 7:46 AM, Ian Lance Taylor <iant@google.com> wrote:
> Abdul Wahid Memon <engrwahidmemon@gmail.com> writes:
>
>> I need to count the number of labels present in the representation
>> such as after optimized pass, but
>> I dont know why I don't encounter label statement in my switch
>> statement's case clause even though
>> there are some labels present. I am using iterators over basic blocks
>> and statement to determine how many
>> statement are there and which type.
>>
>> ?FOR_EACH_BB(bb)
>> ? {
>> ? ?for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
>> ? ? ? {
>>
>> ? ? ? switch(gimple_code(stmt))
>> ? ? ? ? {
>> ? ? ? ? ? case GIMPLE_NOP:
>> ? ? ? ? ? printf("NOP : ");
>> ? ? ? ? ? break;
>> ? ? ? ? case GIMPLE_COND:
>> ? ? ? ? ? printf("COND_STMT / ");
>> ? ? ? ? ? break;
>> ? ? ? ? case GIMPLE_LABEL:
>> ? ? ? ? ? printf("LABEL / ");
>> ? ? ? ? ? break;
>> ? ? ? ? }
>> ? ? }
>> }
>>
>> Other cases are being matched such as GIMPLE_COND but not
>> GIMPLE_LABEL. Is there anything I am missing.
>
> Case labels are never GIMPLE_LABEL statements. ?Either the switch is
> turned into a series of conditionals and the labels are discarded, or
> you get a GIMPLE_SWITCH which incorporates CASE_LABEL_EXPR tree nodes
> (see GIMPLE_SWITCH in gimple.def).
>
> Ian
>