1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Go bindings: introduce Value.ConstantAsMetadata.

llvm-svn: 224179
This commit is contained in:
Peter Collingbourne 2014-12-13 02:25:57 +00:00
parent bcdc22d6ac
commit 429456643c
3 changed files with 10 additions and 0 deletions

View File

@ -50,6 +50,10 @@ void LLVMRemoveFunctionAttr2(LLVMValueRef Fn, uint64_t PA) {
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)));
}

View File

@ -37,6 +37,8 @@ void LLVMAddFunctionAttr2(LLVMValueRef Fn, uint64_t PA);
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);

View File

@ -754,6 +754,10 @@ func (c Context) TemporaryMDNode(mds []Metadata) (md Metadata) {
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) {