[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
This commit is contained in:
whitequark 2018-09-28 16:48:47 +00:00
parent f3a981e801
commit e42a8ecf66
1 changed files with 20 additions and 0 deletions

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
//-------------------------------------------------------------------------