Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/compiler/CodeGen/main/mlriscGen.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/CodeGen/main/mlriscGen.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1115, Sun Mar 3 18:16:31 2002 UTC revision 1116, Tue Mar 5 23:17:18 2002 UTC
# Line 301  Line 301 
301              | _ => addTypBinding(f, CPS.BOGt)              | _ => addTypBinding(f, CPS.BOGt)
302             (*esac*))             (*esac*))
303    
304          (*
305           * A CPS register may be implemented as a physical
306           * register or a memory location.  The function assign moves a
307           * value v into a register or a memory location.
308           *)
309          fun assign(M.REG(ty,r), v) = M.MV(ty, r, v)
310            | assign(M.LOAD(ty, ea, mem), v) = M.STORE(ty, ea, v, mem)
311            | assign _ = error "assign"
312    
313    
314        (*        (*
315         * Function for generating code for one cluster.         * Function for generating code for one cluster.
# Line 465  Line 474 
474            in  markPTR e end            in  markPTR e end
475    
476            (*            (*
            * A CPS register may be implemented as a physical  
            * register or a memory location.  The function assign moves a  
            * value v into a register or a memory location.  
            *)  
           fun assign(M.REG(ty,r), v) = M.MV(ty, r, v)  
             | assign(M.LOAD(ty, ea, mem), v) = M.STORE(ty, ea, v, mem)  
             | assign _ = error "assign"  
   
           (*  
477             * The following function looks up the MLTREE expression associated             * The following function looks up the MLTREE expression associated
478             * with a general purpose value expression.             * with a general purpose value expression.
479             *)             *)
# Line 2123  Line 2123 
2123          pseudoOp (PB.EXT(CPs.FILENAME file));          pseudoOp (PB.EXT(CPs.FILENAME file));
2124          compile(endCluster NO_OPT)          compile(endCluster NO_OPT)
2125        end        end
2126    
2127          fun linkageCluster((fk,f,args,cty,cexp)::_) = let
2128            val stream = MLTreeComp.selectInstructions (Flowgen.build ())
2129            val TS.S.STREAM{beginCluster, emit, exitBlock, entryLabel, pseudoOp, endCluster, ...} = stream
2130            val flab = functionLabel f
2131            val lab = Label.anon()
2132            val formals = ArgP.standard{fnTy=typmap f, vfp=false, argTys=cty}
2133          in
2134              beginCluster 0;
2135              entryLabel lab;
2136              emit(assign(C.stdlink(false),
2137                            M.ADD(ity, C.stdlink(false),
2138                                  M.LABEXP(M.SUB(ity, M.LABEL(flab), M.LABEL(lab))))));
2139              emit (M.JMP(M.LABEL flab, [flab]));
2140              exitBlock(formals @ dedicated);
2141              compile(endCluster NO_OPT)
2142          end
2143    
2144    in    in
2145      app mkGlobalTables funcs;      app mkGlobalTables funcs;
2146        linkageCluster(funcs);
2147      app genCluster (Cluster.cluster funcs);      app genCluster (Cluster.cluster funcs);
2148      finishCompilationUnit source      finishCompilationUnit source
2149    end (* codegen *)    end (* codegen *)

Legend:
Removed from v.1115  
changed lines
  Added in v.1116

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0