summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcpu_dsl.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/cpu_dsl.py b/cpu_dsl.py
index 44f8b7e..611dd96 100755
--- a/cpu_dsl.py
+++ b/cpu_dsl.py
@@ -731,6 +731,10 @@ class NormalOp:
for param in self.params:
allowConst = (self.op in prog.subroutines or len(procParams) != len(self.params) - 1) and param in parent.regValues
isDst = (not opDef is None) and len(procParams) in opDef.outOp
+ if isDst and self.op == 'xchg':
+ #xchg uses its regs as both source and destination
+ #we need to resolve as both so that disperse/coalesce flag stuff gets done
+ prog.resolveParam(param, parent, fieldVals, allowConst, False)
param = prog.resolveParam(param, parent, fieldVals, allowConst, isDst)
if (not type(param) is int) and len(procParams) != len(self.params) - 1: