Re: [go-nuts] Go ssa instruction type

2018-04-04 Thread Sebastien Binet
Arpit,


On Wed, Apr 4, 2018 at 1:40 PM, Arpit Aggarwal 
wrote:

> Thank you very much Sebastien,
> this is very helpful. I didn't know about the type switches.
> Also do you know anything by which i can simply print the type rather than
> adding a case for every type.
>

fmt.Printf("instruction= %T\n", instr)

should do.
hth,
-s

>
>
> On Wednesday, April 4, 2018 at 5:00:12 PM UTC+5:30, Sebastien Binet wrote:
>>
>> Hi,
>>
>> You just have to type-switch on the ssa.Instruction value.
>>
>> hth,
>> -s
>>
>> sent from my droid
>>
>> On Wed, Apr 4, 2018, 13:21 Arpit Aggarwal  wrote:
>>
>>> Hi everybody,
>>>
>>> I am using Go SSA for analysis purposes in my project.
>>>
>>> The BasicBlock type in Go ssa contains Instrs[] of type []Instruction.
>>> But Instruction type is not able to tell me which type of instruction is
>>> it (BinOp, Unop etc). There is no function if Instruction interface which
>>> can tell me about the type of instruction
>>> Is there a way to retriece that information.
>>>
>>> Thanks in advance
>>> Arpit
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "golang-nuts" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to golang-nuts...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Go ssa instruction type

2018-04-04 Thread Sebastien Binet
Arpit,


On Wed, Apr 4, 2018 at 1:40 PM, Arpit Aggarwal 
wrote:

> Thank you very much Sebastien,
> this is very helpful. I didn't know about the type switches.
> Also do you know anything by which i can simply print the type rather than
> adding a case for every type.
>

fmt.Printf("instruction= %T\n", instr)

should do.
hth,
-s

>
>
> On Wednesday, April 4, 2018 at 5:00:12 PM UTC+5:30, Sebastien Binet wrote:
>>
>> Hi,
>>
>> You just have to type-switch on the ssa.Instruction value.
>>
>> hth,
>> -s
>>
>> sent from my droid
>>
>> On Wed, Apr 4, 2018, 13:21 Arpit Aggarwal  wrote:
>>
>>> Hi everybody,
>>>
>>> I am using Go SSA for analysis purposes in my project.
>>>
>>> The BasicBlock type in Go ssa contains Instrs[] of type []Instruction.
>>> But Instruction type is not able to tell me which type of instruction is
>>> it (BinOp, Unop etc). There is no function if Instruction interface which
>>> can tell me about the type of instruction
>>> Is there a way to retriece that information.
>>>
>>> Thanks in advance
>>> Arpit
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "golang-nuts" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to golang-nuts...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Go ssa instruction type

2018-04-04 Thread Arpit Aggarwal
Got it using reflect package.

Still thanks a lot buddy.


On Wednesday, April 4, 2018 at 5:10:01 PM UTC+5:30, Arpit Aggarwal wrote:
>
> Thank you very much Sebastien,
> this is very helpful. I didn't know about the type switches.
> Also do you know anything by which i can simply print the type rather than 
> adding a case for every type.
>  
>
> On Wednesday, April 4, 2018 at 5:00:12 PM UTC+5:30, Sebastien Binet wrote:
>>
>> Hi,
>>
>> You just have to type-switch on the ssa.Instruction value.
>>
>> hth,
>> -s
>>
>> sent from my droid
>>
>> On Wed, Apr 4, 2018, 13:21 Arpit Aggarwal  wrote:
>>
>>> Hi everybody,
>>>
>>> I am using Go SSA for analysis purposes in my project.
>>>
>>> The BasicBlock type in Go ssa contains Instrs[] of type []Instruction. 
>>> But Instruction type is not able to tell me which type of instruction is 
>>> it (BinOp, Unop etc). There is no function if Instruction interface which 
>>> can tell me about the type of instruction
>>> Is there a way to retriece that information.
>>>
>>> Thanks in advance
>>> Arpit
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "golang-nuts" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to golang-nuts...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Go ssa instruction type

2018-04-04 Thread Arpit Aggarwal
Thank you very much Sebastien,
this is very helpful. I didn't know about the type switches.
Also do you know anything by which i can simply print the type rather than 
adding a case for every type.
 

On Wednesday, April 4, 2018 at 5:00:12 PM UTC+5:30, Sebastien Binet wrote:
>
> Hi,
>
> You just have to type-switch on the ssa.Instruction value.
>
> hth,
> -s
>
> sent from my droid
>
> On Wed, Apr 4, 2018, 13:21 Arpit Aggarwal  > wrote:
>
>> Hi everybody,
>>
>> I am using Go SSA for analysis purposes in my project.
>>
>> The BasicBlock type in Go ssa contains Instrs[] of type []Instruction. 
>> But Instruction type is not able to tell me which type of instruction is 
>> it (BinOp, Unop etc). There is no function if Instruction interface which 
>> can tell me about the type of instruction
>> Is there a way to retriece that information.
>>
>> Thanks in advance
>> Arpit
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Go ssa instruction type

2018-04-04 Thread Sebastien Binet
Hi,

You just have to type-switch on the ssa.Instruction value.

hth,
-s

sent from my droid

On Wed, Apr 4, 2018, 13:21 Arpit Aggarwal  wrote:

> Hi everybody,
>
> I am using Go SSA for analysis purposes in my project.
>
> The BasicBlock type in Go ssa contains Instrs[] of type []Instruction.
> But Instruction type is not able to tell me which type of instruction is
> it (BinOp, Unop etc). There is no function if Instruction interface which
> can tell me about the type of instruction
> Is there a way to retriece that information.
>
> Thanks in advance
> Arpit
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.