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/MLRISC/block-placement/default-block-placement.sml
ViewVC logotype

View of /sml/trunk/src/MLRISC/block-placement/default-block-placement.sml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1133 - (download) (annotate)
Tue Mar 12 03:56:23 2002 UTC (17 years, 7 months ago) by george
File size: 998 byte(s)
Tested the jump chain elimination on all architectures (except the
hppa).  This is on by default right now and is profitable for the
alpha and x86, however, it may not be profitable for the sparc and ppc
when compiling the compiler.

The gc test will typically jump to a label at the end of the cluster,
where there is another jump to an external cluster containing the actual
code to invoke gc. This is to allow factoring of common gc invocation
sequences. That is to say, we generate:

	   ja	L1	% jump if above to L1

	   jmp L2

After jump chain elimination the 'ja L1' instructions is converted to
'ja L2'. On the sparc and ppc, many of the 'ja L2' instructions may end
up being implemented in their long form (if L2 is far away) using:

	jbe	L3	% jump if below or equal to L3
        jmp 	L2

For large compilation units L2  may be far away.
(* default-block-placement.sml
 * COPYRIGHT (c) 2001 Bell Labs, Lucent Technologies

(* Just the order in which blocks were generated *)
functor DefaultBlockPlacement (CFG : CONTROL_FLOW_GRAPH) : BLOCK_PLACEMENT = 
  structure CFG=CFG
  structure G = Graph

  fun error msg = MLRiscErrorMsg.error ("NaiveBlockPlacement", msg)

  fun blockPlacement (cfg as G.GRAPH graph) = let
    val ENTRY = 
      (case #entries graph () of [n] => n | _ => error "ENTRY")
    val EXIT = 
      (case #exits graph () of [n] => n | _ => error "EXIT")

    fun blocks () = let
      val entryBlk = (ENTRY, #node_info graph ENTRY)
      val exitBlk = (EXIT, #node_info graph EXIT)
      fun filter([]) = [exitBlk]
	| filter((node as (i, CFG.BLOCK{kind, ...}))::rest) = 
	    (case kind
	     of CFG.START  => filter rest
	      | CFG.STOP   => filter rest
	      | CFG.NORMAL => node::filter rest
    in entryBlk :: filter(#nodes graph ())
      (cfg, blocks())

ViewVC Help
Powered by ViewVC 1.0.0