Also delete the go side of the bindings deleted in r286085/r286086.

Also delete a comment I forgot to delete.

llvm-svn: 286087
This commit is contained in:
Daniel Jasper 2016-11-06 23:21:22 +00:00
parent 7ee8c309bd
commit de72a79511
3 changed files with 0 additions and 180 deletions

View File

@ -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);

View File

@ -114,56 +114,6 @@ func llvmMetadataRefs(mds []Metadata) (*C.LLVMMetadataRef, C.unsigned) {
return pt, ptlen
}
//-------------------------------------------------------------------------
// 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))
}

View File

@ -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)
}
}