Add support for module named metadata
This is mainly useful to get access to top-level debug information through 'llvm.dbg.cu'. Wraps LLVM C-API functions `LLVMGetNamedMetadataNumOperands`, `LLVMGetNamedMetadataOperands` and `LLVMAddNamedMetadataOperand`. Also add testcase.
This commit is contained in:
parent
5ee6bba66b
commit
6e6bd1ea71
3 changed files with 46 additions and 1 deletions
|
|
@ -1457,6 +1457,15 @@ class MetaData(Value):
|
|||
ptr = _core.LLVMMetaDataGet(module.ptr, vs)
|
||||
return MetaData(ptr)
|
||||
|
||||
@staticmethod
|
||||
def get_named_operands(module, name):
|
||||
lst = _core.LLVMGetNamedMetadataOperands(module.ptr, name)
|
||||
return [MetaData(ptr) for ptr in lst]
|
||||
|
||||
@staticmethod
|
||||
def add_named_operand(module, name, operand):
|
||||
_core.LLVMAddNamedMetadataOperand(module.ptr, name, operand.ptr)
|
||||
|
||||
#===----------------------------------------------------------------------===
|
||||
# Instruction
|
||||
#===----------------------------------------------------------------------===
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue