diff --git a/src/llvm/generic_value.cr b/src/llvm/generic_value.cr index 15f9d378c75e..e168567e88f2 100644 --- a/src/llvm/generic_value.cr +++ b/src/llvm/generic_value.cr @@ -7,11 +7,11 @@ class LLVM::GenericValue end def to_i64 : Int64 - LibLLVM.generic_value_to_int(self, signed: 1).unsafe_as(Int64) + LibLLVM.generic_value_to_int(self, is_signed: 1).to_i64! end def to_u64 : UInt64 - LibLLVM.generic_value_to_int(self, signed: 0) + LibLLVM.generic_value_to_int(self, is_signed: 0) end def to_b : Bool diff --git a/src/llvm/lib_llvm/initialization.cr b/src/llvm/lib_llvm/initialization.cr index e4ccc200edae..fee9bf1aea4a 100644 --- a/src/llvm/lib_llvm/initialization.cr +++ b/src/llvm/lib_llvm/initialization.cr @@ -1,18 +1,18 @@ +{% skip_file unless LibLLVM::IS_LT_170 %} + require "./types" lib LibLLVM - {% if LibLLVM::IS_LT_170 %} - fun initialize_core = LLVMInitializeCore(r : PassRegistryRef) - fun initialize_transform_utils = LLVMInitializeTransformUtils(r : PassRegistryRef) - fun initialize_scalar_opts = LLVMInitializeScalarOpts(r : PassRegistryRef) - fun initialize_obj_c_arc_opts = LLVMInitializeObjCARCOpts(r : PassRegistryRef) - fun initialize_vectorization = LLVMInitializeVectorization(r : PassRegistryRef) - fun initialize_inst_combine = LLVMInitializeInstCombine(r : PassRegistryRef) - fun initialize_ipo = LLVMInitializeIPO(r : PassRegistryRef) - fun initialize_instrumentation = LLVMInitializeInstrumentation(r : PassRegistryRef) - fun initialize_analysis = LLVMInitializeAnalysis(r : PassRegistryRef) - fun initialize_ipa = LLVMInitializeIPA(r : PassRegistryRef) - fun initialize_code_gen = LLVMInitializeCodeGen(r : PassRegistryRef) - fun initialize_target = LLVMInitializeTarget(r : PassRegistryRef) - {% end %} + fun initialize_core = LLVMInitializeCore(r : PassRegistryRef) + fun initialize_transform_utils = LLVMInitializeTransformUtils(r : PassRegistryRef) + fun initialize_scalar_opts = LLVMInitializeScalarOpts(r : PassRegistryRef) + fun initialize_obj_c_arc_opts = LLVMInitializeObjCARCOpts(r : PassRegistryRef) + fun initialize_vectorization = LLVMInitializeVectorization(r : PassRegistryRef) + fun initialize_inst_combine = LLVMInitializeInstCombine(r : PassRegistryRef) + fun initialize_ipo = LLVMInitializeIPO(r : PassRegistryRef) + fun initialize_instrumentation = LLVMInitializeInstrumentation(r : PassRegistryRef) + fun initialize_analysis = LLVMInitializeAnalysis(r : PassRegistryRef) + fun initialize_ipa = LLVMInitializeIPA(r : PassRegistryRef) + fun initialize_code_gen = LLVMInitializeCodeGen(r : PassRegistryRef) + fun initialize_target = LLVMInitializeTarget(r : PassRegistryRef) end diff --git a/src/llvm/lib_llvm/transforms/pass_builder.cr b/src/llvm/lib_llvm/transforms/pass_builder.cr index 0cfea4424642..41a569c4f0a2 100644 --- a/src/llvm/lib_llvm/transforms/pass_builder.cr +++ b/src/llvm/lib_llvm/transforms/pass_builder.cr @@ -1,13 +1,13 @@ +{% skip_file if LibLLVM::IS_LT_130 %} + require "../target_machine" require "../types" lib LibLLVM - {% unless LibLLVM::IS_LT_130 %} - type PassBuilderOptionsRef = Void* + type PassBuilderOptionsRef = Void* - fun run_passes = LLVMRunPasses(m : ModuleRef, passes : Char*, tm : TargetMachineRef, options : PassBuilderOptionsRef) : ErrorRef + fun run_passes = LLVMRunPasses(m : ModuleRef, passes : Char*, tm : TargetMachineRef, options : PassBuilderOptionsRef) : ErrorRef - fun create_pass_builder_options = LLVMCreatePassBuilderOptions : PassBuilderOptionsRef - fun dispose_pass_builder_options = LLVMDisposePassBuilderOptions(options : PassBuilderOptionsRef) - {% end %} + fun create_pass_builder_options = LLVMCreatePassBuilderOptions : PassBuilderOptionsRef + fun dispose_pass_builder_options = LLVMDisposePassBuilderOptions(options : PassBuilderOptionsRef) end diff --git a/src/llvm/lib_llvm/transforms/pass_manager_builder.cr b/src/llvm/lib_llvm/transforms/pass_manager_builder.cr index 438fb9f68dce..305d7e372755 100644 --- a/src/llvm/lib_llvm/transforms/pass_manager_builder.cr +++ b/src/llvm/lib_llvm/transforms/pass_manager_builder.cr @@ -1,17 +1,17 @@ +{% skip_file unless LibLLVM::IS_LT_170 %} + require "../types" lib LibLLVM - {% if LibLLVM::IS_LT_170 %} - type PassManagerBuilderRef = Void* + type PassManagerBuilderRef = Void* - fun pass_manager_builder_create = LLVMPassManagerBuilderCreate : PassManagerBuilderRef - fun dispose_pass_manager_builder = LLVMPassManagerBuilderDispose(pmb : PassManagerBuilderRef) - fun pass_manager_builder_set_opt_level = LLVMPassManagerBuilderSetOptLevel(pmb : PassManagerBuilderRef, opt_level : UInt) - fun pass_manager_builder_set_size_level = LLVMPassManagerBuilderSetSizeLevel(pmb : PassManagerBuilderRef, size_level : UInt) - fun pass_manager_builder_set_disable_unroll_loops = LLVMPassManagerBuilderSetDisableUnrollLoops(pmb : PassManagerBuilderRef, value : Bool) - fun pass_manager_builder_set_disable_simplify_lib_calls = LLVMPassManagerBuilderSetDisableSimplifyLibCalls(pmb : PassManagerBuilderRef, value : Bool) - fun pass_manager_builder_use_inliner_with_threshold = LLVMPassManagerBuilderUseInlinerWithThreshold(pmb : PassManagerBuilderRef, threshold : UInt) - fun pass_manager_builder_populate_function_pass_manager = LLVMPassManagerBuilderPopulateFunctionPassManager(pmb : PassManagerBuilderRef, pm : PassManagerRef) - fun pass_manager_builder_populate_module_pass_manager = LLVMPassManagerBuilderPopulateModulePassManager(pmb : PassManagerBuilderRef, pm : PassManagerRef) - {% end %} + fun pass_manager_builder_create = LLVMPassManagerBuilderCreate : PassManagerBuilderRef + fun dispose_pass_manager_builder = LLVMPassManagerBuilderDispose(pmb : PassManagerBuilderRef) + fun pass_manager_builder_set_opt_level = LLVMPassManagerBuilderSetOptLevel(pmb : PassManagerBuilderRef, opt_level : UInt) + fun pass_manager_builder_set_size_level = LLVMPassManagerBuilderSetSizeLevel(pmb : PassManagerBuilderRef, size_level : UInt) + fun pass_manager_builder_set_disable_unroll_loops = LLVMPassManagerBuilderSetDisableUnrollLoops(pmb : PassManagerBuilderRef, value : Bool) + fun pass_manager_builder_set_disable_simplify_lib_calls = LLVMPassManagerBuilderSetDisableSimplifyLibCalls(pmb : PassManagerBuilderRef, value : Bool) + fun pass_manager_builder_use_inliner_with_threshold = LLVMPassManagerBuilderUseInlinerWithThreshold(pmb : PassManagerBuilderRef, threshold : UInt) + fun pass_manager_builder_populate_function_pass_manager = LLVMPassManagerBuilderPopulateFunctionPassManager(pmb : PassManagerBuilderRef, pm : PassManagerRef) + fun pass_manager_builder_populate_module_pass_manager = LLVMPassManagerBuilderPopulateModulePassManager(pmb : PassManagerBuilderRef, pm : PassManagerRef) end