mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 11:18:27 +08:00
ir: fix incoming_{blocks,values,value_for_block}.
This commit is contained in:
parent
ac3a170c8f
commit
2a474b7166
@ -242,13 +242,13 @@ class Phi(Instruction):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def incoming_blocks(self):
|
def incoming_blocks(self):
|
||||||
return (block for (block, value) in self.incoming())
|
return (block for (value, block) in self.incoming())
|
||||||
|
|
||||||
def incoming_values(self):
|
def incoming_values(self):
|
||||||
return (value for (block, value) in self.incoming())
|
return (value for (value, block) in self.incoming())
|
||||||
|
|
||||||
def incoming_value_for_block(self, target_block):
|
def incoming_value_for_block(self, target_block):
|
||||||
for (block, value) in self.incoming():
|
for (value, block) in self.incoming():
|
||||||
if block == target_block:
|
if block == target_block:
|
||||||
return value
|
return value
|
||||||
assert False
|
assert False
|
||||||
@ -262,12 +262,14 @@ class Phi(Instruction):
|
|||||||
|
|
||||||
def remove_incoming_value(self, value):
|
def remove_incoming_value(self, value):
|
||||||
index = self.operands.index(value)
|
index = self.operands.index(value)
|
||||||
|
assert index % 2 == 0
|
||||||
self.operands[index].uses.remove(self)
|
self.operands[index].uses.remove(self)
|
||||||
self.operands[index + 1].uses.remove(self)
|
self.operands[index + 1].uses.remove(self)
|
||||||
del self.operands[index:index + 2]
|
del self.operands[index:index + 2]
|
||||||
|
|
||||||
def remove_incoming_block(self, block):
|
def remove_incoming_block(self, block):
|
||||||
index = self.operands.index(block)
|
index = self.operands.index(block)
|
||||||
|
assert index % 2 == 1
|
||||||
self.operands[index - 1].uses.remove(self)
|
self.operands[index - 1].uses.remove(self)
|
||||||
self.operands[index].uses.remove(self)
|
self.operands[index].uses.remove(self)
|
||||||
del self.operands[index - 1:index + 1]
|
del self.operands[index - 1:index + 1]
|
||||||
|
Loading…
Reference in New Issue
Block a user