{"size": 1625, "ext": "scrbl", "max_stars_repo_path": "scribblings/jit.scrbl", "max_stars_repo_name": "failed-dragon-slayer/racket-llvm13", "max_stars_repo_stars_event_min_datetime": "2021-12-17T15:04:05.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-18T00:42:49.000Z", "max_issues_repo_path": "scribblings/jit.scrbl", "max_issues_repo_name": "failed-dragon-slayer/racket-llvm13", "max_issues_repo_issues_event_min_datetime": "2022-01-21T00:25:45.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-25T01:15:39.000Z", "max_forks_repo_path": "scribblings/jit.scrbl", "max_forks_repo_name": "failed-dragon-slayer/racket-llvm", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 33.8541666667, "max_line_length": 130, "alphanum_fraction": 0.7335384615}
#lang scribble/manual
@require[@for-label[racket-llvm
                    racket/base]]

@title{JIT}

@defthing[_LLVMExecutionEngineRef ctype?]{pointer to LLVMExecutionEngine}
@defproc[(LLVMExecutionEngineRef? [v any/c]) boolean?]{check a value is LLVMExecutionEngine or not}

@defproc[(llvm-create-execution-engine-for-module [module LLVMModuleRef?])
    LLVMExecutionEngineRef?
]{
    return an execution engine for given module
}

@defproc[(llvm-run-function [engine LLVMExecutionEngineRef?] [function LLVMValueRef?])
    LLVMGenericValueRef?
]{
    run given @racket[function] on @racket[engine], it returns result as @racket[LLVMGenericValueRef?]
}

@defproc[(llvm-create-generic-value-of-int [type LLVMTypeRef?] [value integer?] [signed? boolean?])
    LLVMGenericValueRef?
]{
    Converted given @racket[value] to @racket[LLVMGenericValueRef?].
    @racket[type] decided it's LLVM type corresponding.
    @racket[signed?] decided it's signed integer or not.
}

@defproc[(llvm-create-generic-value-of-float [type LLVMTypeRef?] [value number?])
    LLVMGenericValueRef?
]{
    Converted given @racket[value] to @racket[LLVMGenericValueRef?].
    @racket[type] decided it's LLVM type corresponding.
}

@defproc[(llvm-generic-value->int [generic-value LLVMGenericValueRef?] [signed? boolean?])
    integer?
]{
    convert @racket[generic-value] back to racket @racket[integer?]. @racket[signed?] decided treat it as a signed integer or not.
}

@defproc[(llvm-generic-value->float [type LLVMTypeRef?] [generic-value LLVMGenericValueRef?])
    number?
]{
    convert @racket[generic-value] back to racket @racket[number?]
}
