aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/go/llvm/executionengine.go
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2015-04-01 18:49:24 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-04-01 18:49:26 +0000
commit3fa16bd6062e23bcdb82ed4dd965674792e6b761 (patch)
tree9348fc507292f7e8715d22d64ce5a32131b4f875 /bindings/go/llvm/executionengine.go
parentbeed47390a60f6f0c77532b3d3f76bb47ef49423 (diff)
parentebe69fe11e48d322045d5949c83283927a0d790b (diff)
downloadexternal_llvm-3fa16bd6062e23bcdb82ed4dd965674792e6b761.zip
external_llvm-3fa16bd6062e23bcdb82ed4dd965674792e6b761.tar.gz
external_llvm-3fa16bd6062e23bcdb82ed4dd965674792e6b761.tar.bz2
Merge "Update aosp/master LLVM for rebase to r230699."
Diffstat (limited to 'bindings/go/llvm/executionengine.go')
-rw-r--r--bindings/go/llvm/executionengine.go36
1 files changed, 25 insertions, 11 deletions
diff --git a/bindings/go/llvm/executionengine.go b/bindings/go/llvm/executionengine.go
index 26b7524..94d4e83 100644
--- a/bindings/go/llvm/executionengine.go
+++ b/bindings/go/llvm/executionengine.go
@@ -30,11 +30,25 @@ type GenericValue struct {
type ExecutionEngine struct {
C C.LLVMExecutionEngineRef
}
+
type MCJITCompilerOptions struct {
- OptLevel uint
- CodeModel CodeModel
- NoFramePointerElim bool
- EnableFastISel bool
+ C C.struct_LLVMMCJITCompilerOptions
+}
+
+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
@@ -96,15 +110,15 @@ func NewInterpreter(m Module) (ee ExecutionEngine, err error) {
return
}
+func NewMCJITCompilerOptions() MCJITCompilerOptions {
+ var options C.struct_LLVMMCJITCompilerOptions
+ C.LLVMInitializeMCJITCompilerOptions(&options, C.size_t(unsafe.Sizeof(C.struct_LLVMMCJITCompilerOptions{})))
+ return MCJITCompilerOptions{options}
+}
+
func NewMCJITCompiler(m Module, options MCJITCompilerOptions) (ee ExecutionEngine, err error) {
var cmsg *C.char
- copts := C.struct_LLVMMCJITCompilerOptions{
- OptLevel: C.unsigned(options.OptLevel),
- CodeModel: C.LLVMCodeModel(options.CodeModel),
- NoFramePointerElim: boolToLLVMBool(options.NoFramePointerElim),
- EnableFastISel: boolToLLVMBool(options.EnableFastISel),
- }
- fail := C.LLVMCreateMCJITCompilerForModule(&ee.C, m.C, &copts, C.size_t(unsafe.Sizeof(copts)), &cmsg)
+ fail := C.LLVMCreateMCJITCompilerForModule(&ee.C, m.C, &options.C, C.size_t(unsafe.Sizeof(C.struct_LLVMMCJITCompilerOptions{})), &cmsg)
if fail != 0 {
ee.C = nil
err = errors.New(C.GoString(cmsg))