# Path: awake/placeholders.py
# BC = Register("BC")
# DE = Register("DE")
# HL = Register("HL")
# SP = Register("SP")
# AF = Register("AF")
# B = Register("B")
# C = Register("C")
# D = Register("D")
# E = Register("E")
# H = Register("H")
# L = Register("L")
# A = Register("A")
# FNZ = Condition("FNZ")
# FZ = Condition("FZ")
# FNC = Condition("FNC")
# FC = Condition("FC")
# ALWAYS = Condition("ALWAYS")
# ROMBANK = Register('ROMBANK')
# def get(name, value):
# 
# Path: awake/expression.py
# def parse(text):
#     try:
#         lexer = shlex.shlex(text)
#         lexer.commenters = ''
#         lexer.wordchars += '#'
#         return expression(lexer)
#     except ExpressionError as e:
#         print('ERROR:', e.msg, 'in', text)
# 
# Path: awake/regutil.py
# def splitRegister(name):
#     if name in ('BC', 'DE', 'HL'):
#         return set([name[0], name[1]])
#     elif name == 'AF':
#         #return set(['A', 'FZ', 'FC', 'FN', 'FH'])
#         return set(['A'])
#     elif name == 'FNZ':
#         return set(['FZ'])
#     elif name == 'FNC':
#         return set(['FC'])
#     elif name == 'FF00+C':
#         return set(['C'])
#     return set([name])


import re
from awake import placeholders
from awake.expression import parse
from awake.regutil import splitRegister

        for w in m.group(2).split(';'):
            w = w.strip()
            if not w:
                continue
            if ':' in w:
                name, value = w.split(':', 2)
                values[name] = value
            else:
                name = w
            writes.append(name)

        self.reads = reads
        self.writes = writes
        self.values = values

    def filled(self, params, ctx):
        reads = set()
        writes = set()
        values = dict()
        loads = []

        for x in self.reads:
            if x.startswith("#"):
                assert(len(x) == 2)
                value = params[x[1]]
                operand = placeholders.get(x[1], value)
                # XXX: solution here: just add operand.getDependencies()
                if hasattr(operand, 'target'):
                    reads.add('mem')

# Path: awake/placeholders.py
# BC = Register("BC")
# DE = Register("DE")
# HL = Register("HL")
# SP = Register("SP")
# AF = Register("AF")
# B = Register("B")
# C = Register("C")
# D = Register("D")
# E = Register("E")
# H = Register("H")
# L = Register("L")
# A = Register("A")
# FNZ = Condition("FNZ")
# FZ = Condition("FZ")
# FNC = Condition("FNC")
# FC = Condition("FC")
# ALWAYS = Condition("ALWAYS")
# ROMBANK = Register('ROMBANK')
# def get(name, value):
# 
# Path: awake/expression.py
# def parse(text):
#     try:
#         lexer = shlex.shlex(text)
#         lexer.commenters = ''
#         lexer.wordchars += '#'
#         return expression(lexer)
#     except ExpressionError as e:
#         print('ERROR:', e.msg, 'in', text)
# 
# Path: awake/regutil.py
# def splitRegister(name):
#     if name in ('BC', 'DE', 'HL'):
#         return set([name[0], name[1]])
#     elif name == 'AF':
#         #return set(['A', 'FZ', 'FC', 'FN', 'FH'])
#         return set(['A'])
#     elif name == 'FNZ':
#         return set(['FZ'])
#     elif name == 'FNC':
#         return set(['FC'])
#     elif name == 'FF00+C':
#         return set(['C'])
#     return set([name])


# Path: awake/opcodeeffect.py
import re
from awake import placeholders
from awake.expression import parse
from awake.regutil import splitRegister


        for w in m.group(2).split(';'):
            w = w.strip()
            if not w:
                continue
            if ':' in w:
                name, value = w.split(':', 2)
                values[name] = value
            else:
                name = w
            writes.append(name)

        self.reads = reads
        self.writes = writes
        self.values = values

    def filled(self, params, ctx):
        reads = set()
        writes = set()
        values = dict()
        loads = []

        for x in self.reads:
            if x.startswith("#"):
                assert(len(x) == 2)
                value = params[x[1]]
                operand = placeholders.get(x[1], value)
                # XXX: solution here: just add operand.getDependencies()
                if hasattr(operand, 'target'):
                    reads.add('mem')

                    reads |= splitRegister('HL')  # TODO: XXX: bad