[LLVMdev] Taking invoke instructions' labels

Duncan Sands baldrick at free.fr
Thu Dec 29 02:18:26 PST 2011


Hi Schuhmacher,

> I am writing a pass, that does something on strings. It's a long story, so I
> will write shortly.
> If I have an iterator on invoke instruction, how can I take its label parameters?
> For example,
> invoke void @_ZNSsC1EPKcRKSaIcE(%"class.std::basic_string"* %str, i8*
> getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0), %"class.std::allocator"* %2)
>            to label %7 unwind label %20
>
> Here I am trying to get the label %7 and  label %20 . Is that possible? We have
> tried just to increment our iterator, but it didn't help...

if I is an InvokeInst*, then I->getNormalDest() gets you the basic block you get
to if no exception is unwound, while I->getUnwindDest() gets the basic block you
unwind to.

Ciao, Duncan.



More information about the llvm-dev mailing list