[LLVMdev] Python bindings available.

Mahadevan R mdevan.foobar at gmail.com
Sun May 11 22:16:27 PDT 2008


>  Certainly. There are advantages to using the "up, prev, next" pointers
>  embedded within the IR in some circumstances, though. Consider what if
>  'do stuff with inst' might entail deleting another related
>  instruction, where that instruction might appear later in
>  reversed(block.instructions)--dangling pointer, boom! :) On the other

OK, that makes sense. I'll use first-class iterators.

Python iterators don't support reverse iteration though. Even if the container
supports it (ala rbegin/rend in C++). The "iterator protocol" is defined only
for forward iteration. That's why the "reversed()" idiom.

BTW, I didn't find any APIs for deleting an instruction?

>  hand, creating a copy as your code presumably does is also sometimes
>  exactly what's wanted... TMTOWTDI, as they say.

Pythoners will disagree -- see 'python -c "import this"' ;-)

Regards,
-Mahadevan.



More information about the llvm-dev mailing list