changeset 1765:7b6831305a6a

Fix calculation for whether coalesceFlags is needed for xchg instruction in CPU DSL
author Michael Pavone <pavone@retrodev.com>
date Wed, 20 Feb 2019 00:34:52 -0800
parents 6cc2fa6a1955
children 1dc718581aac
files cpu_dsl.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/cpu_dsl.py	Wed Feb 20 00:16:27 2019 -0800
+++ b/cpu_dsl.py	Wed Feb 20 00:34:52 2019 -0800
@@ -731,6 +731,10 @@
 		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: