[llvm-commits] [PATCH] Add bindings for walking the instruction stream.

Erick Tryzelaar idadesub at users.sourceforge.net
Wed Mar 19 23:59:32 PDT 2008


Use some of the new features that gordonh provided. However, I don't think
we need to use everything:

Since the LLVMGetLastInstruction actually returns one past the last
instruction that is mainly used for c++style iteration. Since we already
have to protect against next_instr and etc from returning a null pointer,
 we can already model "last_instr" as "None".

I don't think we need position_builder as proposed. It's more of a
convenience function so that you don't have to write "match next_instr i
with ...", but I don't think you need it that often, and it's trivial to
write a function in the client to do that for us. I've added a couple
wrapper scripts that (I think) would be more common, position_at_start and
position_after, that will also safely handle builders without any
instructions in them.

Finally, I migrated a couple functions from llvm_ocaml.c to llvm.ml. While
this probably doesn't make a difference, it might allow ocaml to do some
more optimizations.
---
 bindings/ocaml/llvm/llvm.ml      |   63 ++++++++++++++++++++++++++++++++++++--
 bindings/ocaml/llvm/llvm.mli     |   41 +++++++++++++++++++++++-
 bindings/ocaml/llvm/llvm_ocaml.c |   52 +++++++++++++++++++++++--------
 3 files changed, 137 insertions(+), 19 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 62d2fef36333ef0843e6f1ba8471616d627e9e0a.diff
Type: text/x-patch
Size: 8271 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20080319/581f3b8f/attachment.bin>


More information about the llvm-commits mailing list