Make SetMCJITOptimizationLevel more of a method and pass options
authorEric Christopher <echristo@gmail.com>
Wed, 26 Nov 2014 02:54:24 +0000 (02:54 +0000)
committerEric Christopher <echristo@gmail.com>
Wed, 26 Nov 2014 02:54:24 +0000 (02:54 +0000)
as a reference. Move closer to the type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222805 91177308-0d34-0410-b5e6-96231b3b80d8

bindings/go/llvm/executionengine.go
bindings/go/llvm/executionengine_test.go

index db2c2153401811c9fc81e14dfe8d6a0986a3552f..141883975f82c8cbcf3636bd90d96bc7c9bde79e 100644 (file)
@@ -35,6 +35,10 @@ type MCJITCompilerOptions struct {
        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))
@@ -100,10 +104,6 @@ func NewMCJITCompilerOptions() MCJITCompilerOptions {
        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)
index 2d5ca721a2a6de0f1a8dc135e4a44e82845f61ef..03fabc83c6ff49a16cfbdbe1de39436d5c9e375d 100644 (file)
@@ -67,7 +67,7 @@ func TestFactorial(t *testing.T) {
        }
 
        options := NewMCJITCompilerOptions()
-       SetMCJITOptimizationLevel(options, 2)
+       options.SetMCJITOptimizationLevel(2)
        engine, err := NewMCJITCompiler(mod, options)
        if err != nil {
                t.Errorf("Error creating JIT: %s", err)