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 1045, Mon Jan 28 22:13:13 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 scratchstart = paramAreaOffset + 4 * (maxRegArgs + stackargwords)
167    
168          (* Copy struct or part thereof to designated area on the stack.          (* Copy struct or part thereof to designated area on the stack.
169           * An already properly aligned address (relative to %sp) is           * An already properly aligned address (relative to %sp) is
# Line 377  Line 378 
378    
379              val defs = g_regs @ a_regs @ l_reg :: f_regs              val defs = g_regs @ a_regs @ l_reg :: f_regs
380              (* A call instruction "uses" just the argument registers. *)              (* A call instruction "uses" just the argument registers. *)
381              val uses = List.take (a_regs, stackargwords)              val uses = List.take (a_regs, regargwords)
382          in          in
383              (defs, uses)              (defs, uses)
384          end          end
# Line 422  Line 423 
423                | SOME c =>                | SOME c =>
424                  T.ANNOTATION (call, #create MLRiscAnnotations.COMMENT c)                  T.ANNOTATION (call, #create MLRiscAnnotations.COMMENT c)
425    
426            val (sp_sub, sp_add) =
427                if stackdelta = 0 then ([], []) else
428                if paramAlloc { szb = stackdelta, align = 4 } then ([], [])
429                else ([T.MV (32, sp, T.SUB (32, spreg, LI stackdelta))],
430                      [T.MV (32, sp, addli (spreg, stackdelta))])
431    
432          val callseq =          val callseq =
433              List.concat [[T.MV (32, sp, T.SUB (32, spreg, LI stackdelta))],              List.concat [sp_sub,
434                           copycode,                           copycode,
435                           argsetupcode,                           argsetupcode,
436                           sretsetup,                           sretsetup,
# Line 431  Line 438 
438                           [call],                           [call],
439                           srethandshake,                           srethandshake,
440                           restore,                           restore,
441                           [T.MV (32, sp, addli (spreg, stackdelta))]]                           sp_add]
442    
443      in      in
444          { callseq = callseq, result = result }          { callseq = callseq, result = result }

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

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