C C.struct_LLVMMCJITCompilerOptions
}
+func (options *MCJITCompilerOptions) SetMCJITOptimizationLevel(level uint) {
+ options.C.OptLevel = C.uint(level)
+}
+
// helpers
func llvmGenericValueRefPtr(t *GenericValue) *C.LLVMGenericValueRef {
return (*C.LLVMGenericValueRef)(unsafe.Pointer(t))
return MCJITCompilerOptions{options}
}
-func SetMCJITOptimizationLevel(options MCJITCompilerOptions, level uint) {
- options.C.OptLevel = C.uint(level)
-}
-
func NewMCJITCompiler(m Module, options MCJITCompilerOptions) (ee ExecutionEngine, err error) {
var cmsg *C.char
fail := C.LLVMCreateMCJITCompilerForModule(&ee.C, m.C, &options.C, C.size_t(unsafe.Sizeof(C.struct_LLVMMCJITCompilerOptions{})), &cmsg)
}
options := NewMCJITCompilerOptions()
- SetMCJITOptimizationLevel(options, 2)
+ options.SetMCJITOptimizationLevel(2)
engine, err := NewMCJITCompiler(mod, options)
if err != nil {
t.Errorf("Error creating JIT: %s", err)