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

SCM Repository

[smlnj] View of /sml/trunk/src/compiler/CodeGen/alpha32/alpha32CG.sml
ViewVC logotype

View of /sml/trunk/src/compiler/CodeGen/alpha32/alpha32CG.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 429 - (download) (annotate)
Wed Sep 8 09:47:00 1999 UTC (20 years, 3 months ago) by monnier
Original Path: sml/branches/SMLNJ/src/compiler/CodeGen/alpha32/alpha32CG.sml
File size: 2960 byte(s)
version 110.21
(*
 * Alpha32 specific backend
 *)
structure Alpha32CG = 
  MachineGen
  ( structure I          = Alpha32Instr
    structure MachSpec   = Alpha32Spec
    structure PseudoOps  = Alpha32PseudoOps
    structure CpsRegs    = Alpha32CpsRegs
    structure InsnProps  = AlphaProps(Alpha32Instr)
    structure Asm        = Alpha32AsmEmitter

    structure MLTreeComp=
       Alpha(structure AlphaInstr = Alpha32Instr
             structure AlphaMLTree = Alpha32MLTree
             structure PseudoInstrs = Alpha32PseudoInstrs
             val mode32bit = true (* simulate 32 bit mode *)
             val useSU = false
             val multCost = ref 8 (* just guessing *)
             val useMultByConst = ref false (* just guessing *)
            )

    structure Alpha32Jumps =
       AlphaJumps(structure Instr=Alpha32Instr
                  structure Shuffle=Alpha32Shuffle)

    structure BackPatch =
       BBSched2(structure Flowgraph = Alpha32FlowGraph
                structure Jumps = Alpha32Jumps
                structure Emitter = Alpha32MCEmitter)

    structure RA = 
       RegAlloc
         (structure I         = Alpha32Instr
          structure MachSpec  = Alpha32Spec
          structure Flowgraph = Alpha32FlowGraph
          structure CpsRegs   = Alpha32CpsRegs
          structure InsnProps = InsnProps 
          structure Rewrite   = AlphaRewrite(Alpha32Instr)
          structure Asm       = Alpha32AsmEmitter
          functor Ra = AlphaRegAlloc 

          val sp = I.C.stackptrR
          val stack = I.Region.stack

          (* make copies *)
          fun copyR((rds as [_], rss as [_]), _) =
              I.COPY{dst=rds, src=rss, impl=ref NONE, tmp=NONE}
            | copyR((rds, rss), I.COPY{tmp, ...}) =
              I.COPY{dst=rds, src=rss, impl=ref NONE, tmp=tmp}
          fun copyF((fds as [_], fss as [_]), _) =
              I.FCOPY{dst=fds, src=fss, impl=ref NONE, tmp=NONE}
            | copyF((fds, fss), I.FCOPY{tmp, ...}) =
              I.FCOPY{dst=fds, src=fss, impl=ref NONE, tmp=tmp}

          (* spill copy temp *)
          fun spillCopyTmp(I.COPY{tmp,dst,src,impl},loc) =
              I.COPY{tmp=SOME(I.Displace{base=sp, disp=loc}),
                     dst=dst,src=src,impl=impl}
          fun spillFcopyTmp(I.FCOPY{tmp,dst,src,impl},loc) =
              I.FCOPY{tmp=SOME(I.Displace{base=sp, disp=loc}),
                      dst=dst,src=src,impl=impl}

          (* spill register *)
          fun spillInstrR(r,offset) =
              [I.STORE{stOp=I.STL, b=sp, d=I.IMMop offset, r=r, mem=stack}]
          fun spillInstrF(r,offset) =
              [I.FSTORE{stOp=I.STT, b=sp, d=I.IMMop offset, r=r, mem=stack}]

          (* reload register *)
          fun reloadInstrR(r,offset,rest) =
              I.LOAD{ldOp=I.LDL, b=sp, d=I.IMMop offset, r=r, mem=stack}::rest
          fun reloadInstrF(r,offset,rest) =
              I.FLOAD{ldOp=I.LDT, b=sp, d=I.IMMop offset, r=r, mem=stack}::rest
         )
  )

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