[LLVMdev] Cast specific pointer type to generic one
David Blaikie
dblaikie at gmail.com
Sat Mar 29 17:26:26 PDT 2014
On Sat, Mar 29, 2014 at 3:55 PM, Tehila Mayzels
<tehila at cs.technion.ac.il> wrote:
> Hi,
>
>
>
> Suppose I have a pointer to "something" (a structure I defined) and I want
> to pass the pointer to a generic function, that gets a 64-bit address
> pointer.
>
> How do I do that?
>
>
>
> For instance:
>
> The function is:
>
> void Foo (void *);
>
> I get the specific pointer using getPointerOperand() on a store instruction
> that store to it:
>
> inst->getPointerOperand()->getType()
>
>
>
> Now I want to call Foo with the pointer, but the types of the arguments are
> mismatches - one is specific (%"class.XXX::YYY"*) and the other generic.
>
> How should I cast it so there won't be a mismatch?
Perhaps compiling similar code with Clang and looking at Clang's
generated IR would give you some insight into how that might be done.
>
>
>
> Thanks in advance,
>
> Tehila.
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
More information about the llvm-dev
mailing list