Access to MetaData operands

This is not available in the C API, so add functions to extra.cpp:

- `LLVMMetaDataGetOperand` wraps MDNode::getOperand
- `LLVMMetaDataGetNumOperands` wraps MDNode::getNumOperands
This commit is contained in:
Wladimir J. van der Laan 2012-09-12 20:58:53 +02:00
commit 7f69beb258
5 changed files with 40 additions and 1 deletions

View file

@ -149,6 +149,16 @@ LLVMValueRef LLVMMetaDataGet(LLVMModuleRef modref, LLVMValueRef * valrefs,
return wrap(node);
}
LLVMValueRef LLVMMetaDataGetOperand(LLVMValueRef mdref, unsigned index)
{
return wrap(llvm::unwrap<llvm::MDNode>(mdref)->getOperand(index));
}
unsigned LLVMMetaDataGetNumOperands(LLVMValueRef mdref)
{
return llvm::unwrap<llvm::MDNode>(mdref)->getNumOperands();
}
const char *LLVMGetConstExprOpcodeName(LLVMValueRef inst)
{
return llvm::unwrap<llvm::ConstantExpr>(inst)->getOpcodeName();