[LLVMdev] OCaml binding and basic blocks

jeremy.dubreil at free.fr jeremy.dubreil at free.fr
Tue Apr 24 09:33:58 PDT 2012


Hello everyone,

I am using the OCaml binding to read and manipulate llvm bitcode and I have trouble to read the basic blocks of functions. The OCaml functions iter_blocks and fold_left_blocks are always behaving as if the list of blocks is empty, whatever the input file. 

Also, if I dump the following function:

	define i32 @add(i32 %x, i32 %y) nounwind uwtable ssp {
  		%1 = alloca i32, align 4
  		%2 = alloca i32, align 4
  		%z = alloca i32, align 4
		....
  		%6 = load i32* %z, align 4
  		ret i32 %6
	}

using the binding, I get:

	; Materializable
	declare i32 @add(i32, i32) nounwind uwtable ssp

Does anybody know how I can "materialize" the llvm functions and browse the basic blocks ?

Cheers,

Jeremy



More information about the llvm-dev mailing list