Added instruction operands (Seth Warn)
git-svn-id: http://llvm-py.googlecode.com/svn/trunk@66 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
parent
1b4b807884
commit
2eeb7630a1
6 changed files with 93 additions and 2 deletions
16
llvm/core.py
16
llvm/core.py
|
|
@ -1772,6 +1772,10 @@ class GlobalValue(Constant):
|
|||
|
||||
def __init__(self, ptr):
|
||||
Constant.__init__(self, ptr)
|
||||
# Hang on to the module, don't let it die before we do.
|
||||
# It is nice to have just a map of functions without
|
||||
# retaining a ref to the owning module.
|
||||
self._module_obj = self.module
|
||||
|
||||
def _get_linkage(self): return _core.LLVMGetLinkage(self.ptr)
|
||||
def _set_linkage(self, value): _core.LLVMSetLinkage(self.ptr, value)
|
||||
|
|
@ -2001,6 +2005,18 @@ class Instruction(Value):
|
|||
def opcode_name(self):
|
||||
return _core.LLVMInstGetOpcodeName(self.ptr)
|
||||
|
||||
@property
|
||||
def operand_count(self):
|
||||
return _core.LLVMInstGetNumOperands(self.ptr)
|
||||
|
||||
@property
|
||||
def operands(self):
|
||||
"""Yields operands of this instruction."""
|
||||
return [self._get_operand(i) for i in range(self.operand_count)]
|
||||
|
||||
def _get_operand(self, i):
|
||||
return _make_value(_core.LLVMInstGetOperand(self.ptr, i))
|
||||
|
||||
|
||||
class CallOrInvokeInstruction(Instruction):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue