llvm.org GIT mirror llvm / 2d3f97d
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 Eric Christopher 5 years ago
2 changed file(s) with 5 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
3232
3333 type MCJITCompilerOptions struct {
3434 C C.struct_LLVMMCJITCompilerOptions
35 }
36
37 func (options *MCJITCompilerOptions) SetMCJITOptimizationLevel(level uint) {
38 options.C.OptLevel = C.uint(level)
3539 }
3640
3741 // helpers
99103 return MCJITCompilerOptions{options}
100104 }
101105
102 func SetMCJITOptimizationLevel(options MCJITCompilerOptions, level uint) {
103 options.C.OptLevel = C.uint(level)
104 }
105
106106 func NewMCJITCompiler(m Module, options MCJITCompilerOptions) (ee ExecutionEngine, err error) {
107107 var cmsg *C.char
108108 fail := C.LLVMCreateMCJITCompilerForModule(&ee.C, m.C, &options.C, C.size_t(unsafe.Sizeof(C.struct_LLVMMCJITCompilerOptions{})), &cmsg)
6666 }
6767
6868 options := NewMCJITCompilerOptions()
69 SetMCJITOptimizationLevel(options, 2)
69 options.SetMCJITOptimizationLevel(2)
7070 engine, err := NewMCJITCompiler(mod, options)
7171 if err != nil {
7272 t.Errorf("Error creating JIT: %s", err)