Exemplo n.º 1
0
/* ExecutionEngine.t -> Llvm_target.DataLayout.t */
CAMLprim value llvm_ee_get_data_layout(LLVMExecutionEngineRef EE) {
  value DataLayout;
  LLVMTargetDataRef OrigDataLayout;
  char* TargetDataCStr;

  OrigDataLayout = LLVMGetExecutionEngineTargetData(EE);
  TargetDataCStr = LLVMCopyStringRepOfTargetData(OrigDataLayout);
  DataLayout = llvm_alloc_data_layout(LLVMCreateTargetData(TargetDataCStr));
  LLVMDisposeMessage(TargetDataCStr);

  return DataLayout;
}
Exemplo n.º 2
0
/* TargetMachine.t -> DataLayout.t */
CAMLprim value llvm_targetmachine_data_layout(value Machine) {
  CAMLparam1(Machine);
  CAMLlocal1(DataLayout);

  /* LLVMGetTargetMachineData returns a pointer owned by the TargetMachine,
     so it is impossible to wrap it with llvm_alloc_target_data, which assumes
     that OCaml owns the pointer. */
  LLVMTargetDataRef OrigDataLayout;
  OrigDataLayout = LLVMGetTargetMachineData(TargetMachine_val(Machine));

  char* TargetDataCStr;
  TargetDataCStr = LLVMCopyStringRepOfTargetData(OrigDataLayout);
  DataLayout = llvm_alloc_data_layout(LLVMCreateTargetData(TargetDataCStr));
  LLVMDisposeMessage(TargetDataCStr);

  CAMLreturn(DataLayout);
}
Exemplo n.º 3
0
/* string -> DataLayout.t */
CAMLprim value llvm_datalayout_of_string(value StringRep) {
  return llvm_alloc_data_layout(LLVMCreateTargetData(String_val(StringRep)));
}
Exemplo n.º 4
0
/* TargetMachine.t -> DataLayout.t */
CAMLprim value llvm_targetmachine_data_layout(value Machine) {
  return llvm_alloc_data_layout(LLVMCreateTargetDataLayout(
                                TargetMachine_val(Machine)));
}