# Path: backend/machineinstruction.py
# class MI(Instruction):
#     def __init__(self,node=None):
#     def asm(self):
#     def getDagDisplayText(self):
#     def isMD(self):
#     def __repr__(self):
#     def match(cls,node):
#     def replace(cls,node,inst):


from backend import machineinstruction
from backend.patterns import *
import x86
    def asm(self):
        r = self.assigned[0]
        offset = self.sym.slot.offset
        if offset == None:
            offsetStr = 'XXX'
        else:
            offsetStr = str( ( 8 + offset) ) 
        return 'mov %%ebp, %%%s\nadd $%s, %%%s'%(r,offsetStr,r)

class X86StoreI32(machineinstruction.MI):
    pattern = Store(Pointer,I32)
    asmstr = "mov %{1},(%{0})"

class X86StoreI8(machineinstruction.MI):
    pattern = Store(Pointer,I8)
    asmstr = "mov %{1},(%{0})"
    
 
class X86StorePointer(machineinstruction.MI):
    pattern = Store(Pointer,Pointer)
    asmstr = "mov %{1},(%{0})"

class X86DerefI32(machineinstruction.MI):
    pattern = Set(I32,Deref(Pointer))
    asmstr = "mov (%{1}),%{0}"

class X86DerefI8(machineinstruction.MI):
    pattern = Set(I8,Deref(Pointer))
    asmstr = "mov (%{1}),%{0}"   


# Path: backend/machineinstruction.py
# class MI(Instruction):
#     def __init__(self,node=None):
#     def asm(self):
#     def getDagDisplayText(self):
#     def isMD(self):
#     def __repr__(self):
#     def match(cls,node):
#     def replace(cls,node,inst):


# Path: backend/x86/x86md.py
from backend import machineinstruction
from backend.patterns import *
import x86

    def asm(self):
        r = self.assigned[0]
        offset = self.sym.slot.offset
        if offset == None:
            offsetStr = 'XXX'
        else:
            offsetStr = str( ( 8 + offset) ) 
        return 'mov %%ebp, %%%s\nadd $%s, %%%s'%(r,offsetStr,r)

class X86StoreI32(machineinstruction.MI):
    pattern = Store(Pointer,I32)
    asmstr = "mov %{1},(%{0})"

class X86StoreI8(machineinstruction.MI):
    pattern = Store(Pointer,I8)
    asmstr = "mov %{1},(%{0})"
    
 
class X86StorePointer(machineinstruction.MI):
    pattern = Store(Pointer,Pointer)
    asmstr = "mov %{1},(%{0})"

class X86DerefI32(machineinstruction.MI):
    pattern = Set(I32,Deref(Pointer))
    asmstr = "mov (%{1}),%{0}"

class X86DerefI8(machineinstruction.MI):
    pattern = Set(I8,Deref(Pointer))
    asmstr = "mov (%{1}),%{0}"   


class X86DerefPointer(machineinstruction.MI):