add support for metadata.
add related test.
This commit is contained in:
parent
78cde30883
commit
82117d899e
6 changed files with 113 additions and 5 deletions
14
llvm/core.py
14
llvm/core.py
|
|
@ -1427,6 +1427,17 @@ class Function(GlobalValue):
|
|||
# failure, it appears to print result to stderr and abort.
|
||||
return _core.LLVMVerifyFunction(self.ptr) != 0
|
||||
|
||||
#===----------------------------------------------------------------------===
|
||||
# MetaData
|
||||
#===----------------------------------------------------------------------===
|
||||
|
||||
class MetaData(Value):
|
||||
@staticmethod
|
||||
def get(module, values):
|
||||
vs = unpack_values(values)
|
||||
ptr = _core.LLVMMetaDataGet(module.ptr, vs)
|
||||
return MetaData(ptr)
|
||||
|
||||
#===----------------------------------------------------------------------===
|
||||
# Instruction
|
||||
#===----------------------------------------------------------------------===
|
||||
|
|
@ -1477,6 +1488,9 @@ class Instruction(User):
|
|||
def set_volatile(self, flag):
|
||||
return _core.LLVMSetVolatile(self.ptr, int(bool(flag)))
|
||||
|
||||
def set_metadata(self, kind, metadata):
|
||||
return _core.LLVMInstSetMetaData(self.ptr, kind, metadata.ptr)
|
||||
|
||||
@property
|
||||
def opcode(self):
|
||||
return _core.LLVMInstGetOpcode(self.ptr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue