# Path: vis/irvis.py
# def showFunction(f):
# def renderFunctionToFile(f):
# 
# Path: vis/dagvis.py
# def showSelDAG(dg):
# 
# Path: vis/interferencevis.py
# def showInterferenceGraph(ig):


import target
import selectiondag
import instructionselector
import interference
import registerallocator
import ir
import function
from vis import irvis
from vis import dagvis
from vis import interferencevis
from passes import jumpfix
from passes import blockmerge
from passes import unused
from passes import branchreplace
from passes import constantfold
from passes import copypropagation
from passes import mem2reg
        
        
        ofile.write(".text\n")
        for f in m:
            self.translateFunction(f,ofile)
    
    
    def translateFunction(self,f,ofile):
        
        
        if self.args.show_all or self.args.show_preopt_function:
            irvis.showFunction(f)

        if self.args.iropt:
            self.doIROpt(f)
        
        if self.args.show_all or self.args.show_postopt_function:
            irvis.showFunction(f)
        
        self.doInstructionSelection(f)
        self.callingConventions(f)
        
        #we are no longer in ssa after this point
        
        for block in f:
            self.blockFixups(block)
        
        self.removePhiNodes(f)
        
        if self.args.show_all or self.args.show_md_function_preallocation:

# Path: vis/irvis.py
# def showFunction(f):
# def renderFunctionToFile(f):
# 
# Path: vis/dagvis.py
# def showSelDAG(dg):
# 
# Path: vis/interferencevis.py
# def showInterferenceGraph(ig):


# Path: backend/standardmachine.py
import target
import selectiondag
import instructionselector
import interference
import registerallocator
import ir
import function
from vis import irvis
from vis import dagvis
from vis import interferencevis
from passes import jumpfix
from passes import blockmerge
from passes import unused
from passes import branchreplace
from passes import constantfold
from passes import copypropagation
from passes import mem2reg

        
        
        ofile.write(".text\n")
        for f in m:
            self.translateFunction(f,ofile)
    
    
    def translateFunction(self,f,ofile):
        
        
        if self.args.show_all or self.args.show_preopt_function:
            irvis.showFunction(f)

        if self.args.iropt:
            self.doIROpt(f)
        
        if self.args.show_all or self.args.show_postopt_function:
            irvis.showFunction(f)
        
        self.doInstructionSelection(f)
        self.callingConventions(f)
        
        #we are no longer in ssa after this point
        
        for block in f:
            self.blockFixups(block)
        
        self.removePhiNodes(f)
        
        if self.args.show_all or self.args.show_md_function_preallocation:

            irvis.showFunction(f)