[llvm] r224179 - Go bindings: introduce Value.ConstantAsMetadata.

Peter Collingbourne peter at pcc.me.uk
Fri Dec 12 18:25:57 PST 2014


Author: pcc
Date: Fri Dec 12 20:25:57 2014
New Revision: 224179

URL: http://llvm.org/viewvc/llvm-project?rev=224179&view=rev
Log:
Go bindings: introduce Value.ConstantAsMetadata.

Modified:
    llvm/trunk/bindings/go/llvm/IRBindings.cpp
    llvm/trunk/bindings/go/llvm/IRBindings.h
    llvm/trunk/bindings/go/llvm/ir.go

Modified: llvm/trunk/bindings/go/llvm/IRBindings.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/IRBindings.cpp?rev=224179&r1=224178&r2=224179&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/IRBindings.cpp (original)
+++ llvm/trunk/bindings/go/llvm/IRBindings.cpp Fri Dec 12 20:25:57 2014
@@ -50,6 +50,10 @@ void LLVMRemoveFunctionAttr2(LLVMValueRe
   Func->setAttributes(PALnew);
 }
 
+LLVMMetadataRef LLVMConstantAsMetadata(LLVMValueRef C) {
+  return wrap(ConstantAsMetadata::get(unwrap<Constant>(C)));
+}
+
 LLVMMetadataRef LLVMMDString2(LLVMContextRef C, const char *Str, unsigned SLen) {
   return wrap(MDString::get(*unwrap(C), StringRef(Str, SLen)));
 }

Modified: llvm/trunk/bindings/go/llvm/IRBindings.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/IRBindings.h?rev=224179&r1=224178&r2=224179&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/IRBindings.h (original)
+++ llvm/trunk/bindings/go/llvm/IRBindings.h Fri Dec 12 20:25:57 2014
@@ -37,6 +37,8 @@ void LLVMAddFunctionAttr2(LLVMValueRef F
 uint64_t LLVMGetFunctionAttr2(LLVMValueRef Fn);
 void LLVMRemoveFunctionAttr2(LLVMValueRef Fn, uint64_t PA);
 
+LLVMMetadataRef LLVMConstantAsMetadata(LLVMValueRef Val);
+
 LLVMMetadataRef LLVMMDString2(LLVMContextRef C, const char *Str, unsigned SLen);
 LLVMMetadataRef LLVMMDNode2(LLVMContextRef C, LLVMMetadataRef *MDs,
                             unsigned Count);

Modified: llvm/trunk/bindings/go/llvm/ir.go
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/ir.go?rev=224179&r1=224178&r2=224179&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/ir.go (original)
+++ llvm/trunk/bindings/go/llvm/ir.go Fri Dec 12 20:25:57 2014
@@ -754,6 +754,10 @@ func (c Context) TemporaryMDNode(mds []M
 	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) {





More information about the llvm-commits mailing list