[LLVMdev] type of the store operand
Zheng Wang
jason.wangz at gmail.com
Fri May 14 08:50:10 PDT 2010
Hi John,
Thanks. In this case, if I call getType(), it will return a pointer
type. So, how do I know whether this is an pointer points to an
integer address?
On 14 May 2010 15:33, John Criswell <criswell at uiuc.edu> wrote:
> Zheng Wang wrote:
>>
>> Hiya,
>>
>> I want to know what's the type of the operand (value) along with the
>> store instruction. For example, the following instruction store the
>> content in an integer type pointer scevgep99.1 to the address another
>> integer pointer points to.
>>
>> *"store i8* %scevgep99.1, i8** %scevgep92.1, align 4"*
>>
>> It seems there is no APIs in StoreInst can do this.
>>
>> Is there any way to figure the type of the operand of the store
>> instruction?
>>
>
> You can do this by first using getOperand() to get the operand of the store
> instruction which interests you and then calling getType() on the resulting
> Value * to get the type of the value being stored.
>
> It'll look something like this if SI is a pointer to a StoreInst object and
> i is the index of the operand being stored to memory:
>
> SI->getOperand(i)->getType();
>
> -- John T.
>
>>
>> -----------------------------------
>>
>> %scevgep92.1 = bitcast i8* %scevgep.1 to i8** ; <i8**> [#uses=1]
>> %tmp96.1 = mul i32 %36, %41 ; <i32> [#uses=1]
>> %tmp97.1 = add i32 %tmp96.1, 32 ; <i32> [#uses=1]
>> %tmp98.1 = add i32 %tmp97.1, %61 ; <i32> [#uses=1]
>> %scevgep99.1 = getelementptr i8* %56, i32 %tmp98.1 ; <i8*> [#uses=1]
>> store i8* %scevgep99.1, i8** %scevgep92.1, align 4
>> %scevgep.2 = getelementptr i8* %0, i32 112 ; <i8*> [#uses=1]
>> %scevgep92.2 = bitcast i8* %scevgep.2 to i8** ; <i8**> [#uses=1]
>>
>> Cheers,
>> Zheng
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>
>
--
Best regards,
WANG Zheng
More information about the llvm-dev
mailing list