|
74 | 74 | IntPredicate C.LLVMIntPredicate |
75 | 75 | FloatPredicate C.LLVMRealPredicate |
76 | 76 | LandingPadClause C.LLVMLandingPadClauseTy |
| 77 | + InlineAsmDialect C.LLVMInlineAsmDialect |
77 | 78 | ) |
78 | 79 |
|
79 | 80 | func (c Context) IsNil() bool { return c.C == nil } |
@@ -211,6 +212,7 @@ const ( |
211 | 212 | PointerTypeKind TypeKind = C.LLVMPointerTypeKind |
212 | 213 | VectorTypeKind TypeKind = C.LLVMVectorTypeKind |
213 | 214 | MetadataTypeKind TypeKind = C.LLVMMetadataTypeKind |
| 215 | + TokenTypeKind TypeKind = C.LLVMTokenTypeKind |
214 | 216 | ) |
215 | 217 |
|
216 | 218 | //------------------------------------------------------------------------- |
@@ -314,6 +316,15 @@ const ( |
314 | 316 | LandingPadFilter LandingPadClause = C.LLVMLandingPadFilter |
315 | 317 | ) |
316 | 318 |
|
| 319 | +//------------------------------------------------------------------------- |
| 320 | +// llvm.InlineAsmDialect |
| 321 | +//------------------------------------------------------------------------- |
| 322 | + |
| 323 | +const ( |
| 324 | + InlineAsmDialectATT InlineAsmDialect = C.LLVMInlineAsmDialectATT |
| 325 | + InlineAsmDialectIntel InlineAsmDialect = C.LLVMInlineAsmDialectIntel |
| 326 | +) |
| 327 | + |
317 | 328 | //------------------------------------------------------------------------- |
318 | 329 | // llvm.Context |
319 | 330 | //------------------------------------------------------------------------- |
@@ -655,6 +666,7 @@ func (t Type) VectorSize() int { return int(C.LLVMGetVectorSize(t.C)) } |
655 | 666 | // Operations on other types |
656 | 667 | func (c Context) VoidType() (t Type) { t.C = C.LLVMVoidTypeInContext(c.C); return } |
657 | 668 | func (c Context) LabelType() (t Type) { t.C = C.LLVMLabelTypeInContext(c.C); return } |
| 669 | +func (c Context) TokenType() (t Type) { t.C = C.LLVMTokenTypeInContext(c.C); return } |
658 | 670 |
|
659 | 671 | func VoidType() (t Type) { t.C = C.LLVMVoidType(); return } |
660 | 672 | func LabelType() (t Type) { t.C = C.LLVMLabelType(); return } |
@@ -727,7 +739,6 @@ func (v Value) IsAPHINode() (rv Value) { rv.C = C.LLVMIsAPHINode(v.C |
727 | 739 | func (v Value) IsASelectInst() (rv Value) { rv.C = C.LLVMIsASelectInst(v.C); return } |
728 | 740 | func (v Value) IsAShuffleVectorInst() (rv Value) { rv.C = C.LLVMIsAShuffleVectorInst(v.C); return } |
729 | 741 | func (v Value) IsAStoreInst() (rv Value) { rv.C = C.LLVMIsAStoreInst(v.C); return } |
730 | | -func (v Value) IsATerminatorInst() (rv Value) { rv.C = C.LLVMIsATerminatorInst(v.C); return } |
731 | 742 | func (v Value) IsABranchInst() (rv Value) { rv.C = C.LLVMIsABranchInst(v.C); return } |
732 | 743 | func (v Value) IsAInvokeInst() (rv Value) { rv.C = C.LLVMIsAInvokeInst(v.C); return } |
733 | 744 | func (v Value) IsAReturnInst() (rv Value) { rv.C = C.LLVMIsAReturnInst(v.C); return } |
@@ -1237,6 +1248,29 @@ func (v Value) IncomingBlock(i int) (bb BasicBlock) { |
1237 | 1248 | return |
1238 | 1249 | } |
1239 | 1250 |
|
| 1251 | +// Operations on inline assembly |
| 1252 | +func InlineAsm(t Type, asmString, constraints string, hasSideEffects, isAlignStack bool, dialect InlineAsmDialect) (rv Value) { |
| 1253 | + casm := C.CString(asmString) |
| 1254 | + defer C.free(unsafe.Pointer(casm)) |
| 1255 | + cconstraints := C.CString(constraints) |
| 1256 | + defer C.free(unsafe.Pointer(cconstraints)) |
| 1257 | + 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)) |
| 1258 | + return |
| 1259 | +} |
| 1260 | + |
| 1261 | +// Operations on aggregates |
| 1262 | +func (v Value) Indices() []uint32 { |
| 1263 | + num := C.LLVMGetNumIndices(v.C) |
| 1264 | + indicesPtr := C.LLVMGetIndices(v.C) |
| 1265 | + // https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices |
| 1266 | + rawIndices := (*[1 << 20]C.uint)(unsafe.Pointer(indicesPtr))[:num:num] |
| 1267 | + indices := make([]uint32, num) |
| 1268 | + for i := range indices { |
| 1269 | + indices[i] = uint32(rawIndices[i]) |
| 1270 | + } |
| 1271 | + return indices |
| 1272 | +} |
| 1273 | + |
1240 | 1274 | //------------------------------------------------------------------------- |
1241 | 1275 | // llvm.Builder |
1242 | 1276 | //------------------------------------------------------------------------- |
|
0 commit comments