mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[NFC][OCaml] Reformat to clean up following CAMLprim removal
The removal of CAMLprim left the code in need of an application of clang-format. There are various other changes made by clang-format which it seems ought to be rolled together into this diff. Differential Revision: https://reviews.llvm.org/D99477
This commit is contained in:
parent
ed4db92995
commit
5dc0418f1b
@ -26,7 +26,8 @@ LLVMModuleRef llvm_get_module(LLVMContextRef C, LLVMMemoryBufferRef MemBuf) {
|
||||
LLVMModuleRef M;
|
||||
|
||||
if (LLVMGetBitcodeModuleInContext2(C, MemBuf, &M))
|
||||
llvm_raise(*caml_named_value("Llvm_bitreader.Error"), LLVMCreateMessage(""));
|
||||
llvm_raise(*caml_named_value("Llvm_bitreader.Error"),
|
||||
LLVMCreateMessage(""));
|
||||
|
||||
return M;
|
||||
}
|
||||
@ -36,7 +37,8 @@ LLVMModuleRef llvm_parse_bitcode(LLVMContextRef C, LLVMMemoryBufferRef MemBuf) {
|
||||
LLVMModuleRef M;
|
||||
|
||||
if (LLVMParseBitcodeInContext2(C, MemBuf, &M))
|
||||
llvm_raise(*caml_named_value("Llvm_bitreader.Error"), LLVMCreateMessage(""));
|
||||
llvm_raise(*caml_named_value("Llvm_bitreader.Error"),
|
||||
LLVMCreateMessage(""));
|
||||
|
||||
return M;
|
||||
}
|
||||
|
@ -248,8 +248,9 @@ LLVMMetadataRef llvm_dibuild_create_file(value Builder, value Filename,
|
||||
caml_string_length(Directory));
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_create_module_native(
|
||||
value Builder, LLVMMetadataRef ParentScope, value Name, value ConfigMacros,
|
||||
LLVMMetadataRef
|
||||
llvm_dibuild_create_module_native(value Builder, LLVMMetadataRef ParentScope,
|
||||
value Name, value ConfigMacros,
|
||||
value IncludePath, value SysRoot) {
|
||||
return LLVMDIBuilderCreateModule(
|
||||
DIBuilder_val(Builder), ParentScope, String_val(Name),
|
||||
@ -259,8 +260,7 @@ LLVMMetadataRef llvm_dibuild_create_module_native(
|
||||
caml_string_length(SysRoot));
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_create_module_bytecode(value *argv,
|
||||
int argn) {
|
||||
LLVMMetadataRef llvm_dibuild_create_module_bytecode(value *argv, int argn) {
|
||||
return llvm_dibuild_create_module_native(
|
||||
argv[0], // Builder
|
||||
(LLVMMetadataRef)argv[1], // ParentScope
|
||||
@ -271,8 +271,8 @@ LLVMMetadataRef llvm_dibuild_create_module_bytecode(value *argv,
|
||||
);
|
||||
}
|
||||
|
||||
LLVMMetadataRef
|
||||
llvm_dibuild_create_namespace(value Builder, LLVMMetadataRef ParentScope,
|
||||
LLVMMetadataRef llvm_dibuild_create_namespace(value Builder,
|
||||
LLVMMetadataRef ParentScope,
|
||||
value Name, value ExportSymbols) {
|
||||
return LLVMDIBuilderCreateNameSpace(
|
||||
DIBuilder_val(Builder), ParentScope, String_val(Name),
|
||||
@ -290,8 +290,7 @@ LLVMMetadataRef llvm_dibuild_create_function_native(
|
||||
Int_val(ScopeLine), DIFlags_val(Flags), Bool_val(IsOptimized));
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_create_function_bytecode(value *argv,
|
||||
int argn) {
|
||||
LLVMMetadataRef llvm_dibuild_create_function_bytecode(value *argv, int argn) {
|
||||
return llvm_dibuild_create_function_native(argv[0], // Builder,
|
||||
(LLVMMetadataRef)argv[1], // Scope
|
||||
argv[2], // Name
|
||||
@ -307,17 +306,19 @@ LLVMMetadataRef llvm_dibuild_create_function_bytecode(value *argv,
|
||||
);
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_create_lexical_block(
|
||||
value Builder, LLVMMetadataRef Scope, LLVMMetadataRef File, value Line,
|
||||
value Column) {
|
||||
LLVMMetadataRef llvm_dibuild_create_lexical_block(value Builder,
|
||||
LLVMMetadataRef Scope,
|
||||
LLVMMetadataRef File,
|
||||
value Line, value Column) {
|
||||
return LLVMDIBuilderCreateLexicalBlock(DIBuilder_val(Builder), Scope, File,
|
||||
Int_val(Line), Int_val(Column));
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_metadata_null() { return (LLVMMetadataRef)NULL; }
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_create_debug_location(
|
||||
LLVMContextRef Ctx, value Line, value Column, LLVMMetadataRef Scope,
|
||||
LLVMMetadataRef llvm_dibuild_create_debug_location(LLVMContextRef Ctx,
|
||||
value Line, value Column,
|
||||
LLVMMetadataRef Scope,
|
||||
LLVMMetadataRef InlinedAt) {
|
||||
return LLVMDIBuilderCreateDebugLocation(Ctx, Int_val(Line), Int_val(Column),
|
||||
Scope, InlinedAt);
|
||||
@ -369,25 +370,25 @@ LLVMMetadataRef llvm_dibuild_get_or_create_type_array(value Builder,
|
||||
Wosize_val(Data));
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_get_or_create_array(value Builder,
|
||||
value Data) {
|
||||
LLVMMetadataRef llvm_dibuild_get_or_create_array(value Builder, value Data) {
|
||||
|
||||
return LLVMDIBuilderGetOrCreateArray(DIBuilder_val(Builder),
|
||||
(LLVMMetadataRef *)Op_val(Data),
|
||||
Wosize_val(Data));
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_create_subroutine_type(
|
||||
value Builder, LLVMMetadataRef File, value ParameterTypes, value Flags) {
|
||||
LLVMMetadataRef llvm_dibuild_create_subroutine_type(value Builder,
|
||||
LLVMMetadataRef File,
|
||||
value ParameterTypes,
|
||||
value Flags) {
|
||||
|
||||
return LLVMDIBuilderCreateSubroutineType(
|
||||
DIBuilder_val(Builder), File, (LLVMMetadataRef *)Op_val(ParameterTypes),
|
||||
Wosize_val(ParameterTypes), DIFlags_val(Flags));
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_create_enumerator(value Builder,
|
||||
value Name, value Value,
|
||||
value IsUnsigned) {
|
||||
LLVMMetadataRef llvm_dibuild_create_enumerator(value Builder, value Name,
|
||||
value Value, value IsUnsigned) {
|
||||
return LLVMDIBuilderCreateEnumerator(
|
||||
DIBuilder_val(Builder), String_val(Name), caml_string_length(Name),
|
||||
(int64_t)Int_val(Value), Bool_val(IsUnsigned));
|
||||
@ -404,8 +405,8 @@ LLVMMetadataRef llvm_dibuild_create_enumeration_type_native(
|
||||
Wosize_val(Elements), ClassTy);
|
||||
}
|
||||
|
||||
LLVMMetadataRef
|
||||
llvm_dibuild_create_enumeration_type_bytecode(value *argv, int argn) {
|
||||
LLVMMetadataRef llvm_dibuild_create_enumeration_type_bytecode(value *argv,
|
||||
int argn) {
|
||||
return llvm_dibuild_create_enumeration_type_native(
|
||||
argv[0], // Builder
|
||||
(LLVMMetadataRef)argv[1], // Scope
|
||||
@ -433,8 +434,7 @@ LLVMMetadataRef llvm_dibuild_create_union_type_native(
|
||||
caml_string_length(UniqueId));
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_create_union_type_bytecode(value *argv,
|
||||
int argn) {
|
||||
LLVMMetadataRef llvm_dibuild_create_union_type_bytecode(value *argv, int argn) {
|
||||
return llvm_dibuild_create_union_type_native(
|
||||
argv[0], // Builder
|
||||
(LLVMMetadataRef)argv[1], // Scope
|
||||
@ -450,8 +450,7 @@ LLVMMetadataRef llvm_dibuild_create_union_type_bytecode(value *argv,
|
||||
);
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_create_array_type(value Builder,
|
||||
value Size,
|
||||
LLVMMetadataRef llvm_dibuild_create_array_type(value Builder, value Size,
|
||||
value AlignInBits,
|
||||
LLVMMetadataRef Ty,
|
||||
value Subscripts) {
|
||||
@ -460,8 +459,7 @@ LLVMMetadataRef llvm_dibuild_create_array_type(value Builder,
|
||||
(LLVMMetadataRef *)Op_val(Subscripts), Wosize_val(Subscripts));
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_create_vector_type(value Builder,
|
||||
value Size,
|
||||
LLVMMetadataRef llvm_dibuild_create_vector_type(value Builder, value Size,
|
||||
value AlignInBits,
|
||||
LLVMMetadataRef Ty,
|
||||
value Subscripts) {
|
||||
@ -476,8 +474,9 @@ LLVMMetadataRef llvm_dibuild_create_unspecified_type(value Builder,
|
||||
DIBuilder_val(Builder), String_val(Name), caml_string_length(Name));
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_create_basic_type(
|
||||
value Builder, value Name, value SizeInBits, value Encoding, value Flags) {
|
||||
LLVMMetadataRef llvm_dibuild_create_basic_type(value Builder, value Name,
|
||||
value SizeInBits, value Encoding,
|
||||
value Flags) {
|
||||
|
||||
return LLVMDIBuilderCreateBasicType(
|
||||
DIBuilder_val(Builder), String_val(Name), caml_string_length(Name),
|
||||
@ -578,8 +577,8 @@ LLVMMetadataRef llvm_dibuild_create_static_member_type_native(
|
||||
Int_val(AlignInBits));
|
||||
}
|
||||
|
||||
LLVMMetadataRef
|
||||
llvm_dibuild_create_static_member_type_bytecode(value *argv, int argn) {
|
||||
LLVMMetadataRef llvm_dibuild_create_static_member_type_bytecode(value *argv,
|
||||
int argn) {
|
||||
return llvm_dibuild_create_static_member_type_native(
|
||||
argv[0], // Builder
|
||||
(LLVMMetadataRef)argv[1], // Scope
|
||||
@ -602,8 +601,8 @@ LLVMMetadataRef llvm_dibuild_create_member_pointer_type_native(
|
||||
(uint64_t)Int_val(SizeInBits), Int_val(AlignInBits), Flags);
|
||||
}
|
||||
|
||||
LLVMMetadataRef
|
||||
llvm_dibuild_create_member_pointer_type_bytecode(value *argv, int argn) {
|
||||
LLVMMetadataRef llvm_dibuild_create_member_pointer_type_bytecode(value *argv,
|
||||
int argn) {
|
||||
return llvm_dibuild_create_member_pointer_type_native(
|
||||
argv[0], // Builder
|
||||
(LLVMMetadataRef)argv[1], // PointeeType
|
||||
@ -614,20 +613,20 @@ llvm_dibuild_create_member_pointer_type_bytecode(value *argv, int argn) {
|
||||
);
|
||||
}
|
||||
|
||||
LLVMMetadataRef
|
||||
llvm_dibuild_create_object_pointer_type(value Builder, LLVMMetadataRef Type) {
|
||||
LLVMMetadataRef llvm_dibuild_create_object_pointer_type(value Builder,
|
||||
LLVMMetadataRef Type) {
|
||||
return LLVMDIBuilderCreateObjectPointerType(DIBuilder_val(Builder), Type);
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_create_qualified_type(
|
||||
value Builder, value Tag, LLVMMetadataRef Type) {
|
||||
LLVMMetadataRef llvm_dibuild_create_qualified_type(value Builder, value Tag,
|
||||
LLVMMetadataRef Type) {
|
||||
|
||||
return LLVMDIBuilderCreateQualifiedType(DIBuilder_val(Builder), Int_val(Tag),
|
||||
Type);
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_create_reference_type(
|
||||
value Builder, value Tag, LLVMMetadataRef Type) {
|
||||
LLVMMetadataRef llvm_dibuild_create_reference_type(value Builder, value Tag,
|
||||
LLVMMetadataRef Type) {
|
||||
|
||||
return LLVMDIBuilderCreateReferenceType(DIBuilder_val(Builder), Int_val(Tag),
|
||||
Type);
|
||||
@ -647,8 +646,7 @@ LLVMMetadataRef llvm_dibuild_create_typedef_native(
|
||||
File, Int_val(LineNo), Scope, Int_val(AlignInBits));
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_create_typedef_bytecode(value *argv,
|
||||
int argn) {
|
||||
LLVMMetadataRef llvm_dibuild_create_typedef_bytecode(value *argv, int argn) {
|
||||
|
||||
return llvm_dibuild_create_typedef_native(argv[0], // Builder
|
||||
(LLVMMetadataRef)argv[1], // Type
|
||||
@ -660,8 +658,9 @@ LLVMMetadataRef llvm_dibuild_create_typedef_bytecode(value *argv,
|
||||
);
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_create_inheritance_native(
|
||||
value Builder, LLVMMetadataRef Ty, LLVMMetadataRef BaseTy, value BaseOffset,
|
||||
LLVMMetadataRef
|
||||
llvm_dibuild_create_inheritance_native(value Builder, LLVMMetadataRef Ty,
|
||||
LLVMMetadataRef BaseTy, value BaseOffset,
|
||||
value VBPtrOffset, value Flags) {
|
||||
|
||||
return LLVMDIBuilderCreateInheritance(DIBuilder_val(Builder), Ty, BaseTy,
|
||||
@ -669,8 +668,7 @@ LLVMMetadataRef llvm_dibuild_create_inheritance_native(
|
||||
Int_val(VBPtrOffset), Flags);
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_create_inheritance_bytecode(value *argv,
|
||||
int arg) {
|
||||
LLVMMetadataRef llvm_dibuild_create_inheritance_bytecode(value *argv, int arg) {
|
||||
|
||||
return llvm_dibuild_create_inheritance_native(
|
||||
argv[0], // Builder
|
||||
@ -753,8 +751,8 @@ LLVMMetadataRef llvm_dibuild_create_bit_field_member_type_native(
|
||||
DIFlags_val(Flags), Ty);
|
||||
}
|
||||
|
||||
LLVMMetadataRef
|
||||
llvm_dibuild_create_bit_field_member_type_bytecode(value *argv, int arg) {
|
||||
LLVMMetadataRef llvm_dibuild_create_bit_field_member_type_bytecode(value *argv,
|
||||
int arg) {
|
||||
|
||||
return llvm_dibuild_create_bit_field_member_type_native(
|
||||
argv[0], // Builder
|
||||
@ -786,8 +784,7 @@ LLVMMetadataRef llvm_dibuild_create_class_type_native(
|
||||
caml_string_length(UniqueIdentifier));
|
||||
}
|
||||
|
||||
LLVMMetadataRef llvm_dibuild_create_class_type_bytecode(value *argv,
|
||||
int arg) {
|
||||
LLVMMetadataRef llvm_dibuild_create_class_type_bytecode(value *argv, int arg) {
|
||||
|
||||
return llvm_dibuild_create_class_type_native(
|
||||
argv[0], // Builder
|
||||
@ -807,8 +804,8 @@ LLVMMetadataRef llvm_dibuild_create_class_type_bytecode(value *argv,
|
||||
);
|
||||
}
|
||||
|
||||
LLVMMetadataRef
|
||||
llvm_dibuild_create_artificial_type(value Builder, LLVMMetadataRef Type) {
|
||||
LLVMMetadataRef llvm_dibuild_create_artificial_type(value Builder,
|
||||
LLVMMetadataRef Type) {
|
||||
return LLVMDIBuilderCreateArtificialType(DIBuilder_val(Builder), Type);
|
||||
}
|
||||
|
||||
@ -860,14 +857,13 @@ value llvm_instr_get_debug_loc(LLVMValueRef Inst) {
|
||||
return (ptr_to_option(LLVMInstructionGetDebugLoc(Inst)));
|
||||
}
|
||||
|
||||
value llvm_instr_set_debug_loc(LLVMValueRef Inst,
|
||||
LLVMMetadataRef Loc) {
|
||||
value llvm_instr_set_debug_loc(LLVMValueRef Inst, LLVMMetadataRef Loc) {
|
||||
LLVMInstructionSetDebugLoc(Inst, Loc);
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
LLVMMetadataRef
|
||||
llvm_dibuild_create_constant_value_expression(value Builder, value Value) {
|
||||
LLVMMetadataRef llvm_dibuild_create_constant_value_expression(value Builder,
|
||||
value Value) {
|
||||
return LLVMDIBuilderCreateConstantValueExpression(DIBuilder_val(Builder),
|
||||
(int64_t)Int_val(Value));
|
||||
}
|
||||
@ -900,8 +896,7 @@ llvm_dibuild_create_global_variable_expression_bytecode(value *argv, int arg) {
|
||||
);
|
||||
}
|
||||
|
||||
value
|
||||
llvm_di_global_variable_expression_get_variable(LLVMMetadataRef GVE) {
|
||||
value llvm_di_global_variable_expression_get_variable(LLVMMetadataRef GVE) {
|
||||
return (ptr_to_option(LLVMDIGlobalVariableExpressionGetVariable(GVE)));
|
||||
}
|
||||
|
||||
|
@ -54,8 +54,8 @@ LLVMExecutionEngineRef llvm_ee_create(value OptRecordOpt, LLVMModuleRef M) {
|
||||
Options.MCJMM = NULL;
|
||||
}
|
||||
|
||||
if (LLVMCreateMCJITCompilerForModule(&MCJIT, M, &Options,
|
||||
sizeof(Options), &Error))
|
||||
if (LLVMCreateMCJITCompilerForModule(&MCJIT, M, &Options, sizeof(Options),
|
||||
&Error))
|
||||
llvm_raise(*caml_named_value("Llvm_executionengine.Error"), Error);
|
||||
return MCJIT;
|
||||
}
|
||||
@ -116,12 +116,11 @@ value llvm_ee_add_global_mapping(LLVMValueRef Global, value Ptr,
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
value llvm_ee_get_global_value_address(value Name,
|
||||
LLVMExecutionEngineRef EE) {
|
||||
return caml_copy_int64((int64_t) LLVMGetGlobalValueAddress(EE, String_val(Name)));
|
||||
value llvm_ee_get_global_value_address(value Name, LLVMExecutionEngineRef EE) {
|
||||
return caml_copy_int64(
|
||||
(int64_t)LLVMGetGlobalValueAddress(EE, String_val(Name)));
|
||||
}
|
||||
|
||||
value llvm_ee_get_function_address(value Name,
|
||||
LLVMExecutionEngineRef EE) {
|
||||
value llvm_ee_get_function_address(value Name, LLVMExecutionEngineRef EE) {
|
||||
return caml_copy_int64((int64_t)LLVMGetFunctionAddress(EE, String_val(Name)));
|
||||
}
|
||||
|
@ -21,8 +21,7 @@
|
||||
void llvm_raise(value Prototype, char *Message);
|
||||
|
||||
/* Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule */
|
||||
value llvm_parse_ir(LLVMContextRef C,
|
||||
LLVMMemoryBufferRef MemBuf) {
|
||||
value llvm_parse_ir(LLVMContextRef C, LLVMMemoryBufferRef MemBuf) {
|
||||
CAMLparam0();
|
||||
CAMLlocal2(Variant, MessageVal);
|
||||
LLVMModuleRef M;
|
||||
|
@ -27,7 +27,8 @@ void llvm_raise(value Prototype, char *Message);
|
||||
/* llmodule -> llmodule -> unit */
|
||||
value llvm_link_modules(LLVMModuleRef Dst, LLVMModuleRef Src) {
|
||||
if (LLVMLinkModules2(Dst, Src))
|
||||
llvm_raise(*caml_named_value("Llvm_linker.Error"), LLVMCreateMessage("Linking failed"));
|
||||
llvm_raise(*caml_named_value("Llvm_linker.Error"),
|
||||
LLVMCreateMessage("Linking failed"));
|
||||
|
||||
return Val_unit;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -43,12 +43,11 @@ static struct custom_operations llvm_data_layout_ops = {
|
||||
custom_hash_default,
|
||||
custom_serialize_default,
|
||||
custom_deserialize_default,
|
||||
custom_compare_ext_default
|
||||
};
|
||||
custom_compare_ext_default};
|
||||
|
||||
value llvm_alloc_data_layout(LLVMTargetDataRef DataLayout) {
|
||||
value V = alloc_custom(&llvm_data_layout_ops, sizeof(LLVMTargetDataRef),
|
||||
0, 1);
|
||||
value V =
|
||||
alloc_custom(&llvm_data_layout_ops, sizeof(LLVMTargetDataRef), 0, 1);
|
||||
DataLayout_val(V) = DataLayout;
|
||||
return V;
|
||||
}
|
||||
@ -87,8 +86,7 @@ value llvm_datalayout_qualified_pointer_size(value AS, value DL) {
|
||||
}
|
||||
|
||||
/* Llvm.llcontext -> int -> DataLayout.t -> Llvm.lltype */
|
||||
LLVMTypeRef llvm_datalayout_qualified_intptr_type(LLVMContextRef C,
|
||||
value AS,
|
||||
LLVMTypeRef llvm_datalayout_qualified_intptr_type(LLVMContextRef C, value AS,
|
||||
value DL) {
|
||||
return LLVMIntPtrTypeForASInContext(C, DataLayout_val(DL), Int_val(AS));
|
||||
}
|
||||
@ -132,15 +130,14 @@ value llvm_datalayout_preferred_align_of_global(LLVMValueRef GlobalVar,
|
||||
/* Llvm.lltype -> Int64.t -> DataLayout.t -> int */
|
||||
value llvm_datalayout_element_at_offset(LLVMTypeRef Ty, value Offset,
|
||||
value DL) {
|
||||
return Val_int(LLVMElementAtOffset(DataLayout_val(DL), Ty,
|
||||
Int64_val(Offset)));
|
||||
return Val_int(
|
||||
LLVMElementAtOffset(DataLayout_val(DL), Ty, Int64_val(Offset)));
|
||||
}
|
||||
|
||||
/* Llvm.lltype -> int -> DataLayout.t -> Int64.t */
|
||||
value llvm_datalayout_offset_of_element(LLVMTypeRef Ty, value Index,
|
||||
value DL) {
|
||||
return caml_copy_int64(LLVMOffsetOfElement(DataLayout_val(DL), Ty,
|
||||
Int_val(Index)));
|
||||
value llvm_datalayout_offset_of_element(LLVMTypeRef Ty, value Index, value DL) {
|
||||
return caml_copy_int64(
|
||||
LLVMOffsetOfElement(DataLayout_val(DL), Ty, Int_val(Index)));
|
||||
}
|
||||
|
||||
/*===---- Target ----------------------------------------------------------===*/
|
||||
@ -220,8 +217,7 @@ static struct custom_operations llvm_target_machine_ops = {
|
||||
custom_hash_default,
|
||||
custom_serialize_default,
|
||||
custom_deserialize_default,
|
||||
custom_compare_ext_default
|
||||
};
|
||||
custom_compare_ext_default};
|
||||
|
||||
static value llvm_alloc_targetmachine(LLVMTargetMachineRef Machine) {
|
||||
value V = alloc_custom(&llvm_target_machine_ops, sizeof(LLVMTargetMachineRef),
|
||||
@ -233,8 +229,8 @@ static value llvm_alloc_targetmachine(LLVMTargetMachineRef Machine) {
|
||||
/* triple:string -> ?cpu:string -> ?features:string
|
||||
?level:CodeGenOptLevel.t -> ?reloc_mode:RelocMode.t
|
||||
?code_model:CodeModel.t -> Target.t -> TargetMachine.t */
|
||||
value llvm_create_targetmachine_native(value Triple, value CPU,
|
||||
value Features, value OptLevel, value RelocMode,
|
||||
value llvm_create_targetmachine_native(value Triple, value CPU, value Features,
|
||||
value OptLevel, value RelocMode,
|
||||
value CodeModel, LLVMTargetRef Target) {
|
||||
LLVMTargetMachineRef Machine;
|
||||
const char *CPUStr = "", *FeaturesStr = "";
|
||||
@ -253,15 +249,17 @@ value llvm_create_targetmachine_native(value Triple, value CPU,
|
||||
if (CodeModel != Val_int(0))
|
||||
CodeModelEnum = Int_val(Field(CodeModel, 0));
|
||||
|
||||
Machine = LLVMCreateTargetMachine(Target, String_val(Triple), CPUStr,
|
||||
FeaturesStr, OptLevelEnum, RelocModeEnum, CodeModelEnum);
|
||||
Machine =
|
||||
LLVMCreateTargetMachine(Target, String_val(Triple), CPUStr, FeaturesStr,
|
||||
OptLevelEnum, RelocModeEnum, CodeModelEnum);
|
||||
|
||||
return llvm_alloc_targetmachine(Machine);
|
||||
}
|
||||
|
||||
value llvm_create_targetmachine_bytecode(value *argv, int argn) {
|
||||
return llvm_create_targetmachine_native(argv[0], argv[1], argv[2], argv[3],
|
||||
argv[4], argv[5], (LLVMTargetRef) argv[6]);
|
||||
argv[4], argv[5],
|
||||
(LLVMTargetRef)argv[6]);
|
||||
}
|
||||
|
||||
/* TargetMachine.t -> Target.t */
|
||||
@ -271,26 +269,26 @@ LLVMTargetRef llvm_targetmachine_target(value Machine) {
|
||||
|
||||
/* TargetMachine.t -> string */
|
||||
value llvm_targetmachine_triple(value Machine) {
|
||||
return llvm_string_of_message(LLVMGetTargetMachineTriple(
|
||||
TargetMachine_val(Machine)));
|
||||
return llvm_string_of_message(
|
||||
LLVMGetTargetMachineTriple(TargetMachine_val(Machine)));
|
||||
}
|
||||
|
||||
/* TargetMachine.t -> string */
|
||||
value llvm_targetmachine_cpu(value Machine) {
|
||||
return llvm_string_of_message(LLVMGetTargetMachineCPU(
|
||||
TargetMachine_val(Machine)));
|
||||
return llvm_string_of_message(
|
||||
LLVMGetTargetMachineCPU(TargetMachine_val(Machine)));
|
||||
}
|
||||
|
||||
/* TargetMachine.t -> string */
|
||||
value llvm_targetmachine_features(value Machine) {
|
||||
return llvm_string_of_message(LLVMGetTargetMachineFeatureString(
|
||||
TargetMachine_val(Machine)));
|
||||
return llvm_string_of_message(
|
||||
LLVMGetTargetMachineFeatureString(TargetMachine_val(Machine)));
|
||||
}
|
||||
|
||||
/* TargetMachine.t -> DataLayout.t */
|
||||
value llvm_targetmachine_data_layout(value Machine) {
|
||||
return llvm_alloc_data_layout(LLVMCreateTargetDataLayout(
|
||||
TargetMachine_val(Machine)));
|
||||
return llvm_alloc_data_layout(
|
||||
LLVMCreateTargetDataLayout(TargetMachine_val(Machine)));
|
||||
}
|
||||
|
||||
/* bool -> TargetMachine.t -> unit */
|
||||
@ -300,8 +298,8 @@ value llvm_targetmachine_set_verbose_asm(value Verb, value Machine) {
|
||||
}
|
||||
|
||||
/* Llvm.llmodule -> CodeGenFileType.t -> string -> TargetMachine.t -> unit */
|
||||
value llvm_targetmachine_emit_to_file(LLVMModuleRef Module,
|
||||
value FileType, value FileName, value Machine) {
|
||||
value llvm_targetmachine_emit_to_file(LLVMModuleRef Module, value FileType,
|
||||
value FileName, value Machine) {
|
||||
char *ErrorMessage;
|
||||
|
||||
if (LLVMTargetMachineEmitToFile(TargetMachine_val(Machine), Module,
|
||||
@ -315,8 +313,8 @@ value llvm_targetmachine_emit_to_file(LLVMModuleRef Module,
|
||||
|
||||
/* Llvm.llmodule -> CodeGenFileType.t -> TargetMachine.t ->
|
||||
Llvm.llmemorybuffer */
|
||||
LLVMMemoryBufferRef llvm_targetmachine_emit_to_memory_buffer(
|
||||
LLVMModuleRef Module, value FileType,
|
||||
LLVMMemoryBufferRef
|
||||
llvm_targetmachine_emit_to_memory_buffer(LLVMModuleRef Module, value FileType,
|
||||
value Machine) {
|
||||
char *ErrorMessage;
|
||||
LLVMMemoryBufferRef Buffer;
|
||||
|
@ -27,18 +27,14 @@ static void llvm_finalize_pmbuilder(value PMB) {
|
||||
}
|
||||
|
||||
static struct custom_operations pmbuilder_ops = {
|
||||
(char *) "Llvm_passmgr_builder.t",
|
||||
llvm_finalize_pmbuilder,
|
||||
custom_compare_default,
|
||||
custom_hash_default,
|
||||
custom_serialize_default,
|
||||
custom_deserialize_default,
|
||||
custom_compare_ext_default
|
||||
};
|
||||
(char *)"Llvm_passmgr_builder.t", llvm_finalize_pmbuilder,
|
||||
custom_compare_default, custom_hash_default,
|
||||
custom_serialize_default, custom_deserialize_default,
|
||||
custom_compare_ext_default};
|
||||
|
||||
static value alloc_pmbuilder(LLVMPassManagerBuilderRef Ref) {
|
||||
value Val = alloc_custom(&pmbuilder_ops,
|
||||
sizeof(LLVMPassManagerBuilderRef), 0, 1);
|
||||
value Val =
|
||||
alloc_custom(&pmbuilder_ops, sizeof(LLVMPassManagerBuilderRef), 0, 1);
|
||||
PMBuilder_val(Val) = Ref;
|
||||
return Val;
|
||||
}
|
||||
@ -61,51 +57,46 @@ value llvm_pmbuilder_set_size_level(value SizeLevel, value PMB) {
|
||||
}
|
||||
|
||||
/* int -> t -> unit */
|
||||
value llvm_pmbuilder_use_inliner_with_threshold(
|
||||
value Threshold, value PMB) {
|
||||
value llvm_pmbuilder_use_inliner_with_threshold(value Threshold, value PMB) {
|
||||
LLVMPassManagerBuilderSetOptLevel(PMBuilder_val(PMB), Int_val(Threshold));
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
/* bool -> t -> unit */
|
||||
value llvm_pmbuilder_set_disable_unit_at_a_time(
|
||||
value DisableUnitAtATime, value PMB) {
|
||||
LLVMPassManagerBuilderSetDisableUnitAtATime(
|
||||
PMBuilder_val(PMB), Bool_val(DisableUnitAtATime));
|
||||
value llvm_pmbuilder_set_disable_unit_at_a_time(value DisableUnitAtATime,
|
||||
value PMB) {
|
||||
LLVMPassManagerBuilderSetDisableUnitAtATime(PMBuilder_val(PMB),
|
||||
Bool_val(DisableUnitAtATime));
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
/* bool -> t -> unit */
|
||||
value llvm_pmbuilder_set_disable_unroll_loops(
|
||||
value DisableUnroll, value PMB) {
|
||||
LLVMPassManagerBuilderSetDisableUnrollLoops(
|
||||
PMBuilder_val(PMB), Bool_val(DisableUnroll));
|
||||
value llvm_pmbuilder_set_disable_unroll_loops(value DisableUnroll, value PMB) {
|
||||
LLVMPassManagerBuilderSetDisableUnrollLoops(PMBuilder_val(PMB),
|
||||
Bool_val(DisableUnroll));
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
/* [ `Function ] Llvm.PassManager.t -> t -> unit */
|
||||
value llvm_pmbuilder_populate_function_pass_manager(
|
||||
LLVMPassManagerRef PM, value PMB) {
|
||||
LLVMPassManagerBuilderPopulateFunctionPassManager(
|
||||
PMBuilder_val(PMB), PM);
|
||||
value llvm_pmbuilder_populate_function_pass_manager(LLVMPassManagerRef PM,
|
||||
value PMB) {
|
||||
LLVMPassManagerBuilderPopulateFunctionPassManager(PMBuilder_val(PMB), PM);
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
/* [ `Module ] Llvm.PassManager.t -> t -> unit */
|
||||
value llvm_pmbuilder_populate_module_pass_manager(
|
||||
LLVMPassManagerRef PM, value PMB) {
|
||||
LLVMPassManagerBuilderPopulateModulePassManager(
|
||||
PMBuilder_val(PMB), PM);
|
||||
value llvm_pmbuilder_populate_module_pass_manager(LLVMPassManagerRef PM,
|
||||
value PMB) {
|
||||
LLVMPassManagerBuilderPopulateModulePassManager(PMBuilder_val(PMB), PM);
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
/* [ `Module ] Llvm.PassManager.t ->
|
||||
internalize:bool -> run_inliner:bool -> t -> unit */
|
||||
value llvm_pmbuilder_populate_lto_pass_manager(
|
||||
LLVMPassManagerRef PM, value Internalize, value RunInliner,
|
||||
value PMB) {
|
||||
value llvm_pmbuilder_populate_lto_pass_manager(LLVMPassManagerRef PM,
|
||||
value Internalize,
|
||||
value RunInliner, value PMB) {
|
||||
LLVMPassManagerBuilderPopulateLTOPassManager(
|
||||
PMBuilder_val(PMB), PM,
|
||||
Bool_val(Internalize), Bool_val(RunInliner));
|
||||
PMBuilder_val(PMB), PM, Bool_val(Internalize), Bool_val(RunInliner));
|
||||
return Val_unit;
|
||||
}
|
||||
|
@ -26,6 +26,4 @@
|
||||
*/
|
||||
|
||||
/* llmodule -> llmodule */
|
||||
LLVMModuleRef llvm_clone_module(LLVMModuleRef M) {
|
||||
return LLVMCloneModule(M);
|
||||
}
|
||||
LLVMModuleRef llvm_clone_module(LLVMModuleRef M) { return LLVMCloneModule(M); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user