作者:kubabreck
项目:llv
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)
if fail != 0 {
ee.C = nil
err = errors.New(C.GoString(cmsg))
C.LLVMDisposeMessage(cmsg)
}
return
}
作者:kubabreck
项目:llv
func NewExecutionEngine(m Module) (ee ExecutionEngine, err error) {
var cmsg *C.char
fail := C.LLVMCreateExecutionEngineForModule(&ee.C, m.C, &cmsg)
if fail != 0 {
ee.C = nil
err = errors.New(C.GoString(cmsg))
C.LLVMDisposeMessage(cmsg)
}
return
}
作者:prattmi
项目:gollv
func LinkModules(Dest, Src Module, Mode LinkerMode) error {
var cmsg *C.char
failed := C.LLVMLinkModules(Dest.C, Src.C, C.LLVMLinkerMode(Mode), &cmsg)
if failed == 0 {
return nil
}
err := errors.New(C.GoString(cmsg))
C.LLVMDisposeMessage(cmsg)
return err
}
作者:lelouligh
项目:rootsubtre
func LinkModules(Dest, Src Module) error {
var cmsg *C.char
failed := C.LLVMLinkModules(Dest.C, Src.C, 0, &cmsg)
if failed != 0 {
err := errors.New(C.GoString(cmsg))
C.LLVMDisposeMessage(cmsg)
return err
}
return nil
}
作者:tarut
项目:gollv
func NewJITCompiler(m Module, optLevel int) (ee ExecutionEngine, err error) {
var cmsg *C.char
fail := C.LLVMCreateJITCompilerForModule(&ee.C, m.C, C.unsigned(optLevel), &cmsg)
if fail == 0 {
err = nil
} else {
ee.C = nil
err = errors.New(C.GoString(cmsg))
C.LLVMDisposeMessage(cmsg)
}
return
}
作者:ns
项目:gollv
func NewInterpreter(m Module) (ee ExecutionEngine, err os.Error) {
var cmsg *C.char
fail := C.LLVMCreateInterpreterForModule(&ee.C, m.C, &cmsg)
if fail == 0 {
err = nil
} else {
ee.C = nil
err = os.NewError(C.GoString(cmsg))
C.LLVMDisposeMessage(cmsg)
}
return
}
作者:go-llv
项目:llv
// Verifies that a module is valid, taking the specified action if not.
// Optionally returns a human-readable description of any invalid constructs.
func VerifyModule(m Module, a VerifierFailureAction) error {
var cmsg *C.char
broken := C.LLVMVerifyModule(m.C, C.LLVMVerifierFailureAction(a), &cmsg)
// C++'s verifyModule means isModuleBroken, so it returns false if
// there are no errors
if broken != 0 {
err := errors.New(C.GoString(cmsg))
C.LLVMDisposeMessage(cmsg)
return err
}
return nil
}
作者:chubbymaggi
项目:llvm-
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)
if fail != 0 {
ee.C = nil
err = errors.New(C.GoString(cmsg))
C.LLVMDisposeMessage(cmsg)
}
return
}
作者:ssr
项目:llv
func DisposeMessage(message string) {
cmessage := C.CString(message)
C.LLVMDisposeMessage(cmessage)
C.free(unsafe.Pointer(cmessage))
}
作者:ttyang
项目:llv
// Converts target data to a target layout string. The string must be disposed
// with LLVMDisposeMessage.
// See the constructor llvm::TargetData::TargetData.
func (td TargetData) String() (s string) {
cmsg := C.LLVMCopyStringRepOfTargetData(td.C)
s = C.GoString(cmsg)
C.LLVMDisposeMessage(cmsg)
return
}