summaryrefslogtreecommitdiff
path: root/bindings
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-11-26 02:54:24 +0000
committerEric Christopher <echristo@gmail.com>2014-11-26 02:54:24 +0000
commit2d3f97d4dea6501bffa69e07c69df860e904877e (patch)
tree15cbd043473d54bc669bc479f1272708d60bde29 /bindings
parent82ec8476af25616138a9050b5edd6e1e3cf42e4d (diff)
Make SetMCJITOptimizationLevel more of a method and pass options
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
Diffstat (limited to 'bindings')
-rw-r--r--bindings/go/llvm/executionengine.go8
-rw-r--r--bindings/go/llvm/executionengine_test.go2
2 files changed, 5 insertions, 5 deletions
diff --git a/bindings/go/llvm/executionengine.go b/bindings/go/llvm/executionengine.go
index db2c2153401..141883975f8 100644
--- a/bindings/go/llvm/executionengine.go
+++ b/bindings/go/llvm/executionengine.go
@@ -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)
diff --git a/bindings/go/llvm/executionengine_test.go b/bindings/go/llvm/executionengine_test.go
index 2d5ca721a2a..03fabc83c6f 100644
--- a/bindings/go/llvm/executionengine_test.go
+++ b/bindings/go/llvm/executionengine_test.go
@@ -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)