[llvm] r222805 - Make SetMCJITOptimizationLevel more of a method and pass options

Eric Christopher echristo at gmail.com
Tue Nov 25 18:54:25 PST 2014


Author: echristo
Date: Tue Nov 25 20:54:24 2014
New Revision: 222805

URL: http://llvm.org/viewvc/llvm-project?rev=222805&view=rev
Log:
Make SetMCJITOptimizationLevel more of a method and pass options
as a reference. Move closer to the type.

Modified:
    llvm/trunk/bindings/go/llvm/executionengine.go
    llvm/trunk/bindings/go/llvm/executionengine_test.go

Modified: llvm/trunk/bindings/go/llvm/executionengine.go
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/executionengine.go?rev=222805&r1=222804&r2=222805&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/executionengine.go (original)
+++ llvm/trunk/bindings/go/llvm/executionengine.go Tue Nov 25 20:54:24 2014
@@ -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() MCJITComp
 	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)

Modified: llvm/trunk/bindings/go/llvm/executionengine_test.go
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/executionengine_test.go?rev=222805&r1=222804&r2=222805&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/executionengine_test.go (original)
+++ llvm/trunk/bindings/go/llvm/executionengine_test.go Tue Nov 25 20:54:24 2014
@@ -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)





More information about the llvm-commits mailing list