From: whitequark Date: Fri, 28 Sep 2018 16:48:47 +0000 (+0000) Subject: [bindings/go] Add Go bindings for inline assembly X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e42a8ecf660b1244b1b573007c2fbf70042e02a4;p=platform%2Fupstream%2Fllvm.git [bindings/go] Add Go bindings for inline assembly Reviewers: harlanhaskins, whitequark, pcc Reviewed By: pcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D46437 llvm-svn: 343339 --- diff --git a/llvm/bindings/go/llvm/ir.go b/llvm/bindings/go/llvm/ir.go index a336c0e..b3bf7ff 100644 --- a/llvm/bindings/go/llvm/ir.go +++ b/llvm/bindings/go/llvm/ir.go @@ -74,6 +74,7 @@ type ( IntPredicate C.LLVMIntPredicate FloatPredicate C.LLVMRealPredicate LandingPadClause C.LLVMLandingPadClauseTy + InlineAsmDialect C.LLVMInlineAsmDialect ) func (c Context) IsNil() bool { return c.C == nil } @@ -315,6 +316,15 @@ const ( ) //------------------------------------------------------------------------- +// llvm.InlineAsmDialect +//------------------------------------------------------------------------- + +const ( + InlineAsmDialectATT InlineAsmDialect = C.LLVMInlineAsmDialectATT + InlineAsmDialectIntel InlineAsmDialect = C.LLVMInlineAsmDialectIntel +) + +//------------------------------------------------------------------------- // llvm.Context //------------------------------------------------------------------------- @@ -1237,6 +1247,16 @@ func (v Value) IncomingBlock(i int) (bb BasicBlock) { return } +// Operations on inline assembly +func InlineAsm(t Type, asmString, constraints string, hasSideEffects, isAlignStack bool, dialect InlineAsmDialect) (rv Value) { + casm := C.CString(asmString) + defer C.free(unsafe.Pointer(casm)) + cconstraints := C.CString(constraints) + defer C.free(unsafe.Pointer(cconstraints)) + rv.C = C.LLVMGetInlineAsm(t.C, casm, C.size_t(len(asmString)), cconstraints, C.size_t(len(constraints)), boolToLLVMBool(hasSideEffects), boolToLLVMBool(isAlignStack), C.LLVMInlineAsmDialect(dialect)) + return +} + //------------------------------------------------------------------------- // llvm.Builder //-------------------------------------------------------------------------