summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2019-02-20 00:34:52 -0800
committerMichael Pavone <pavone@retrodev.com>2019-02-20 00:34:52 -0800
commit25253288a742690c1e1c256cecafbdc47749ce23 (patch)
treeed5046c19fbeb6520c907920311bf9e56aeb22f0
parent8dbc952e4329d86a2684fb94ee37e9508e07d8b4 (diff)
Fix calculation for whether coalesceFlags is needed for xchg instruction in CPU DSL
-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: