summaryrefslogtreecommitdiff
path: root/bindings
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2016-11-06 23:21:22 +0000
committerDaniel Jasper <djasper@google.com>2016-11-06 23:21:22 +0000
commitcb096f0a4ec0d4bb87b2e4e99ed69a67c88c87a0 (patch)
tree06f818b218278cf131216026e633d098530e03ad /bindings
parent5183128797dd266a397277d7639b6878891f296f (diff)
Also delete the go side of the bindings deleted in r286085/r286086.
Also delete a comment I forgot to delete. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286087 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-rw-r--r--bindings/go/llvm/IRBindings.h5
-rw-r--r--bindings/go/llvm/ir.go78
-rw-r--r--bindings/go/llvm/ir_test.go97
3 files changed, 0 insertions, 180 deletions
diff --git a/bindings/go/llvm/IRBindings.h b/bindings/go/llvm/IRBindings.h
index 48c080ff7b1..21147712ed5 100644
--- a/bindings/go/llvm/IRBindings.h
+++ b/bindings/go/llvm/IRBindings.h
@@ -28,11 +28,6 @@ extern "C" {
typedef struct LLVMOpaqueMetadata *LLVMMetadataRef;
-// These functions duplicate the LLVM*FunctionAttr functions in the stable C
-// API. We cannot use the existing functions because they take 32-bit attribute
-// values, and the Go bindings expose all of the LLVM attributes, some of which
-// have values >= 1<<32.
-
LLVMMetadataRef LLVMConstantAsMetadata(LLVMValueRef Val);
LLVMMetadataRef LLVMMDString2(LLVMContextRef C, const char *Str, unsigned SLen);
diff --git a/bindings/go/llvm/ir.go b/bindings/go/llvm/ir.go
index b8ea28d3a0d..f6a8415a389 100644
--- a/bindings/go/llvm/ir.go
+++ b/bindings/go/llvm/ir.go
@@ -115,56 +115,6 @@ func llvmMetadataRefs(mds []Metadata) (*C.LLVMMetadataRef, C.unsigned) {
}
//-------------------------------------------------------------------------
-// llvm.Attribute
-//-------------------------------------------------------------------------
-
-const (
- NoneAttribute Attribute = 0
- ZExtAttribute Attribute = C.LLVMZExtAttribute
- SExtAttribute Attribute = C.LLVMSExtAttribute
- NoReturnAttribute Attribute = C.LLVMNoReturnAttribute
- InRegAttribute Attribute = C.LLVMInRegAttribute
- StructRetAttribute Attribute = C.LLVMStructRetAttribute
- NoUnwindAttribute Attribute = C.LLVMNoUnwindAttribute
- NoAliasAttribute Attribute = C.LLVMNoAliasAttribute
- ByValAttribute Attribute = C.LLVMByValAttribute
- NestAttribute Attribute = C.LLVMNestAttribute
- ReadNoneAttribute Attribute = C.LLVMReadNoneAttribute
- ReadOnlyAttribute Attribute = C.LLVMReadOnlyAttribute
- NoInlineAttribute Attribute = C.LLVMNoInlineAttribute
- AlwaysInlineAttribute Attribute = C.LLVMAlwaysInlineAttribute
- OptimizeForSizeAttribute Attribute = C.LLVMOptimizeForSizeAttribute
- StackProtectAttribute Attribute = C.LLVMStackProtectAttribute
- StackProtectReqAttribute Attribute = C.LLVMStackProtectReqAttribute
- Alignment Attribute = C.LLVMAlignment
- NoCaptureAttribute Attribute = C.LLVMNoCaptureAttribute
- NoRedZoneAttribute Attribute = C.LLVMNoRedZoneAttribute
- NoImplicitFloatAttribute Attribute = C.LLVMNoImplicitFloatAttribute
- NakedAttribute Attribute = C.LLVMNakedAttribute
- InlineHintAttribute Attribute = C.LLVMInlineHintAttribute
- StackAlignment Attribute = C.LLVMStackAlignment
- ReturnsTwiceAttribute Attribute = C.LLVMReturnsTwice
- UWTableAttribute Attribute = C.LLVMUWTable
- NonLazyBindAttribute Attribute = 1 << 31
- SanitizeAddressAttribute Attribute = 1 << 32
- MinSizeAttribute Attribute = 1 << 33
- NoDuplicateAttribute Attribute = 1 << 34
- StackProtectStrongAttribute Attribute = 1 << 35
- SanitizeThreadAttribute Attribute = 1 << 36
- SanitizeMemoryAttribute Attribute = 1 << 37
- NoBuiltinAttribute Attribute = 1 << 38
- ReturnedAttribute Attribute = 1 << 39
- ColdAttribute Attribute = 1 << 40
- BuiltinAttribute Attribute = 1 << 41
- OptimizeNoneAttribute Attribute = 1 << 42
- InAllocaAttribute Attribute = 1 << 43
- NonNullAttribute Attribute = 1 << 44
- JumpTableAttribute Attribute = 1 << 45
- ConvergentAttribute Attribute = 1 << 46
- SafeStackAttribute Attribute = 1 << 47
-)
-
-//-------------------------------------------------------------------------
// llvm.Opcode
//-------------------------------------------------------------------------
@@ -1044,9 +994,6 @@ func (v Value) SetGC(name string) {
defer C.free(unsafe.Pointer(cname))
C.LLVMSetGC(v.C, cname)
}
-func (v Value) AddFunctionAttr(a Attribute) { C.LLVMAddFunctionAttr2(v.C, C.uint64_t(a)) }
-func (v Value) FunctionAttr() Attribute { return Attribute(C.LLVMGetFunctionAttr2(v.C)) }
-func (v Value) RemoveFunctionAttr(a Attribute) { C.LLVMRemoveFunctionAttr2(v.C, C.uint64_t(a)) }
func (v Value) AddTargetDependentFunctionAttr(attr, value string) {
cattr := C.CString(attr)
defer C.free(unsafe.Pointer(cattr))
@@ -1076,19 +1023,6 @@ func (v Value) FirstParam() (rv Value) { rv.C = C.LLVMGetFirstParam(v.C); retur
func (v Value) LastParam() (rv Value) { rv.C = C.LLVMGetLastParam(v.C); return }
func NextParam(v Value) (rv Value) { rv.C = C.LLVMGetNextParam(v.C); return }
func PrevParam(v Value) (rv Value) { rv.C = C.LLVMGetPreviousParam(v.C); return }
-func (v Value) AddAttribute(a Attribute) {
- if a >= 1<<32 {
- panic("attribute value currently unsupported")
- }
- C.LLVMAddAttribute(v.C, C.LLVMAttribute(a))
-}
-func (v Value) RemoveAttribute(a Attribute) {
- if a >= 1<<32 {
- panic("attribute value currently unsupported")
- }
- C.LLVMRemoveAttribute(v.C, C.LLVMAttribute(a))
-}
-func (v Value) Attribute() Attribute { return Attribute(C.LLVMGetAttribute(v.C)) }
func (v Value) SetParamAlignment(align int) { C.LLVMSetParamAlignment(v.C, C.unsigned(align)) }
// Operations on basic blocks
@@ -1149,18 +1083,6 @@ func (v Value) SetInstructionCallConv(cc CallConv) {
func (v Value) InstructionCallConv() CallConv {
return CallConv(C.LLVMCallConv(C.LLVMGetInstructionCallConv(v.C)))
}
-func (v Value) AddInstrAttribute(i int, a Attribute) {
- if a >= 1<<32 {
- panic("attribute value currently unsupported")
- }
- C.LLVMAddInstrAttribute(v.C, C.unsigned(i), C.LLVMAttribute(a))
-}
-func (v Value) RemoveInstrAttribute(i int, a Attribute) {
- if a >= 1<<32 {
- panic("attribute value currently unsupported")
- }
- C.LLVMRemoveInstrAttribute(v.C, C.unsigned(i), C.LLVMAttribute(a))
-}
func (v Value) SetInstrParamAlignment(i int, align int) {
C.LLVMSetInstrParamAlignment(v.C, C.unsigned(i), C.unsigned(align))
}
diff --git a/bindings/go/llvm/ir_test.go b/bindings/go/llvm/ir_test.go
deleted file mode 100644
index edeeab935db..00000000000
--- a/bindings/go/llvm/ir_test.go
+++ /dev/null
@@ -1,97 +0,0 @@
-//===- ir_test.go - Tests for ir ------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file tests bindings for the ir component.
-//
-//===----------------------------------------------------------------------===//
-
-package llvm
-
-import (
- "strings"
- "testing"
-)
-
-func testAttribute(t *testing.T, attr Attribute, name string) {
- mod := NewModule("")
- defer mod.Dispose()
-
- ftyp := FunctionType(VoidType(), nil, false)
- fn := AddFunction(mod, "foo", ftyp)
-
- fn.AddFunctionAttr(attr)
- newattr := fn.FunctionAttr()
- if attr != newattr {
- t.Errorf("got attribute mask %d, want %d", newattr, attr)
- }
-
- text := mod.String()
- if !strings.Contains(text, " "+name+" ") {
- t.Errorf("expected attribute '%s', got:\n%s", name, text)
- }
-
- fn.RemoveFunctionAttr(attr)
- newattr = fn.FunctionAttr()
- if newattr != 0 {
- t.Errorf("got attribute mask %d, want 0", newattr)
- }
-}
-
-func TestAttributes(t *testing.T) {
- // Tests that our attribute constants haven't drifted from LLVM's.
- attrTests := []struct {
- attr Attribute
- name string
- }{
- {SanitizeAddressAttribute, "sanitize_address"},
- {AlwaysInlineAttribute, "alwaysinline"},
- {BuiltinAttribute, "builtin"},
- {ByValAttribute, "byval"},
- {ConvergentAttribute, "convergent"},
- {InAllocaAttribute, "inalloca"},
- {InlineHintAttribute, "inlinehint"},
- {InRegAttribute, "inreg"},
- {JumpTableAttribute, "jumptable"},
- {MinSizeAttribute, "minsize"},
- {NakedAttribute, "naked"},
- {NestAttribute, "nest"},
- {NoAliasAttribute, "noalias"},
- {NoBuiltinAttribute, "nobuiltin"},
- {NoCaptureAttribute, "nocapture"},
- {NoDuplicateAttribute, "noduplicate"},
- {NoImplicitFloatAttribute, "noimplicitfloat"},
- {NoInlineAttribute, "noinline"},
- {NonLazyBindAttribute, "nonlazybind"},
- {NonNullAttribute, "nonnull"},
- {NoRedZoneAttribute, "noredzone"},
- {NoReturnAttribute, "noreturn"},
- {NoUnwindAttribute, "nounwind"},
- {OptimizeNoneAttribute, "optnone"},
- {OptimizeForSizeAttribute, "optsize"},
- {ReadNoneAttribute, "readnone"},
- {ReadOnlyAttribute, "readonly"},
- {ReturnedAttribute, "returned"},
- {ReturnsTwiceAttribute, "returns_twice"},
- {SExtAttribute, "signext"},
- {SafeStackAttribute, "safestack"},
- {StackProtectAttribute, "ssp"},
- {StackProtectReqAttribute, "sspreq"},
- {StackProtectStrongAttribute, "sspstrong"},
- {StructRetAttribute, "sret"},
- {SanitizeThreadAttribute, "sanitize_thread"},
- {SanitizeMemoryAttribute, "sanitize_memory"},
- {UWTableAttribute, "uwtable"},
- {ZExtAttribute, "zeroext"},
- {ColdAttribute, "cold"},
- }
-
- for _, a := range attrTests {
- testAttribute(t, a.attr, a.name)
- }
-}