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

Diff of /sml/trunk/src/MLRISC/sparc/c-calls/sparc-c-calls.sml

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

revision 1043, Mon Jan 28 21:26:03 2002 UTC revision 1049, Thu Jan 31 21:03:49 2002 UTC
# Line 68  Line 68 
68      val mem = T.Region.memory      val mem = T.Region.memory
69      val stack = T.Region.memory      val stack = T.Region.memory
70    
71        val maxRegArgs = 6
72      val paramAreaOffset = 68      val paramAreaOffset = 68
73    
74      fun LI i = T.LI (T.I.fromInt (32, i))      fun LI i = T.LI (T.I.fromInt (32, i))
# Line 159  Line 160 
160              loop (paramTys, 0)              loop (paramTys, 0)
161          end          end
162    
163          val regargwords = Int.min (nargwords, 6)          val regargwords = Int.min (nargwords, maxRegArgs)
164          val stackargwords = Int.max (nargwords, 6) - 6          val stackargwords = Int.max (nargwords, maxRegArgs) - maxRegArgs
165    
166          val scratchstart = 92 + 4*stackargwords          val stackargsstart = paramAreaOffset + 4 * maxRegArgs
167    
168            val scratchstart = stackargsstart + 4 * stackargwords
169    
170          (* Copy struct or part thereof to designated area on the stack.          (* Copy struct or part thereof to designated area on the stack.
171           * An already properly aligned address (relative to %sp) is           * An already properly aligned address (relative to %sp) is
# Line 245  Line 248 
248              end              end
249    
250          val (stackdelta, argsetupcode, copycode) = let          val (stackdelta, argsetupcode, copycode) = let
251              fun loop ([], [], _, ss, asc, cpc) = (roundup (ss, 8), asc, cpc)              fun loop ([], [], _, ss, asc, cpc) =
252                    (roundup (Int.max (0, ss - stackargsstart), 8), asc, cpc)
253                | loop (t :: tl, a :: al, n, ss, asc, cpc) = let                | loop (t :: tl, a :: al, n, ss, asc, cpc) = let
254                      fun wordassign a =                      fun wordassign a =
255                          if n < 6 then T.MV (32, oreg n, a)                          if n < 6 then T.MV (32, oreg n, a)
# Line 377  Line 381 
381    
382              val defs = g_regs @ a_regs @ l_reg :: f_regs              val defs = g_regs @ a_regs @ l_reg :: f_regs
383              (* A call instruction "uses" just the argument registers. *)              (* A call instruction "uses" just the argument registers. *)
384              val uses = List.take (a_regs, stackargwords)              val uses = List.take (a_regs, regargwords)
385          in          in
386              (defs, uses)              (defs, uses)
387          end          end
# Line 422  Line 426 
426                | SOME c =>                | SOME c =>
427                  T.ANNOTATION (call, #create MLRiscAnnotations.COMMENT c)                  T.ANNOTATION (call, #create MLRiscAnnotations.COMMENT c)
428    
429            val (sp_sub, sp_add) =
430                if stackdelta = 0 then ([], []) else
431                if paramAlloc { szb = stackdelta, align = 4 } then ([], [])
432                else ([T.MV (32, sp, T.SUB (32, spreg, LI stackdelta))],
433                      [T.MV (32, sp, addli (spreg, stackdelta))])
434    
435          val callseq =          val callseq =
436              List.concat [[T.MV (32, sp, T.SUB (32, spreg, LI stackdelta))],              List.concat [sp_sub,
437                           copycode,                           copycode,
438                           argsetupcode,                           argsetupcode,
439                           sretsetup,                           sretsetup,
# Line 431  Line 441 
441                           [call],                           [call],
442                           srethandshake,                           srethandshake,
443                           restore,                           restore,
444                           [T.MV (32, sp, addli (spreg, stackdelta))]]                           sp_add]
445    
446      in      in
447          { callseq = callseq, result = result }          { callseq = callseq, result = result }

Legend:
Removed from v.1043  
changed lines
  Added in v.1049

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