CAMLprim value llvm_struct_name(LLVMTypeRef Ty)
{
CAMLparam0();
+ CAMLlocal1(result);
const char *C = LLVMGetStructName(Ty);
if (C) {
- CAMLlocal1(result);
result = caml_alloc_small(1, 0);
Store_field(result, 0, caml_copy_string(C));
CAMLreturn(result);
CAMLprim value llvm_classify_value(LLVMValueRef Val) {
CAMLparam0();
+ CAMLlocal1(result);
if (!Val)
CAMLreturn(Val_int(NullValue));
if (LLVMIsAConstant(Val)) {
DEFINE_CASE(Val, ConstantVector);
}
if (LLVMIsAInstruction(Val)) {
- CAMLlocal1(result);
result = caml_alloc_small(1, 0);
Store_field(result, 0, Val_int(LLVMGetInstructionOpcode(Val)));
CAMLreturn(result);
/* llvalue -> string option */
CAMLprim value llvm_get_mdstring(LLVMValueRef V) {
CAMLparam0();
+ CAMLlocal2(Option, Str);
const char *S;
unsigned Len;
if ((S = LLVMGetMDString(V, &Len))) {
- CAMLlocal2(Option, Str);
-
Str = caml_alloc_string(Len);
memcpy(String_val(Str), S, Len);
Option = alloc(1,0);