[LLVMdev] SwitchInst::addCase with BlockAddress

Carlo Alberto Ferraris cafxx at strayorange.com
Sun Jul 31 07:36:14 PDT 2011

I'm trying to figure out how to feed a blockaddress to a switch 
condition AND destination (basically emulating an indirectbr via a 
switch; I know it's not a good approach, I'm just experimenting).
Suppose I have the following:

SwitchInst *s = SwitchInst::Create(...);
BasicBlock *bb = ...;
PtrToIntInst k = new PtrToIntInst(BlockAddress::get(bb), <TYPE>, "", s);
s->addCase(k, bb);

is this reasonable? what should I put in place of <TYPE> (the type to 
cast to)?
Carlo Alberto Ferraris <cafxx at strayorange.com 
<mailto:cafxx at strayorange.com>>
website/blog <http://cafxx.strayorange.com> - +39 333 7643 235
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110731/fa1e0254/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cafxx.vcf
Type: text/x-vcard
Size: 233 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110731/fa1e0254/attachment.vcf>

More information about the llvm-dev mailing list