X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=bindings%2Fgo%2Fllvm%2Fir.go;h=8fcd6ec4d748055c486a1ad1b1d895abf4a08247;hp=af246fe2e65b3882e673be85cb64096c56ab02c9;hb=7c898facbc5c707c77f25f7fd9b512a099af62a8;hpb=eb8bf790eb82089288b19a368f4a311ef4b363f9 diff --git a/bindings/go/llvm/ir.go b/bindings/go/llvm/ir.go index af246fe2e65..8fcd6ec4d74 100644 --- a/bindings/go/llvm/ir.go +++ b/bindings/go/llvm/ir.go @@ -160,6 +160,8 @@ const ( InAllocaAttribute Attribute = 1 << 43 NonNullAttribute Attribute = 1 << 44 JumpTableAttribute Attribute = 1 << 45 + ConvergentAttribute Attribute = 1 << 46 + SafeStackAttribute Attribute = 1 << 47 ) //------------------------------------------------------------------------- @@ -749,6 +751,15 @@ func (c Context) MDNode(mds []Metadata) (md Metadata) { md.C = C.LLVMMDNode2(c.C, ptr, nvals) return } +func (c Context) TemporaryMDNode(mds []Metadata) (md Metadata) { + ptr, nvals := llvmMetadataRefs(mds) + md.C = C.LLVMTemporaryMDNode(c.C, ptr, nvals) + return +} +func (v Value) ConstantAsMetadata() (md Metadata) { + md.C = C.LLVMConstantAsMetadata(v.C) + return +} // Operations on scalar constants func ConstInt(t Type, n uint64, signExtend bool) (v Value) { @@ -1043,6 +1054,9 @@ func (v Value) AddTargetDependentFunctionAttr(attr, value string) { defer C.free(unsafe.Pointer(cvalue)) C.LLVMAddTargetDependentFunctionAttr(v.C, cattr, cvalue) } +func (v Value) SetPersonality(p Value) { + C.LLVMSetPersonalityFn(v.C, p.C) +} // Operations on parameters func (v Value) ParamsCount() int { return int(C.LLVMCountParams(v.C)) } @@ -1195,7 +1209,7 @@ func (b Builder) Dispose() { C.LLVMDisposeBuilder(b.C) } func (b Builder) SetCurrentDebugLocation(line, col uint, scope, inlinedAt Metadata) { C.LLVMSetCurrentDebugLocation2(b.C, C.unsigned(line), C.unsigned(col), scope.C, inlinedAt.C) } -func (b Builder) SetInstDebugLocation(v Value) { C.LLVMSetInstDebugLocation(b.C, v.C) } +func (b Builder) SetInstDebugLocation(v Value) { C.LLVMSetInstDebugLocation(b.C, v.C) } func (b Builder) InsertDeclare(module Module, storage Value, md Value) Value { f := module.NamedFunction("llvm.dbg.declare") if f.IsNil() { @@ -1714,10 +1728,10 @@ func (b Builder) CreatePtrDiff(lhs, rhs Value, name string) (v Value) { return } -func (b Builder) CreateLandingPad(t Type, personality Value, nclauses int, name string) (l Value) { +func (b Builder) CreateLandingPad(t Type, nclauses int, name string) (l Value) { cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) - l.C = C.LLVMBuildLandingPad(b.C, t.C, personality.C, C.unsigned(nclauses), cname) + l.C = C.LLVMBuildLandingPad(b.C, t.C, nil, C.unsigned(nclauses), cname) return l } @@ -1827,3 +1841,11 @@ func (pm PassManager) FinalizeFunc() bool { return C.LLVMFinalizeFunctionPassMan // the module provider. // See llvm::PassManagerBase::~PassManagerBase. func (pm PassManager) Dispose() { C.LLVMDisposePassManager(pm.C) } + +//------------------------------------------------------------------------- +// llvm.Metadata +//------------------------------------------------------------------------- + +func (md Metadata) ReplaceAllUsesWith(new Metadata) { + C.LLVMMetadataReplaceAllUsesWith(md.C, new.C) +}