summaryrefslogtreecommitdiff
path: root/bindings/go/llvm/ir.go
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/go/llvm/ir.go')
-rw-r--r--bindings/go/llvm/ir.go52
1 files changed, 44 insertions, 8 deletions
diff --git a/bindings/go/llvm/ir.go b/bindings/go/llvm/ir.go
index 71b11a6668e..0a379e47dc6 100644
--- a/bindings/go/llvm/ir.go
+++ b/bindings/go/llvm/ir.go
@@ -15,6 +15,7 @@ package llvm
/*
#include "llvm-c/Core.h"
+#include "llvm-c/Comdat.h"
#include "IRBindings.h"
#include <stdlib.h>
*/
@@ -37,6 +38,9 @@ type (
Value struct {
C C.LLVMValueRef
}
+ Comdat struct {
+ C C.LLVMComdatRef
+ }
BasicBlock struct {
C C.LLVMBasicBlockRef
}
@@ -61,14 +65,15 @@ type (
Attribute struct {
C C.LLVMAttributeRef
}
- Opcode C.LLVMOpcode
- TypeKind C.LLVMTypeKind
- Linkage C.LLVMLinkage
- Visibility C.LLVMVisibility
- CallConv C.LLVMCallConv
- IntPredicate C.LLVMIntPredicate
- FloatPredicate C.LLVMRealPredicate
- LandingPadClause C.LLVMLandingPadClauseTy
+ Opcode C.LLVMOpcode
+ TypeKind C.LLVMTypeKind
+ Linkage C.LLVMLinkage
+ Visibility C.LLVMVisibility
+ CallConv C.LLVMCallConv
+ ComdatSelectionKind C.LLVMComdatSelectionKind
+ IntPredicate C.LLVMIntPredicate
+ FloatPredicate C.LLVMRealPredicate
+ LandingPadClause C.LLVMLandingPadClauseTy
)
func (c Context) IsNil() bool { return c.C == nil }
@@ -249,6 +254,18 @@ const (
)
//-------------------------------------------------------------------------
+// llvm.ComdatSelectionKind
+//-------------------------------------------------------------------------
+
+const (
+ AnyComdatSelectionKind ComdatSelectionKind = C.LLVMAnyComdatSelectionKind
+ ExactMatchComdatSelectionKind ComdatSelectionKind = C.LLVMExactMatchComdatSelectionKind
+ LargestComdatSelectionKind ComdatSelectionKind = C.LLVMLargestComdatSelectionKind
+ NoDuplicatesComdatSelectionKind ComdatSelectionKind = C.LLVMNoDuplicatesComdatSelectionKind
+ SameSizeComdatSelectionKind ComdatSelectionKind = C.LLVMSameSizeComdatSelectionKind
+)
+
+//-------------------------------------------------------------------------
// llvm.IntPredicate
//-------------------------------------------------------------------------
@@ -1029,6 +1046,25 @@ func AddAlias(m Module, t Type, aliasee Value, name string) (v Value) {
return
}
+// Operations on comdat
+func (m Module) Comdat(name string) (c Comdat) {
+ cname := C.CString(name)
+ defer C.free(unsafe.Pointer(cname))
+ c.C = C.LLVMGetOrInsertComdat(m.C, cname)
+ return
+}
+
+func (v Value) Comdat() (c Comdat) { c.C = C.LLVMGetComdat(v.C); return }
+func (v Value) SetComdat(c Comdat) { C.LLVMSetComdat(v.C, c.C) }
+
+func (c Comdat) SelectionKind() ComdatSelectionKind {
+ return ComdatSelectionKind(C.LLVMGetComdatSelectionKind(c.C))
+}
+
+func (c Comdat) SetSelectionKind(k ComdatSelectionKind) {
+ C.LLVMSetComdatSelectionKind(c.C, (C.LLVMComdatSelectionKind)(k))
+}
+
// Operations on functions
func AddFunction(m Module, name string, ft Type) (v Value) {
cname := C.CString(name)