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 /MLRISC/trunk/c-call/test/c-sparc-test.sml
ViewVC logotype

Diff of /MLRISC/trunk/c-call/test/c-sparc-test.sml

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

revision 3177, Fri Aug 1 22:53:25 2008 UTC revision 3186, Tue Aug 5 22:44:16 2008 UTC
# Line 13  Line 13 
13   *)   *)
14  structure UserConst =  structure UserConst =
15  struct  struct
16     type const = unit     type const = int
17     fun toString() = ""     val toString = Int.toString
18     fun hash() = 0w0     fun hash _ = 0w0
19     fun valueOf _ = 0     fun valueOf _ = 0
20     fun == _ = true     fun == _ = true
21  end  end
# Line 155  Line 155 
155      val V9 = false  (* we'll generate V8 instructions for now *)      val V9 = false  (* we'll generate V8 instructions for now *)
156     )     )
157    
158  structure SparcPseudoInstrs : SPARC_PSEUDO_INSTR =  structure SparcPseudoInstrs =
159  struct  struct
160    structure I = SparcInstr    structure I = SparcInstr
161    structure C = I.C    structure C = I.C
# Line 276  Line 276 
276                         [I.ticc{t=I.BVS,cc=I.ICC,r=C.r0,i=I.IMMED 7}]                         [I.ticc{t=I.BVS,cc=I.ICC,r=C.r0,i=I.IMMED 7}]
277    val overflowtrap64 = [] (* not needed *)    val overflowtrap64 = [] (* not needed *)
278    
279      fun save (r, opnd :SparcInstr.operand, d) = [I.save{r=r, i=opnd, d=d}]
280      fun restore (r, opnd :SparcInstr.operand, d) = [I.restore{r=r, i=opnd, d=d}]
281    
282  end  end
283    
# Line 478  Line 480 
480            SparcEmit.asmEmit (cfg, blocks)            SparcEmit.asmEmit (cfg, blocks)
481          end (* dumpOutput *)          end (* dumpOutput *)
482    
483        val GP = SparcCells.GPReg
484        val FP = SparcCells.FPReg
485        fun greg r = GP r
486        fun oreg r = GP (r + 8)
487        fun ireg r = GP (r + 24)
488        fun freg r = FP r
489        fun reg32 r = T.REG (32, r)
490        fun freg64 r = T.FREG (64, r)
491        fun LI i = T.LI (T.I.fromInt (32, i))
492        val sp = oreg 6
493    
494      fun codegen (functionName, target, proto, initStms, args) = let      fun codegen (functionName, target, proto, initStms, args) = let
495          val _ = Label.reset()          val _ = Label.reset()
# Line 497  Line 509 
509    
510          fun wordLit i = T.LI (T.I.fromInt (wordTy, i))          fun wordLit i = T.LI (T.I.fromInt (wordTy, i))
511    
512            fun offfp i = T.ADD(32, T.REG (32, ireg 6), LI i)
513    
514          val stms = List.concat [          val stms = List.concat [
515                       [T.EXT(SparcInstrExt.SAVE(T.REG(32, sp), LI(~112), T.REG(32, sp)))],
516                     initStms,                     initStms,
517                     callseq,                     callseq,
518                     [T.RET []]]                     [T.EXT(SparcInstrExt.RESTORE(T.REG(32, greg 0), T.REG(32, greg 0), T.REG(32, greg 0)))],
519                       [T.JMP(T.ADD(32, T.REG(32, oreg 7), LI 8), [])]
520                       ]
521    
522  (*      val _ = List.all (fn stm => ChkTy.check stm  (*      val _ = List.all (fn stm => ChkTy.check stm
523                                      orelse raise Fail ("typechecking error: "^SparcMTC.SparcMLTreeUtils.stmToString stm))                                      orelse raise Fail ("typechecking error: "^SparcMTC.SparcMLTreeUtils.stmToString stm))
# Line 529  Line 546 
546                    structure CCall = SparcCCall                    structure CCall = SparcCCall
547                    structure Cells = SparcCells                    structure Cells = SparcCells
548                    val codegen = codegen                    val codegen = codegen
549                    val param0 = reg32(oreg 0)                    val param0 = reg32(ireg 0)
550                    val wordTy = 32)                    val wordTy = 32)
551  end  end

Legend:
Removed from v.3177  
changed lines
  Added in v.3186

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