Add bindings for the rest of the MCJIT options that we previously

had support for. We're still missing a binding for an MCJIT
memory manager.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223153 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher 2014-12-02 21:09:01 +00:00
parent 8d7b46d0d6
commit 73271f0853
2 changed files with 15 additions and 0 deletions

View File

@ -39,6 +39,18 @@ func (options *MCJITCompilerOptions) SetMCJITOptimizationLevel(level uint) {
options.C.OptLevel = C.uint(level)
}
func (options *MCJITCompilerOptions) SetMCJITNoFramePointerElim(nfp bool) {
options.C.NoFramePointerElim = boolToLLVMBool(nfp)
}
func (options *MCJITCompilerOptions) SetMCJITEnableFastISel(fastisel bool) {
options.C.EnableFastISel = boolToLLVMBool(fastisel)
}
func (options *MCJITCompilerOptions) SetMCJITCodeModel(CodeModel CodeModel) {
options.C.CodeModel = C.LLVMCodeModel(CodeModel)
}
// helpers
func llvmGenericValueRefPtr(t *GenericValue) *C.LLVMGenericValueRef {
return (*C.LLVMGenericValueRef)(unsafe.Pointer(t))

View File

@ -68,6 +68,9 @@ func TestFactorial(t *testing.T) {
options := NewMCJITCompilerOptions()
options.SetMCJITOptimizationLevel(2)
options.SetMCJITEnableFastISel(true)
options.SetMCJITNoFramePointerElim(true)
options.SetMCJITCodeModel(CodeModelJITDefault)
engine, err := NewMCJITCompiler(mod, options)
if err != nil {
t.Errorf("Error creating JIT: %s", err)