mirror of https://github.com/m-labs/artiq.git
Add accessors to instructions.
This commit is contained in:
parent
bdcb24108b
commit
9ff9f85f19
|
@ -383,6 +383,9 @@ class Branch(Terminator):
|
||||||
def opcode(self):
|
def opcode(self):
|
||||||
return "branch"
|
return "branch"
|
||||||
|
|
||||||
|
def target(self):
|
||||||
|
return self.operands[0]
|
||||||
|
|
||||||
class BranchIf(Terminator):
|
class BranchIf(Terminator):
|
||||||
"""
|
"""
|
||||||
A conditional branch instruction.
|
A conditional branch instruction.
|
||||||
|
@ -399,6 +402,15 @@ class BranchIf(Terminator):
|
||||||
def opcode(self):
|
def opcode(self):
|
||||||
return "branch_if"
|
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):
|
class Return(Terminator):
|
||||||
"""
|
"""
|
||||||
A return instruction.
|
A return instruction.
|
||||||
|
@ -413,6 +425,9 @@ class Return(Terminator):
|
||||||
def opcode(self):
|
def opcode(self):
|
||||||
return "return"
|
return "return"
|
||||||
|
|
||||||
|
def value(self):
|
||||||
|
return self.operands[0]
|
||||||
|
|
||||||
class Eval(Instruction):
|
class Eval(Instruction):
|
||||||
"""
|
"""
|
||||||
An instruction that evaluates an AST fragment.
|
An instruction that evaluates an AST fragment.
|
||||||
|
|
Loading…
Reference in New Issue