2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 19:28:26 +08:00

Add accessors to instructions.

This commit is contained in:
whitequark 2015-07-14 22:18:38 +03:00
parent bdcb24108b
commit 9ff9f85f19

View File

@ -383,6 +383,9 @@ class Branch(Terminator):
def opcode(self):
return "branch"
def target(self):
return self.operands[0]
class BranchIf(Terminator):
"""
A conditional branch instruction.
@ -399,6 +402,15 @@ class BranchIf(Terminator):
def opcode(self):
return "branch_if"
def condition(self):
return self.operands[0]
def if_true(self):
return self.operands[1]
def if_false(self):
return self.operands[2]
class Return(Terminator):
"""
A return instruction.
@ -413,6 +425,9 @@ class Return(Terminator):
def opcode(self):
return "return"
def value(self):
return self.operands[0]
class Eval(Instruction):
"""
An instruction that evaluates an AST fragment.