[PATCH] Ocaml binding update for fast math flags optimisation

J. Charles N. MBIADA jcharles.nmbiada at gmail.com
Sat Jul 12 12:49:10 PDT 2014


Ok I managed to remove the enumeration part from Core.h and to define the associates macro in the binding part (llvm_ocaml.c).
But something does not work as well. I want to use the convert_flag_list but that function cause a segmentation fault (core dump).

int fmf_mask_of_flag_list(value flag_list){
  // can be ... = {(1 << 0), (1 << 1), (1 << 2), (1 << 3), (1 << 4)} but unreadable ...
  int *flag_tab = {FMF_FAST, FMF_NNAN, FMF_NINF, FMF_NSZ, FMF_ARCP};
  int converted_flags = 0;
  converted_flags = convert_flag_list(flag_list, flag_tab); // this line cause the segfault
  return converted_flags;
}

and convert_flag_list definition should looks like 

int convert_flag_list(value list, int *flags)
{
  int res;
  res = 0;
  while (list != Val_int(0)) {
    res |= flags[Int_val(Field(list, 0))];
    list = Field(list, 1);
  }
  return res;
}
I'am looking for a designed solution before update this. But if you have an idea about the seg fault, let me know.

Thanks.

http://reviews.llvm.org/D4423






More information about the llvm-commits mailing list