1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

Make SetMCJITOptimizationLevel more of a method and pass options

as a reference. Move closer to the type.

llvm-svn: 222805
This commit is contained in:
Eric Christopher 2014-11-26 02:54:24 +00:00
parent 9c25973a19
commit da77ae7155
2 changed files with 5 additions and 5 deletions

View 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)

View 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)