[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343339 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
whitequark 2018-09-28 16:48:47 +00:00
parent 1bece59b9d
commit a2e8972f37

View File

@ -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 }
@ -314,6 +315,15 @@ const (
LandingPadFilter LandingPadClause = C.LLVMLandingPadFilter
)
//-------------------------------------------------------------------------
// 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
//-------------------------------------------------------------------------